From bb0876c8422b31ab912af36ec010416ecea09712 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 14 Aug 2013 10:55:32 +0100 Subject: Enable horizontal mouse scrolling in X11. Based on a patch from Sebastian Neuser - many thanks. Use mouse buttons 6 and 7 to do the same as 4 and 5, but with Y rather than X being the default. --- platform/x11/pdfapp.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'platform') diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index fc88eeae..707c0a2a 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -1515,6 +1515,15 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta pdfapp_panview(app, app->panx + xstep, app->pany + ystep); } } + if (btn == 6 || btn == 7) /* scroll wheel (horizontal) */ + { + /* scroll left/right or up/down if shift is pressed */ + int dir = btn == 6 ? 1 : -1; + int isx = (modifiers & (1<<0)); + int xstep = !isx ? 20 * dir : 0; + int ystep = isx ? 20 * dir : 0; + pdfapp_panview(app, app->panx + xstep, app->pany + ystep); + } } else if (state == -1) -- cgit v1.2.3