From 796c6001e0ec49819745d9c5344ef5e1e528cee9 Mon Sep 17 00:00:00 2001 From: jpereira Date: Sat, 30 Nov 2019 11:10:34 +0000 Subject: [PATCH 1/2] Mouse side buttons for previous/next page --- platform/gl/gl-app.h | 2 ++ platform/gl/gl-main.c | 4 ++-- platform/gl/gl-ui.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/gl/gl-app.h b/platform/gl/gl-app.h index 7f91484e8e..f357f3b450 100644 --- a/platform/gl/gl-app.h +++ b/platform/gl/gl-app.h @@ -53,6 +53,8 @@ enum KEY_F10, KEY_F11, KEY_F12, + MOUSE_SIDE_1, + MOUSE_SIDE_2, }; enum side { ALL, T, R, B, L }; diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index 1bbdfa0588..dfd3bd8414 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -1417,12 +1417,12 @@ static void do_app(void) case 'g': jump_to_page(number - 1); break; case 'G': jump_to_location(fz_last_page(ctx, doc)); break; - case ',': case KEY_PAGE_UP: + case ',': case KEY_PAGE_UP: case MOUSE_SIDE_1: number = fz_maxi(number, 1); while (number--) currentpage = fz_previous_page(ctx, doc, currentpage); break; - case '.': case KEY_PAGE_DOWN: + case '.': case KEY_PAGE_DOWN: case MOUSE_SIDE_2: number = fz_maxi(number, 1); while (number--) currentpage = fz_next_page(ctx, doc, currentpage); diff --git a/platform/gl/gl-ui.c b/platform/gl/gl-ui.c index 61111dedf0..376bc08b12 100644 --- a/platform/gl/gl-ui.c +++ b/platform/gl/gl-ui.c @@ -307,6 +307,8 @@ static void on_mouse(int button, int action, int x, int y) case 4: on_wheel(0, -1, x, y); break; case 5: on_wheel(1, 1, x, y); break; case 6: on_wheel(1, -1, x, y); break; + case 7: ui.key = MOUSE_SIDE_1; break; + case 8: ui.key = MOUSE_SIDE_2; break; } } else if (action == GLUT_UP) @@ -319,7 +321,9 @@ static void on_mouse(int button, int action, int x, int y) } } ui.mod = glutGetModifiers(); + ui.plain = !(ui.mod & ~GLUT_ACTIVE_SHIFT); run_main_loop(); + ui.key = ui.plain = 0; ui_invalidate(); // TODO: leave this to caller } From 64d37f24e0936cc805e631dd3e0fe93502d88e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Pereira?= <95joaopereira@gmail.com> Date: Sat, 30 Nov 2019 11:20:28 +0000 Subject: [PATCH 2/2] Add side buttons explanation to mupdf-gl manual --- docs/manual-mupdf-gl.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/manual-mupdf-gl.html b/docs/manual-mupdf-gl.html index 367b46a5a1..a036e05748 100644 --- a/docs/manual-mupdf-gl.html +++ b/docs/manual-mupdf-gl.html @@ -47,6 +47,9 @@

Mouse Bindings

The right mouse button selects a region and copies the marked text to the clipboard. + +

+The mouse4/mouse5 side buttons go one page backward/forward.

Key Bindings