# HG changeset patch # User ib # Date 1358250862 0 # Node ID f6c00eacd81681fa3bf395557c02ceb0c149afbf # Parent ebaac70ff6dc14485e2e5b72d35c1f882c40395c 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. diff -r ebaac70ff6dc -r f6c00eacd816 gui/interface.c --- a/gui/interface.c Tue Jan 15 09:41:34 2013 +0000 +++ b/gui/interface.c Tue Jan 15 11:54:22 2013 +0000 @@ -172,7 +172,7 @@ 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 @@ 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(); diff -r ebaac70ff6dc -r f6c00eacd816 gui/wm/ws.c --- 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; diff -r ebaac70ff6dc -r f6c00eacd816 gui/wm/ws.h --- a/gui/wm/ws.h Tue Jan 15 09:41:34 2013 +0000 +++ b/gui/wm/ws.h Tue Jan 15 11:54:22 2013 +0000 @@ -71,6 +71,7 @@ #define wsShowWindow 8 #define wsHideWindow 16 #define wsOverredirect 32 +#define wsWaitMap 64 #define wsNoBorder 0