Remove trailing whitespace from most files
[mplayer/glamo.git] / gui / mplayer / sw.c
blob349847b5b89418e23b1ae7245879ff7083c52732
1 /*
2 * sub window
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <inttypes.h>
22 #include <string.h>
24 #include "config.h"
25 #include "libvo/x11_common.h"
26 #include "help_mp.h"
28 #include "gmplayer.h"
29 #include "gui/app.h"
30 #include "gui/interface.h"
31 #include "widgets.h"
33 int mplSubRender = 0;
34 int SubVisible = 0;
36 extern int boxMoved;
37 extern int sx,sy;
38 extern int i,pot;
40 void mplSubDraw( void )
42 if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
44 if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++;
45 if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--;
47 if ( !appMPlayer.subWindow.Mapped ||
48 appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
50 if ( guiIntfStruct.Playing ) mplSubRender=0;
52 if ( mplSubRender && appMPlayer.subWindow.State == wsWindowExpose )
54 if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
56 appMPlayer.subWindow.State=0;
59 void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
61 static int mplSubMoved = 0;
62 static int msButton = 0;
64 mplPBShow( X,Y );
66 switch( Button )
68 case wsRRMouseButton:
69 gtkShow( evShowPopUpMenu,NULL );
70 break;
71 case wsPMMouseButton:
72 gtkShow( evHidePopUpMenu,NULL );
73 mplShowMenu( RX,RY );
74 msButton=wsPMMouseButton;
75 break;
76 case wsRMMouseButton:
77 mplHideMenu( RX,RY,1 );
78 msButton=0;
79 break;
80 // ---
81 case wsPLMouseButton:
82 gtkShow( evHidePopUpMenu,NULL );
83 sx=X; sy=Y;
84 msButton=wsPLMouseButton;
85 mplSubMoved=0;
86 break;
87 case wsMoveMouse:
88 switch ( msButton )
90 case wsPLMouseButton:
91 mplSubMoved=1;
92 if ( !appMPlayer.subWindow.isFullScreen ) wsMoveWindow( &appMPlayer.subWindow,False,RX - sx,RY - sy );
93 break;
94 case wsPMMouseButton:
95 mplMenuMouseHandle( X,Y,RX,RY );
96 break;
97 default: mplPBShow( X,Y ); break;
99 break;
100 case wsRLMouseButton:
101 if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) )
103 if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
104 else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
106 msButton=0;
107 mplSubMoved=0;
108 break;