|
|
@@ -1130,7 +1130,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_MouseID mouseID, int button, float x, float y, unsigned long time)
|
|
|
+void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_MouseID mouseID, int button, float x, float y, unsigned long time, unsigned long serial)
|
|
|
{
|
|
|
SDL_Window *window = windowdata->window;
|
|
|
int xticks = 0, yticks = 0;
|
|
|
@@ -1149,7 +1149,6 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S
|
|
|
if (X11_IsWheelEvent(button, &xticks, &yticks)) {
|
|
|
SDL_SendMouseWheel(timestamp, window, mouseID, (float)-xticks, (float)yticks, SDL_MOUSEWHEEL_NORMAL);
|
|
|
} else {
|
|
|
- bool ignore_click = false;
|
|
|
if (button > 7) {
|
|
|
/* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ...
|
|
|
=> subtract (8-SDL_BUTTON_X1) to get value SDL expects */
|
|
|
@@ -1164,11 +1163,14 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S
|
|
|
if (windowdata->last_focus_event_time) {
|
|
|
const int X11_FOCUS_CLICK_TIMEOUT = 10;
|
|
|
if (SDL_GetTicks() < (windowdata->last_focus_event_time + X11_FOCUS_CLICK_TIMEOUT)) {
|
|
|
- ignore_click = !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, false);
|
|
|
+ if (!SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, false)) {
|
|
|
+ // Ignore all press events with this serial.
|
|
|
+ windowdata->ignore_button_press_serial = serial;
|
|
|
+ }
|
|
|
}
|
|
|
windowdata->last_focus_event_time = 0;
|
|
|
}
|
|
|
- if (!ignore_click) {
|
|
|
+ if (serial != windowdata->ignore_button_press_serial) {
|
|
|
SDL_SendMouseButton(timestamp, window, mouseID, button, true);
|
|
|
}
|
|
|
}
|
|
|
@@ -1872,7 +1874,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
|
|
}
|
|
|
|
|
|
X11_HandleButtonPress(_this, data, SDL_GLOBAL_MOUSE_ID, xevent->xbutton.button,
|
|
|
- xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.time);
|
|
|
+ xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.time, xevent->xbutton.serial);
|
|
|
} break;
|
|
|
|
|
|
case ButtonRelease:
|