# HG changeset patch # User ib # Date 1359116791 0 # Node ID 4073fff5efc79691b86181f8cf4bb609d27a79be # Parent 8ad72f9cf69700d70d7417a991008f2ccb1ea2de Add new functions uiMainInit() and uiVideoInit(). Relocate handler initialization stuff there and reorder the windows init calls. As a result, all handler functions can be static now. diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/interface.c --- a/gui/interface.c Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/interface.c Fri Jan 25 12:26:31 2013 +0000 @@ -180,9 +180,6 @@ WinID = guiApp.videoWindow.WindowID; - uiMenuInit(); - uiPlaybarInit(); - // i=wsHideFrame|wsMaxSize|wsHideWindow; // if ( guiApp.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; i = (guiApp.mainDecoration ? wsShowFrame : 0) | wsMinSize | wsMaxSize | wsHideWindow; @@ -193,15 +190,10 @@ 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); - guiApp.mainWindow.DrawHandler = uiMainDraw; - guiApp.mainWindow.MouseHandler = uiMainMouse; - guiApp.mainWindow.KeyHandler = uiMainKey; - guiApp.mainWindow.DNDHandler = uiMainDND; - - guiApp.videoWindow.DrawHandler = uiVideoDraw; - guiApp.videoWindow.MouseHandler = uiVideoMouse; - guiApp.videoWindow.KeyHandler = uiMainKey; - guiApp.videoWindow.DNDHandler = uiMainDND; + uiMainInit(); // main window must be first! + uiVideoInit(); + uiPlaybarInit(); + uiMenuInit(); if (guiApp.video.Bitmap.Image) wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image); diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/ui/actions.c --- a/gui/ui/actions.c Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/ui/actions.c Fri Jan 25 12:26:31 2013 +0000 @@ -682,10 +682,7 @@ wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image); wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon); - guiApp.mainWindow.DrawHandler = uiMainDraw; - guiApp.mainWindow.MouseHandler = uiMainMouse; - guiApp.mainWindow.KeyHandler = uiMainKey; - guiApp.mainWindow.DNDHandler = uiMainDND; + uiMainInit(); wsXDNDMakeAwareness(&guiApp.mainWindow); diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/ui/main.c --- a/gui/ui/main.c Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/ui/main.c Fri Jan 25 12:26:31 2013 +0000 @@ -64,7 +64,7 @@ #include "render.h" -void uiMainDraw( void ) +static void uiMainDraw( void ) { if ( guiApp.mainWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); @@ -87,7 +87,7 @@ // XFlush( wsDisplay ); } -void uiMainMouse( int Button,int X,int Y,int RX,int RY ) +static void uiMainMouse( int Button,int X,int Y,int RX,int RY ) { static int itemtype = 0; int i; @@ -209,7 +209,7 @@ } } -void uiMainKey( int KeyCode,int Type,int Key ) +static void uiMainKey( int KeyCode,int Type,int Key ) { int msg = evNone; @@ -256,7 +256,7 @@ } /* this will be used to handle drag & drop files */ -void uiMainDND(int num,char** files) +static void uiMainDND(int num,char** files) { struct stat buf; int f = 0; @@ -336,3 +336,11 @@ mplayerLoadSubtitle(guiInfo.SubtitleFilename); } } + +void uiMainInit (void) +{ + guiApp.mainWindow.DrawHandler = uiMainDraw; + guiApp.mainWindow.MouseHandler = uiMainMouse; + guiApp.mainWindow.KeyHandler = uiMainKey; + guiApp.mainWindow.DNDHandler = uiMainDND; +} diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/ui/menu.c --- a/gui/ui/menu.c Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/ui/menu.c Fri Jan 25 12:26:31 2013 +0000 @@ -121,7 +121,7 @@ menuIsInitialized=True; guiApp.menuWindow.DrawHandler=uiMenuDraw; guiApp.menuWindow.MouseHandler=uiMenuMouse; -// guiApp.menuWindow.KeyHandler=uiMainKey; +// guiApp.menuWindow.KeyHandler=guiApp.mainWindow.KeyHandler; uiMenuRender=True; wsWindowRedraw( &guiApp.menuWindow ); } diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/ui/playbar.c --- a/gui/ui/playbar.c Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/ui/playbar.c Fri Jan 25 12:26:31 2013 +0000 @@ -252,7 +252,7 @@ guiApp.playbarWindow.DrawHandler=uiPlaybarDraw; guiApp.playbarWindow.MouseHandler=uiPlaybarMouse; - guiApp.playbarWindow.KeyHandler=uiMainKey; + guiApp.playbarWindow.KeyHandler=guiApp.mainWindow.KeyHandler; playbarLength=guiApp.videoWindow.Height; } diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/ui/ui.h --- a/gui/ui/ui.h Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/ui/ui.h Fri Jan 25 12:26:31 2013 +0000 @@ -28,13 +28,9 @@ extern int sx, sy; -void uiMainDraw( void ); -void uiMainMouse( int Button, int X, int Y, int RX, int RY ); -void uiMainKey( int KeyCode, int Type, int Key ); -void uiMainDND(int num, char** files); +void uiMainInit( void ); -void uiVideoDraw( void ); -void uiVideoMouse( int Button, int X, int Y, int RX, int RY ); +void uiVideoInit( void ); void uiMenuInit( void ); void uiMenuHide( int mx, int my, int w ); diff -r 8ad72f9cf697 -r 4073fff5efc7 gui/ui/video.c --- a/gui/ui/video.c Fri Jan 25 11:57:24 2013 +0000 +++ b/gui/ui/video.c Fri Jan 25 12:26:31 2013 +0000 @@ -32,7 +32,7 @@ int videoVisible = 0; -void uiVideoDraw( void ) +static void uiVideoDraw( void ) { if ( guiApp.videoWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); @@ -50,7 +50,7 @@ } } -void uiVideoMouse( int Button,int X,int Y,int RX,int RY ) +static void uiVideoMouse( int Button,int X,int Y,int RX,int RY ) { static int mplVideoMoved = 0; static int msButton = 0; @@ -106,3 +106,11 @@ break; } } + +void uiVideoInit (void) +{ + guiApp.videoWindow.DrawHandler = uiVideoDraw; + guiApp.videoWindow.MouseHandler = uiVideoMouse; + guiApp.videoWindow.KeyHandler = guiApp.mainWindow.KeyHandler; + guiApp.videoWindow.DNDHandler = guiApp.mainWindow.DNDHandler; +}