summaryrefslogtreecommitdiff
path: root/platform/x11/win_main.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2015-03-31 17:10:37 +0100
committerRobin Watts <robin.watts@artifex.com>2015-03-31 18:34:22 +0100
commit0a039da57c4ad338ed6e6f818b480d2124223a6d (patch)
tree8e42ceda2141381dbb84855da8ca7c8868c769dd /platform/x11/win_main.c
parentc4e17decdd2e278a44e281a8d3342b94dd833891 (diff)
downloadmupdf-0a039da57c4ad338ed6e6f818b480d2124223a6d.tar.xz
Bug 695457: Improve mouse wheel handling in viewer.
On windows, handle mouse wheel events as mouse events rather than keyboard ones. This means that Ctrl-wheel zooms as expected (consistent with Chrome etc). Also ensure that Shift-wheel changes from vertical to horizontal. Mouse wheel over pages that are larger than fit in the window now scroll around the page. Once they hit the edge of the window, the page flips to the next/previous page as you would expect.
Diffstat (limited to 'platform/x11/win_main.c')
-rw-r--r--platform/x11/win_main.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c
index 532fa76c..32121f5f 100644
--- a/platform/x11/win_main.c
+++ b/platform/x11/win_main.c
@@ -910,8 +910,11 @@ static void killtimer(pdfapp_t *app)
timer_pending = 0;
}
-void handlekey(int c, int modifier)
+void handlekey(int c)
{
+ int modifier = (GetAsyncKeyState(VK_SHIFT) < 0);
+ modifier |= ((GetAsyncKeyState(VK_CONTROL) < 0)<<2);
+
if (timer_pending)
killtimer(&gapp);
@@ -1100,9 +1103,11 @@ viewproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEWHEEL:
if ((signed short)HIWORD(wParam) > 0)
- handlekey(LOWORD(wParam) & MK_SHIFT ? '+' : 'k', 0);
+ handlemouse(oldx, oldy, 4, 1);
+ //handlekey(LOWORD(wParam) & MK_SHIFT ? '+' : 'k');
else
- handlekey(LOWORD(wParam) & MK_SHIFT ? '-' : 'j', 0);
+ handlemouse(oldx, oldy, 5, 1);
+ //handlekey(LOWORD(wParam) & MK_SHIFT ? '-' : 'j');
return 0;
/* Timer */
@@ -1110,7 +1115,7 @@ viewproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (wParam == OUR_TIMER_ID && timer_pending && gapp.presentation_mode)
{
timer_pending = 0;
- handlekey(VK_RIGHT + 256, 0);
+ handlekey(VK_RIGHT + 256);
handlemouse(oldx, oldy, 0, 0); /* update cursor */
return 0;
}
@@ -1130,7 +1135,7 @@ viewproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case VK_DOWN:
case VK_NEXT:
case VK_ESCAPE:
- handlekey(wParam + 256, 0);
+ handlekey(wParam + 256);
handlemouse(oldx, oldy, 0, 0); /* update cursor */
return 0;
}
@@ -1140,9 +1145,7 @@ viewproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CHAR:
if (wParam < 256)
{
- int modifier = (GetAsyncKeyState(VK_SHIFT) < 0);
- modifier |= ((GetAsyncKeyState(VK_CONTROL) < 0)<<2);
- handlekey(wParam, modifier);
+ handlekey(wParam);
handlemouse(oldx, oldy, 0, 0); /* update cursor */
}
return 0;