Skip to content

Commit 0ac1241

Browse files
committed
x11: Always update the borders on frame extent events
Always update the border sizes on frame extent events, or they can incorrectly still be zero if followed by a PropertyNotify event when leaving fullscreen. Fixes sending the correct restored window size when leaving fullscreen in fvwm.
1 parent f40bf44 commit 0ac1241

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/video/x11/SDL_x11events.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,9 +1513,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
15131513
&ChildReturn);
15141514
}
15151515

1516-
/* Xfce sends ConfigureNotify before PropertyNotify when toggling fullscreen and maximized, which
1517-
* is backwards from every other window manager, as well as what is expected by SDL and its clients.
1518-
* Defer emitting the size/move events until the corresponding PropertyNotify arrives.
1516+
/* Some window managers send ConfigureNotify before PropertyNotify when changing state (Xfce and
1517+
* fvwm are known to do this), which is backwards from other window managers, as well as what is
1518+
* expected by SDL and its clients. Defer emitting the size/move events until the corresponding
1519+
* PropertyNotify arrives for consistency.
15191520
*/
15201521
const Uint32 changed = X11_GetNetWMState(_this, data->window, xevent->xproperty.window) ^ data->window->flags;
15211522
if (changed & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) {
@@ -1950,13 +1951,12 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
19501951
right approach, but it seems to work. */
19511952
X11_UpdateKeymap(_this, true);
19521953
} else if (xevent->xproperty.atom == videodata->atoms._NET_FRAME_EXTENTS) {
1953-
/* Events are disabled when leaving fullscreen until the borders appear to avoid
1954-
* incorrect size/position events.
1955-
*/
1954+
X11_GetBorderValues(data);
19561955
if (data->size_move_event_flags) {
1956+
/* Events are disabled when leaving fullscreen until the borders appear to avoid
1957+
* incorrect size/position events on compositing window managers.
1958+
*/
19571959
data->size_move_event_flags &= ~X11_SIZE_MOVE_EVENTS_WAIT_FOR_BORDERS;
1958-
X11_GetBorderValues(data);
1959-
19601960
}
19611961
if (!(data->window->flags & SDL_WINDOW_FULLSCREEN) && data->toggle_borders) {
19621962
data->toggle_borders = false;

0 commit comments

Comments
 (0)