From cac24606234e4a7eda9d1d37a75b8900a021dab6 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 31 Dec 2025 14:43:40 -0500 Subject: [PATCH] x11: Don't dedup move/size events The event core will do so automatically, and this may end up dropping events in rare cases when exiting fullscreen if an event with the final bordered window size is sent before the event notifying that the borders have come back on. --- src/video/x11/SDL_x11events.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index c5c19c3089..0860f964a1 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -1216,34 +1216,29 @@ void X11_GetBorderValues(SDL_WindowData *data) void X11_EmitConfigureNotifyEvents(SDL_WindowData *data, XConfigureEvent *xevent) { - if (xevent->x != data->last_xconfigure.x || - xevent->y != data->last_xconfigure.y) { - if (!data->size_move_event_flags) { - SDL_Window *w; - int x = xevent->x; - int y = xevent->y; + if (!data->size_move_event_flags) { + int x = xevent->x; + int y = xevent->y; + if (xevent->x != data->last_xconfigure.x || + xevent->y != data->last_xconfigure.y) { data->pending_operation &= ~X11_PENDING_OP_MOVE; - SDL_GlobalToRelativeForWindow(data->window, x, y, &x, &y); - SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y); + } + SDL_GlobalToRelativeForWindow(data->window, x, y, &x, &y); + SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y); - for (w = data->window->first_child; w; w = w->next_sibling) { - // Don't update hidden child popup windows, their relative position doesn't change - if (SDL_WINDOW_IS_POPUP(w) && !(w->flags & SDL_WINDOW_HIDDEN)) { - X11_UpdateWindowPosition(w, true); - } + for (SDL_Window *w = data->window->first_child; w; w = w->next_sibling) { + // Don't update hidden child popup windows, their relative position doesn't change + if (SDL_WINDOW_IS_POPUP(w) && !(w->flags & SDL_WINDOW_HIDDEN)) { + X11_UpdateWindowPosition(w, true); } } - } - if (xevent->width != data->last_xconfigure.width || - xevent->height != data->last_xconfigure.height) { - if (!data->size_move_event_flags) { + if (xevent->width != data->last_xconfigure.width || + xevent->height != data->last_xconfigure.height) { data->pending_operation &= ~X11_PENDING_OP_RESIZE; - SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, - xevent->width, - xevent->height); } + SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, xevent->width, xevent->height); } SDL_copyp(&data->last_xconfigure, xevent);