Recognize mouse wheel events on x11. Fix #476

This commit is contained in:
Roman Chistokhodov 2017-10-07 23:00:27 +03:00
parent 4c6cc85481
commit 27b875a4a7
1 changed files with 5 additions and 1 deletions

View File

@ -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");
}