From d7704b13c09b7a3913ff3a82c01ec16bde9aa2de Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 15 May 2022 20:41:06 +1000 Subject: [PATCH] [client] x11: set window posision before entering fullscreen This fixes an issue where the window position would be ignored if the application was launched in full screen mode from the command line causing the client to enter full screen on the wrong monitor in multi-monitor configurations. --- client/displayservers/X11/x11.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/client/displayservers/X11/x11.c b/client/displayservers/X11/x11.c index 9a792a52..68776526 100644 --- a/client/displayservers/X11/x11.c +++ b/client/displayservers/X11/x11.c @@ -398,23 +398,14 @@ static bool x11Init(const LG_DSInitParams params) ); } - Atom wmState[3] = {0}; - int wmStateCount = 0; - - if (params.fullscreen) - { - x11.fullscreen = true; - wmState[wmStateCount++] = x11atoms._NET_WM_STATE_FULLSCREEN; - } - if (params.maximize) { - wmState[wmStateCount++] = x11atoms._NET_WM_STATE_MAXIMIZED_HORZ; - wmState[wmStateCount++] = x11atoms._NET_WM_STATE_MAXIMIZED_VERT; - } + Atom wmState[2] = + { + x11atoms._NET_WM_STATE_MAXIMIZED_HORZ, + x11atoms._NET_WM_STATE_MAXIMIZED_VERT + }; - if (wmStateCount) - { XChangeProperty( x11.display, x11.window, @@ -423,7 +414,7 @@ static bool x11Init(const LG_DSInitParams params) 32, PropModeReplace, (unsigned char *)&wmState, - wmStateCount + 2 ); } @@ -664,6 +655,9 @@ static bool x11Init(const LG_DSInitParams params) if (!params.center) XMoveWindow(x11.display, x11.window, params.x, params.y); + if (params.fullscreen) + x11SetFullscreen(true); + XSetLocaleModifiers(""); // Load XMODIFIERS x11.xim = XOpenIM(x11.display, 0, 0, 0);