[MPlayer-cvslog] r35883 - in trunk/gui: interface.c ui/actions.c ui/main.c

ib subversion at mplayerhq.hu
Fri Jan 25 16:39:18 CET 2013


Author: ib
Date: Fri Jan 25 16:39:18 2013
New Revision: 35883

Log:
Move main window initialization code to uiMainInit().

The code existed twice and could be removed from both
interface.c and actions.c.

Modified:
   trunk/gui/interface.c
   trunk/gui/ui/actions.c
   trunk/gui/ui/main.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Fri Jan 25 16:12:25 2013	(r35882)
+++ trunk/gui/interface.c	Fri Jan 25 16:39:18 2013	(r35883)
@@ -146,13 +146,6 @@ void guiInit(void)
 
     /* initialize windows */
 
-    mainDrawBuffer = malloc(guiApp.main.Bitmap.ImageSize);
-
-    if (!mainDrawBuffer) {
-        gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
-        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
-    }
-
     if (gui_save_pos) {
         if (gui_main_pos_x != -3)
             guiApp.main.x = gui_main_pos_x;
@@ -173,15 +166,6 @@ void guiInit(void)
     if (guiWinID >= 0)
         guiApp.mainWindow.Parent = guiWinID;
 
-// i=wsHideFrame|wsMaxSize|wsHideWindow;
-// if ( guiApp.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
-    i = (guiApp.mainDecoration ? wsShowFrame : 0) | wsMinSize | wsMaxSize | wsHideWindow;
-    wsWindowCreate(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, i, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer");
-    wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image);
-    wsXDNDMakeAwareness(&guiApp.mainWindow);
-
-    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] mainWindow ID: 0x%x\n", (int)guiApp.mainWindow.WindowID);
-
     uiMainInit();      // main window must be first!
     uiVideoInit();     // video window must be second!
     uiPlaybarInit();
@@ -193,8 +177,6 @@ void guiInit(void)
     btnModify(evSetBalance, guiInfo.Balance);
     btnModify(evSetMoviePosition, guiInfo.Position);
 
-    wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
-
     wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
 
     if (gtkShowVideoWindow) {

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Fri Jan 25 16:12:25 2013	(r35882)
+++ trunk/gui/ui/actions.c	Fri Jan 25 16:39:18 2013	(r35883)
@@ -668,24 +668,10 @@ void uiChangeSkin(char *name)
     /* reload main window */
 
     free(mainDrawBuffer);
-    mainDrawBuffer = calloc(1, guiApp.main.Bitmap.ImageSize);
-
-    if (!mainDrawBuffer) {
-        gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
-        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
-    }
-
     wsWindowDestroy(&guiApp.mainWindow);
 
-    wsWindowCreate(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, (guiApp.mainDecoration ? wsShowFrame : 0) | wsMinSize | wsMaxSize | wsHideWindow, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer");
-    wsImageCreate(&guiApp.mainWindow, guiApp.main.Bitmap.Width, guiApp.main.Bitmap.Height);
-    wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image);
-    wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
-
     uiMainInit();
 
-    wsXDNDMakeAwareness(&guiApp.mainWindow);
-
     wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
     mainVisible = True;
 

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Fri Jan 25 16:12:25 2013	(r35882)
+++ trunk/gui/ui/main.c	Fri Jan 25 16:39:18 2013	(r35883)
@@ -34,6 +34,7 @@
 #include "gui/util/mem.h"
 #include "gui/util/string.h"
 #include "gui/wm/ws.h"
+#include "gui/wm/wsxdnd.h"
 
 #include "help_mp.h"
 #include "mp_msg.h"
@@ -339,6 +340,20 @@ static void uiMainDND(int num,char** fil
 
 void uiMainInit (void)
 {
+  mainDrawBuffer = malloc(guiApp.main.Bitmap.ImageSize);
+
+  if (!mainDrawBuffer)
+  {
+    gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
+    mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+  }
+
+  wsWindowCreate(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, (guiApp.mainDecoration ? wsShowFrame : 0 ) | wsMinSize | wsMaxSize | wsHideWindow, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer");
+  mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[main] mainWindow ID: 0x%x\n", (int) guiApp.mainWindow.WindowID);
+  wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image);
+  wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
+  wsXDNDMakeAwareness(&guiApp.mainWindow);
+
   guiApp.mainWindow.DrawHandler = uiMainDraw;
   guiApp.mainWindow.MouseHandler = uiMainMouse;
   guiApp.mainWindow.KeyHandler = uiMainKey;


More information about the MPlayer-cvslog mailing list