diff gui/wm/ws.c @ 35652:f6c00eacd816

Add wsMapWait(). This waits for a map notify event which is required in order to paint into the window. Remove the waiting loop in interface.c and set a corresponding property for the video window which, now, will regard vo_keepaspect. This also closes Bugzilla #1357.
author ib
date Tue, 15 Jan 2013 11:54:22 +0000
parents ebaac70ff6dc
children 59a6b817a287
line wrap: on
line diff
--- a/gui/wm/ws.c	Tue Jan 15 09:41:34 2013 +0000
+++ b/gui/wm/ws.c	Tue Jan 15 11:54:22 2013 +0000
@@ -490,6 +490,21 @@
     XSetWMNormalHints(wsDisplay, win->WindowID, &win->SizeHint);
 }
 
+/**
+ * @brief Wait until a window is mapped if its property requires it.
+ *
+ * @param win pointer to a ws window structure
+ */
+static void wsMapWait(wsTWindow *win)
+{
+    XEvent xev;
+
+    if (win->Property & wsWaitMap)
+        do
+            XNextEvent(wsDisplay, &xev);
+        while (xev.type != MapNotify || xev.xmap.event != win->WindowID);
+}
+
 // ----------------------------------------------------------------------------------------------
 //   Create window.
 //     X,Y   : window position
@@ -627,8 +642,10 @@
     win->Mapped  = wsNo;
     win->Rolled  = wsNo;
 
-    if (D & wsShowWindow)
+    if (D & wsShowWindow) {
         XMapWindow(wsDisplay, win->WindowID);
+        wsMapWait(win);
+    }
 
     wsCreateImage(win, win->Width, win->Height);
 /* End of creating -------------------------------------------------------------------------- */
@@ -1425,6 +1442,7 @@
     case wsShowWindow:
 
         XMapRaised(wsDisplay, win->WindowID);
+        wsMapWait(win);
 
         if (vo_fs_type & vo_wm_FULLSCREEN)
             win->isFullScreen = False;