[MPlayer-cvslog] r35874 - in trunk/gui: interface.c ui/actions.c ui/main.c ui/menu.c ui/playbar.c ui/ui.h ui/video.c
ib
subversion at mplayerhq.hu
Fri Jan 25 13:26:31 CET 2013
Author: ib
Date: Fri Jan 25 13:26:31 2013
New Revision: 35874
Log:
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.
Modified:
trunk/gui/interface.c
trunk/gui/ui/actions.c
trunk/gui/ui/main.c
trunk/gui/ui/menu.c
trunk/gui/ui/playbar.c
trunk/gui/ui/ui.h
trunk/gui/ui/video.c
Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/interface.c Fri Jan 25 13:26:31 2013 (r35874)
@@ -180,9 +180,6 @@ void guiInit(void)
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 @@ void guiInit(void)
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);
Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/ui/actions.c Fri Jan 25 13:26:31 2013 (r35874)
@@ -682,10 +682,7 @@ void uiChangeSkin(char *name)
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);
Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/ui/main.c Fri Jan 25 13:26:31 2013 (r35874)
@@ -64,7 +64,7 @@ int i,pot = 0;
#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 @@ void uiMainDraw( void )
// 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 @@ potihandled:
}
}
-void uiMainKey( int KeyCode,int Type,int Key )
+static void uiMainKey( int KeyCode,int Type,int Key )
{
int msg = evNone;
@@ -256,7 +256,7 @@ void uiMainKey( int KeyCode,int Type,int
}
/* 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 @@ void uiMainDND(int num,char** files)
mplayerLoadSubtitle(guiInfo.SubtitleFilename);
}
}
+
+void uiMainInit (void)
+{
+ guiApp.mainWindow.DrawHandler = uiMainDraw;
+ guiApp.mainWindow.MouseHandler = uiMainMouse;
+ guiApp.mainWindow.KeyHandler = uiMainKey;
+ guiApp.mainWindow.DNDHandler = uiMainDND;
+}
Modified: trunk/gui/ui/menu.c
==============================================================================
--- trunk/gui/ui/menu.c Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/ui/menu.c Fri Jan 25 13:26:31 2013 (r35874)
@@ -121,7 +121,7 @@ void uiMenuInit( void )
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 );
}
Modified: trunk/gui/ui/playbar.c
==============================================================================
--- trunk/gui/ui/playbar.c Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/ui/playbar.c Fri Jan 25 13:26:31 2013 (r35874)
@@ -252,7 +252,7 @@ void uiPlaybarInit( void )
guiApp.playbarWindow.DrawHandler=uiPlaybarDraw;
guiApp.playbarWindow.MouseHandler=uiPlaybarMouse;
- guiApp.playbarWindow.KeyHandler=uiMainKey;
+ guiApp.playbarWindow.KeyHandler=guiApp.mainWindow.KeyHandler;
playbarLength=guiApp.videoWindow.Height;
}
Modified: trunk/gui/ui/ui.h
==============================================================================
--- trunk/gui/ui/ui.h Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/ui/ui.h Fri Jan 25 13:26:31 2013 (r35874)
@@ -28,13 +28,9 @@ extern int uiPlaybarFade;
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 );
Modified: trunk/gui/ui/video.c
==============================================================================
--- trunk/gui/ui/video.c Fri Jan 25 12:57:24 2013 (r35873)
+++ trunk/gui/ui/video.c Fri Jan 25 13:26:31 2013 (r35874)
@@ -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 uiVideoDraw( void )
}
}
-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 @@ void uiVideoMouse( int Button,int X,int
break;
}
}
+
+void uiVideoInit (void)
+{
+ guiApp.videoWindow.DrawHandler = uiVideoDraw;
+ guiApp.videoWindow.MouseHandler = uiVideoMouse;
+ guiApp.videoWindow.KeyHandler = guiApp.mainWindow.KeyHandler;
+ guiApp.videoWindow.DNDHandler = guiApp.mainWindow.DNDHandler;
+}
More information about the MPlayer-cvslog
mailing list