comparison gui/ui/main.c @ 35789:9fdc3e22063f

Move main window initialization code to uiMainInit(). The code existed twice and could be removed from both interface.c and actions.c.
author ib
date Fri, 25 Jan 2013 15:39:18 +0000
parents 4073fff5efc7
children 5eac7c0879b7
comparison
equal deleted inserted replaced
35788:e3dcd5854344 35789:9fdc3e22063f
32 #include "gui/skin/skin.h" 32 #include "gui/skin/skin.h"
33 #include "gui/util/list.h" 33 #include "gui/util/list.h"
34 #include "gui/util/mem.h" 34 #include "gui/util/mem.h"
35 #include "gui/util/string.h" 35 #include "gui/util/string.h"
36 #include "gui/wm/ws.h" 36 #include "gui/wm/ws.h"
37 #include "gui/wm/wsxdnd.h"
37 38
38 #include "help_mp.h" 39 #include "help_mp.h"
39 #include "mp_msg.h" 40 #include "mp_msg.h"
40 #include "libvo/x11_common.h" 41 #include "libvo/x11_common.h"
41 #include "libvo/fastmemcpy.h" 42 #include "libvo/fastmemcpy.h"
337 } 338 }
338 } 339 }
339 340
340 void uiMainInit (void) 341 void uiMainInit (void)
341 { 342 {
343 mainDrawBuffer = malloc(guiApp.main.Bitmap.ImageSize);
344
345 if (!mainDrawBuffer)
346 {
347 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
348 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
349 }
350
351 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");
352 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[main] mainWindow ID: 0x%x\n", (int) guiApp.mainWindow.WindowID);
353 wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image);
354 wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
355 wsXDNDMakeAwareness(&guiApp.mainWindow);
356
342 guiApp.mainWindow.DrawHandler = uiMainDraw; 357 guiApp.mainWindow.DrawHandler = uiMainDraw;
343 guiApp.mainWindow.MouseHandler = uiMainMouse; 358 guiApp.mainWindow.MouseHandler = uiMainMouse;
344 guiApp.mainWindow.KeyHandler = uiMainKey; 359 guiApp.mainWindow.KeyHandler = uiMainKey;
345 guiApp.mainWindow.DNDHandler = uiMainDND; 360 guiApp.mainWindow.DNDHandler = uiMainDND;
346 } 361 }