[MPlayer-cvslog] r35746 - in trunk/gui: interface.c wm/ws.c wm/ws.h

ib subversion at mplayerhq.hu
Tue Jan 15 12:54:22 CET 2013


Author: ib
Date: Tue Jan 15 12:54:22 2013
New Revision: 35746

Log:
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.

Modified:
   trunk/gui/interface.c
   trunk/gui/wm/ws.c
   trunk/gui/wm/ws.h

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Tue Jan 15 10:41:34 2013	(r35745)
+++ trunk/gui/interface.c	Tue Jan 15 12:54:22 2013	(r35746)
@@ -172,7 +172,7 @@ void guiInit(void)
     if (guiWinID >= 0)
         guiApp.mainWindow.Parent = guiWinID;
 
-    wsCreateWindow(&guiApp.videoWindow, guiApp.video.x, guiApp.video.y, guiApp.video.width, guiApp.video.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsHideWindow, "MPlayer - Video");
+    wsCreateWindow(&guiApp.videoWindow, guiApp.video.x, guiApp.video.y, guiApp.video.width, guiApp.video.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsHideWindow | wsWaitMap, "MPlayer - Video");
     wsDestroyImage(&guiApp.videoWindow);
     wsCreateImage(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
     wsXDNDMakeAwareness(&guiApp.videoWindow);
@@ -224,16 +224,8 @@ void guiInit(void)
     if (gtkShowVideoWindow) {
         wsVisibleWindow(&guiApp.videoWindow, wsShowWindow);
 
-        {
-            XEvent xev;
-
-            do
-                XNextEvent(wsDisplay, &xev);
-            while (xev.type != MapNotify || xev.xmap.event != guiApp.videoWindow.WindowID);
-
             guiApp.videoWindow.Mapped = wsMapped;
             guiInfo.VideoWindow       = True;
-        }
 
         if (gtkLoadFullscreen)
             uiFullScreen();

Modified: trunk/gui/wm/ws.c
==============================================================================
--- trunk/gui/wm/ws.c	Tue Jan 15 10:41:34 2013	(r35745)
+++ trunk/gui/wm/ws.c	Tue Jan 15 12:54:22 2013	(r35746)
@@ -490,6 +490,21 @@ static void wsSizeHint(wsTWindow *win)
     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 @@ void wsCreateWindow(wsTWindow *win, int 
     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 @@ void wsVisibleWindow(wsTWindow *win, int
     case wsShowWindow:
 
         XMapRaised(wsDisplay, win->WindowID);
+        wsMapWait(win);
 
         if (vo_fs_type & vo_wm_FULLSCREEN)
             win->isFullScreen = False;

Modified: trunk/gui/wm/ws.h
==============================================================================
--- trunk/gui/wm/ws.h	Tue Jan 15 10:41:34 2013	(r35745)
+++ trunk/gui/wm/ws.h	Tue Jan 15 12:54:22 2013	(r35746)
@@ -71,6 +71,7 @@
 #define  wsShowWindow   8
 #define  wsHideWindow   16
 #define  wsOverredirect 32
+#define  wsWaitMap      64
 
 #define  wsNoBorder 0
 


More information about the MPlayer-cvslog mailing list