Merge pull request #24482 from organicpencil/mouse_capture_fix

Fix missed captured mouse events on x11
This commit is contained in:
Rémi Verschelde 2018-12-30 16:18:08 +01:00 committed by GitHub
commit fb9085ab54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 3 deletions

View File

@ -1885,12 +1885,23 @@ void OS_X11::process_xevents() {
// Determine the axis used (called valuators in XInput for some forsaken reason) // Determine the axis used (called valuators in XInput for some forsaken reason)
// Mask is a bitmask indicating which axes are involved. // Mask is a bitmask indicating which axes are involved.
// We are interested in the values of axes 0 and 1. // 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; break;
} }
double rel_x = raw_event->raw_values[0]; const double *values = raw_event->raw_values;
double rel_y = raw_event->raw_values[1];
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 // https://bugs.freedesktop.org/show_bug.cgi?id=71609
// http://lists.libsdl.org/pipermail/commits-libsdl.org/2015-June/000282.html // http://lists.libsdl.org/pipermail/commits-libsdl.org/2015-June/000282.html