summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-12-30 16:18:08 +0100
committerGitHub <noreply@github.com>2018-12-30 16:18:08 +0100
commitfb9085ab54913c60046a7be773dbd872ff7de882 (patch)
tree00703b74aace173cfc4bdb5bb6714d01cd48b366 /platform
parentac46862097902da0f89af7f255292517a55d47bb (diff)
parentb3ff3664673602dbc38157db403517579c56eb8c (diff)
Merge pull request #24482 from organicpencil/mouse_capture_fix
Fix missed captured mouse events on x11
Diffstat (limited to 'platform')
-rw-r--r--platform/x11/os_x11.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 34ec8709c4..f15dd35d65 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1885,12 +1885,23 @@ void OS_X11::process_xevents() {
// Determine the axis used (called valuators in XInput for some forsaken reason)
// Mask is a bitmask indicating which axes are involved.
// We are interested in the values of axes 0 and 1.
- if (raw_event->valuators.mask_len <= 0 || !XIMaskIsSet(raw_event->valuators.mask, 0) || !XIMaskIsSet(raw_event->valuators.mask, 1)) {
+ if (raw_event->valuators.mask_len <= 0) {
break;
}
- double rel_x = raw_event->raw_values[0];
- double rel_y = raw_event->raw_values[1];
+ const double *values = raw_event->raw_values;
+
+ double rel_x = 0.0;
+ double rel_y = 0.0;
+
+ if (XIMaskIsSet(raw_event->valuators.mask, 0)) {
+ rel_x = *values;
+ values++;
+ }
+
+ if (XIMaskIsSet(raw_event->valuators.mask, 1)) {
+ rel_y = *values;
+ }
// https://bugs.freedesktop.org/show_bug.cgi?id=71609
// http://lists.libsdl.org/pipermail/commits-libsdl.org/2015-June/000282.html