From 4a6f3cf47e27947f9b63421c329f4658da512537 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 10 Feb 2023 10:56:57 -0500 Subject: [PATCH] x11: Set the window position when entering fullscreen Set the window position when entering fullscreen as both real Xorg and XWayland need this in order for the window to be on the correct display. --- src/video/x11/SDL_x11window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 31651e510..2b7d0968f 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1348,6 +1348,11 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); + /* Set the position so the window will be on the target display */ + if (fullscreen) { + X11_XMoveWindow(display, data->xwindow, displaydata->x, displaydata->y); + } + /* Fullscreen windows sometimes end up being marked maximized by window managers. Force it back to how we expect it to be. */ if (!fullscreen) {