From 9c063468d6b806de954d867ced857395c6162b82 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 24 Apr 2021 19:47:10 -0400
Subject: [PATCH] x11: call XSync before XSetInputFocus during SDL_ShowWindow.
This only happens when using a non-NET_WM window manager, as we might try to
set the focus before the window is mapped.
Fixes #3949.
---
src/video/x11/SDL_x11window.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 41d0de567..94085f492 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -1158,6 +1158,7 @@ X11_ShowWindow(_THIS, SDL_Window * window)
if (!data->videodata->net_wm) {
/* no WM means no FocusIn event, which confuses us. Force it. */
+ X11_XSync(display, False);
X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
X11_XFlush(display);
}