annotate gui/mplayer/sw.c @ 29674:10982a0eac1f

Change type to avoid void * arithmetic.
author reimar
date Fri, 25 Sep 2009 09:44:41 +0000
parents 0f1b5b68af32
children f4e017b6921a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * sub window
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
19 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <inttypes.h>
23305
22d3d12c6dfb Include string.h for memcpy, fastmemcpy.h alone is not enough.
reimar
parents: 23154
diff changeset
22 #include <string.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
24 #include "config.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
25 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
26 #include "help_mp.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27
23154
e564b9cd7290 Fix several implicit declarations of functions warnings.
diego
parents: 23077
diff changeset
28 #include "gmplayer.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 23374
diff changeset
29 #include "gui/app.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 23374
diff changeset
30 #include "gui/interface.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
31 #include "widgets.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33 int mplSubRender = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34 int SubVisible = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
36 extern int boxMoved;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37 extern int sx,sy;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38 extern int i,pot;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40 void mplSubDraw( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26458
diff changeset
43
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 if ( !appMPlayer.subWindow.Mapped ||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48 appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 if ( guiIntfStruct.Playing ) mplSubRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 if ( mplSubRender && appMPlayer.subWindow.State == wsWindowExpose )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 appMPlayer.subWindow.State=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 static int mplSubMoved = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 static int msButton = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 mplPBShow( X,Y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 switch( Button )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 case wsRRMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 gtkShow( evShowPopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 case wsPMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 gtkShow( evHidePopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 mplShowMenu( RX,RY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 msButton=wsPMMouseButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 case wsRMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 mplHideMenu( RX,RY,1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 msButton=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 case wsPLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 gtkShow( evHidePopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 sx=X; sy=Y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 msButton=wsPLMouseButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 mplSubMoved=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 case wsMoveMouse:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 switch ( msButton )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 case wsPLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 mplSubMoved=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 if ( !appMPlayer.subWindow.isFullScreen ) wsMoveWindow( &appMPlayer.subWindow,False,RX - sx,RY - sy );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 case wsPMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 mplMenuMouseHandle( X,Y,RX,RY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 default: mplPBShow( X,Y ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 case wsRLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 msButton=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 mplSubMoved=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 }