From 65a3701be379c6b7c08bc8956f94741eb6c73b17 Mon Sep 17 00:00:00 2001 From: Greg Kennedy Date: Tue, 29 Dec 2015 16:17:24 -0600 Subject: [PATCH] Switch to Fullscreen fails unless done after MapWindow. --- unix/x11.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/unix/x11.cpp b/unix/x11.cpp index b16b6427..fe0dd9da 100644 --- a/unix/x11.cpp +++ b/unix/x11.cpp @@ -842,12 +842,6 @@ void S9xInitDisplay (int argc, char **argv) WidthOfScreen(GUI.screen), HeightOfScreen(GUI.screen), 0, GUI.depth, InputOutput, GUI.visual, CWBackPixel | CWColormap, &attrib); - /* Try to tell the Window Manager not to decorate this window. */ - Atom wm_state = XInternAtom (GUI.display, "_NET_WM_STATE", true ); - Atom wm_fullscreen = XInternAtom (GUI.display, "_NET_WM_STATE_FULLSCREEN", true ); - - XChangeProperty(GUI.display, GUI.window, wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wm_fullscreen, 1); - #ifdef USE_XVIDEO if (GUI.use_xvideo) { @@ -938,6 +932,21 @@ void S9xInitDisplay (int argc, char **argv) XMapRaised(GUI.display, GUI.window); XClearWindow(GUI.display, GUI.window); + // Wait for map + XEvent event; + do { + XNextEvent(GUI.display, &event); + } while (event.type != MapNotify || event.xmap.event != GUI.window); + + if (GUI.fullscreen) + { + /* Try to tell the Window Manager not to decorate this window. */ + Atom wm_state = XInternAtom (GUI.display, "_NET_WM_STATE", true ); + Atom wm_fullscreen = XInternAtom (GUI.display, "_NET_WM_STATE_FULLSCREEN", true ); + + XChangeProperty(GUI.display, GUI.window, wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wm_fullscreen, 1); + } + #ifdef USE_XVIDEO if (GUI.use_xvideo) {