[MPlayer-dev-eng] [PATCH] improved toggle: left click on video window

Andre Kuehne andre.kuehne at gmx.net
Mon Aug 2 22:42:41 CEST 2004


This patch improves the "left click on video window"-toggle to
hide/show the control window. In detail:

- Without this patch, the toggle only works in fullscreen mode.
  I don't see a good reason for this. If i'm used to bring up
  the control with a left click, i expect it to work anytime.

- The current hide/show status is preserved after switching to
  fullscreen mode.

- Under most circumstances, you don't have to click twice
  anymore to bring the control up.

Please test if this works as described with your wm.

best regards

-- 
     _   _
_/\_| |_( )_
Andre Kuehne
-------------- next part --------------
? 2
Index: Gui/mplayer/mw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.c,v
retrieving revision 1.111
diff -u -B -r1.111 mw.c
--- Gui/mplayer/mw.c	26 Jun 2004 13:26:11 -0000	1.111
+++ Gui/mplayer/mw.c	2 Aug 2004 18:58:45 -0000
@@ -31,7 +31,7 @@
 #include "widgets.h"
 
 extern mixer_t mixer; // mixer from mplayer.c
-
+int mainWindowOnTop = 0;
 extern unsigned int GetTimerMS( void );
 
 unsigned char * mplDrawBuffer = NULL;
@@ -50,11 +50,8 @@
 
 void mplMainDraw( void )
 {
- wItem    * item;
- txSample * image = NULL;
- int        i, type;
-
- if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
+ if ( appMPlayer.mainWindow.State == wsWindowFocusIn ) mainWindowOnTop = 1;
+ else if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
  
  if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible ||
       !mainVisible ) return;
@@ -79,7 +76,6 @@
 
 void mplEventHandling( int msg,float param )
 {
- int j;
  int iparam = (int)param;
 
  switch( msg )
Index: Gui/mplayer/play.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.c,v
retrieving revision 1.89
diff -u -B -r1.89 play.c
--- Gui/mplayer/play.c	25 Mar 2004 21:49:48 -0000	1.89
+++ Gui/mplayer/play.c	2 Aug 2004 18:58:46 -0000
@@ -31,6 +31,7 @@
 
 extern float rel_seek_secs;
 extern int abs_seek_pos;
+extern int mainWindowOnTop;
 
 int mplGotoTheNext = 1;
 
@@ -61,6 +62,9 @@
 
  if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
   else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
+
+  if( mainWindowOnTop ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
+  else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
 }
 
 extern int mplSubRender;
Index: Gui/mplayer/sw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/sw.c,v
retrieving revision 1.41
diff -u -B -r1.41 sw.c
--- Gui/mplayer/sw.c	20 Mar 2003 12:42:09 -0000	1.41
+++ Gui/mplayer/sw.c	2 Aug 2004 18:58:47 -0000
@@ -13,8 +13,8 @@
 #include "widgets.h"
 
 int             mplSubRender = 0;
-int             SubVisible = 0;
 
+extern int             mainWindowOnTop;
 extern int             boxMoved;
 extern int             sx,sy;
 extern int             i,pot;
@@ -23,9 +23,6 @@
 {
  if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
  
- if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++;
- if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--;
-
  if ( !appMPlayer.subWindow.Mapped ||
       appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
 
@@ -80,11 +77,19 @@
            }
           break;
    case wsRLMouseButton:
-          if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) )
+          if ( !mplSubMoved )
            {
-            if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
-             else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
-	   }
+            if( mainWindowOnTop )
+             {
+              mainWindowOnTop = 0;
+              wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
+             }
+            else
+             {
+              mainWindowOnTop = 1;
+              wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
+             }
+           }
           msButton=0;
           mplSubMoved=0;
           break;


More information about the MPlayer-dev-eng mailing list