From 27b875a4a7fd1c213987ded7358cbf6681710064 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 7 Oct 2017 23:00:27 +0300 Subject: [PATCH] Recognize mouse wheel events on x11. Fix #476 --- src/dlangui/platforms/x11/x11app.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dlangui/platforms/x11/x11app.d b/src/dlangui/platforms/x11/x11app.d index 874e35bf..8b0d20f4 100644 --- a/src/dlangui/platforms/x11/x11app.d +++ b/src/dlangui/platforms/x11/x11app.d @@ -1505,7 +1505,11 @@ class X11Platform : Platform { Log.d("X11: ButtonPress event"); X11Window w = findWindow(event.xbutton.window); if (w) { - w.processMouseEvent(MouseAction.ButtonDown, event.xbutton.button, event.xbutton.state, event.xbutton.x, event.xbutton.y); + if (event.xbutton.button == 4 || event.xbutton.button == 5) { + w.processMouseEvent(MouseAction.Wheel, 0, 0, 0, event.xbutton.button == 4 ? 1 : -1); + } else { + w.processMouseEvent(MouseAction.ButtonDown, event.xbutton.button, event.xbutton.state, event.xbutton.x, event.xbutton.y); + } } else { Log.e("Window not found"); }