summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-01-24 15:55:02 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-01-31 11:56:59 +0100
commitb4a4aaed7833e2def0c8bb3681523d7aabe365f9 (patch)
tree97adbb8cd7b0d612733dc6cc3e81dcb2d7be233d /platform
parent8a3257b01faa899dd9b5e35c6bb3403cd709c371 (diff)
downloadmupdf-b4a4aaed7833e2def0c8bb3681523d7aabe365f9.tar.xz
Fix 698878: Mouse wheel scrolling.
Diffstat (limited to 'platform')
-rw-r--r--platform/gl/gl-main.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index 620348c2..f10dc21d 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -1478,6 +1478,14 @@ static void on_special(int key, int x, int y)
}
}
+static void on_wheel(int wheel, int direction, int x, int y)
+{
+ ui.scroll_x = wheel == 1 ? direction : 0;
+ ui.scroll_y = wheel == 0 ? direction : 0;
+ run_main_loop();
+ ui.scroll_x = ui.scroll_y = 0;
+}
+
static void on_mouse(int button, int action, int x, int y)
{
ui.x = x;
@@ -1487,6 +1495,10 @@ static void on_mouse(int button, int action, int x, int y)
case GLUT_LEFT_BUTTON: ui.down = (action == GLUT_DOWN); break;
case GLUT_MIDDLE_BUTTON: ui.middle = (action == GLUT_DOWN); break;
case GLUT_RIGHT_BUTTON: ui.right = (action == GLUT_DOWN); break;
+ case 3: if (action == GLUT_DOWN) on_wheel(0, 1, x, y); break;
+ case 4: if (action == GLUT_DOWN) on_wheel(0, -1, x, y); break;
+ case 5: if (action == GLUT_DOWN) on_wheel(1, 1, x, y); break;
+ case 6: if (action == GLUT_DOWN) on_wheel(1, -1, x, y); break;
}
run_main_loop();
}
@@ -1498,14 +1510,6 @@ static void on_motion(int x, int y)
glutPostRedisplay();
}
-static void on_wheel(int wheel, int direction, int x, int y)
-{
- ui.scroll_x = wheel == 1 ? direction * 10 : 0;
- ui.scroll_y = wheel == 0 ? direction * 10 : 0;
- run_main_loop();
- ui.scroll_x = ui.scroll_y = 0;
-}
-
static void on_reshape(int w, int h)
{
showinfo = 0;