changeset 35788:e3dcd5854344

Move video window initialization code to uiVideoInit().
author ib
date Fri, 25 Jan 2013 15:12:25 +0000
parents c9d3bf288d36
children 9fdc3e22063f
files gui/interface.c gui/ui/video.c
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Fri Jan 25 14:53:12 2013 +0000
+++ b/gui/interface.c	Fri Jan 25 15:12:25 2013 +0000
@@ -173,13 +173,6 @@
     if (guiWinID >= 0)
         guiApp.mainWindow.Parent = guiWinID;
 
-    wsWindowCreate(&guiApp.videoWindow, guiApp.video.x, guiApp.video.y, guiApp.video.width, guiApp.video.height, wsShowFrame | wsHideWindow | wsWaitMap | wsAspect, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer - Video");
-    wsImageDestroy(&guiApp.videoWindow);
-    wsImageCreate(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
-    wsXDNDMakeAwareness(&guiApp.videoWindow);
-
-    WinID = guiApp.videoWindow.WindowID;
-
 // i=wsHideFrame|wsMaxSize|wsHideWindow;
 // if ( guiApp.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
     i = (guiApp.mainDecoration ? wsShowFrame : 0) | wsMinSize | wsMaxSize | wsHideWindow;
@@ -188,22 +181,19 @@
     wsXDNDMakeAwareness(&guiApp.mainWindow);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] mainWindow ID: 0x%x\n", (int)guiApp.mainWindow.WindowID);
-    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] videoWindow ID: 0x%x\n", (int)guiApp.videoWindow.WindowID);
 
     uiMainInit();      // main window must be first!
     uiVideoInit();     // video window must be second!
     uiPlaybarInit();
     uiMenuInit();
 
-    if (guiApp.video.Bitmap.Image)
-        wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image);
+    WinID = guiApp.videoWindow.WindowID;
 
     btnModify(evSetVolume, guiInfo.Volume);
     btnModify(evSetBalance, guiInfo.Balance);
     btnModify(evSetMoviePosition, guiInfo.Position);
 
     wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
-    wsWindowIcon(wsDisplay, guiApp.videoWindow.WindowID, &guiIcon);
 
     wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
 
--- a/gui/ui/video.c	Fri Jan 25 14:53:12 2013 +0000
+++ b/gui/ui/video.c	Fri Jan 25 15:12:25 2013 +0000
@@ -22,6 +22,7 @@
 
 #include "libvo/x11_common.h"
 #include "help_mp.h"
+#include "mp_msg.h"
 #include "mp_core.h"
 
 #include "ui.h"
@@ -29,6 +30,8 @@
 #include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/dialog/dialog.h"
+#include "gui/wm/ws.h"
+#include "gui/wm/wsxdnd.h"
 
 int             videoVisible = 0;
 
@@ -109,6 +112,15 @@
 
 void uiVideoInit (void)
 {
+  wsWindowCreate(&guiApp.videoWindow, guiApp.video.x, guiApp.video.y, guiApp.video.width, guiApp.video.height, wsShowFrame | wsHideWindow | wsWaitMap | wsAspect, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer - Video");
+  mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[video] videoWindow ID: 0x%x\n", (int) guiApp.videoWindow.WindowID);
+  wsWindowIcon(wsDisplay, guiApp.videoWindow.WindowID, &guiIcon);
+  if (guiApp.video.Bitmap.Image)
+  {
+    wsImageResize(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
+    wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image);
+  }
+  wsXDNDMakeAwareness(&guiApp.videoWindow);
   guiApp.videoWindow.DrawHandler = uiVideoDraw;
   guiApp.videoWindow.MouseHandler = uiVideoMouse;
   guiApp.videoWindow.KeyHandler = guiApp.mainWindow.KeyHandler;