annotate gui/ui/video.c @ 35532:4eedc654175d

Fix a wrong condition.
author upsuper
date Sun, 09 Dec 2012 02:22:08 +0000
parents 8ad4d2fb46e8
children 75c26c61fd3c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
1 /*
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
2 * This file is part of MPlayer.
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
3 *
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
7 * (at your option) any later version.
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
8 *
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
12 * GNU General Public License for more details.
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
13 *
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
17 */
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
18
34699
ed0e00db4306 Cosmetic: Move, change and add some comments on GUI windows.
ib
parents: 34697
diff changeset
19 /* video window */
ed0e00db4306 Cosmetic: Move, change and add some comments on GUI windows.
ib
parents: 34697
diff changeset
20
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
21 #include <string.h>
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
22
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
23 #include "libvo/x11_common.h"
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
24 #include "help_mp.h"
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
25 #include "mp_core.h"
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
26
35528
ab07b17fddfb Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
27 #include "ui.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
28 #include "gui/app/app.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
29 #include "gui/app/gui.h"
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
30 #include "gui/interface.h"
35529
8ad4d2fb46e8 Rebuild GUI directory structure.
ib
parents: 35528
diff changeset
31 #include "gui/dialog/dialog.h"
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
32
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
33 int uiVideoRender = False;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
34 int videoVisible = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
35
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
36 void uiVideoDraw( void )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
37 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
38 if ( guiApp.videoWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
39
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
40 if ( guiApp.videoWindow.State == wsWindowFocusIn ) videoVisible++;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
41 if ( guiApp.videoWindow.State == wsWindowFocusOut && metacity_hack != 3 ) videoVisible--;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
42
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
43 if ( !guiApp.videoWindow.Mapped ||
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
44 guiApp.videoWindow.Visible == wsWindowNotVisible ) return;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
45
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
46 if ( guiInfo.Playing ) uiVideoRender=False;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
47
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
48 if ( uiVideoRender && guiApp.videoWindow.State == wsWindowExpose )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
49 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
50 if ( guiApp.video.Bitmap.Image ) wsPutImage( &guiApp.videoWindow );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
51 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
52 guiApp.videoWindow.State=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
53 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
54
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
55 void uiVideoMouseHandle( int Button,int X,int Y,int RX,int RY )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
56 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
57 static int mplVideoMoved = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
58 static int msButton = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
59
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
60 uiPlaybarShow( Y );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
61
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
62 switch( Button )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
63 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
64 case wsRRMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
65 gtkShow( ivShowPopUpMenu,NULL );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
66 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
67 case wsPMMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
68 gtkShow( ivHidePopUpMenu,NULL );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
69 uiShowMenu( RX,RY );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
70 msButton=wsPMMouseButton;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
71 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
72 case wsRMMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
73 uiHideMenu( RX,RY,1 );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
74 msButton=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
75 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
76 /* --- */
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
77 case wsPLMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
78 gtkShow( ivHidePopUpMenu,NULL );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
79 sx=X; sy=Y;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
80 msButton=wsPLMouseButton;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
81 mplVideoMoved=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
82 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
83 case wsMoveMouse:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
84 switch ( msButton )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
85 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
86 case wsPLMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
87 mplVideoMoved=1;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
88 if ( !guiApp.videoWindow.isFullScreen )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
89 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
90 wsMoveWindow( &guiApp.videoWindow,True,RX - sx,RY - sy );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
91 guiApp.video.x = guiApp.videoWindow.X;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
92 guiApp.video.y = guiApp.videoWindow.Y;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
93 // NOTE TO MYSELF: dragging the title bar goes unnoticed?
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
94 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
95 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
96 case wsPMMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
97 uiMenuMouseHandle( RX,RY );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
98 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
99 default: uiPlaybarShow( Y ); break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
100 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
101 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
102 case wsRLMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
103 if ( ( !mplVideoMoved )&&( guiApp.videoWindow.isFullScreen ) )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
104 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
105 if( videoVisible++%2 ) wsRaiseWindowTop( wsDisplay,guiApp.mainWindow.WindowID );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
106 else wsRaiseWindowTop( wsDisplay,guiApp.videoWindow.WindowID );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
107 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
108 msButton=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
109 mplVideoMoved=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
110 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
111 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
112 }