annotate gui/ui/video.c @ 36840:511047e8e0a2

Remove unnecessary casts.
author ib
date Tue, 25 Feb 2014 15:16:01 +0000
parents b2edfe1a11a6
children 1236a692d0c6
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"
35788
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
25 #include "mp_msg.h"
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
26 #include "mp_core.h"
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
27
35528
ab07b17fddfb Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
28 #include "ui.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
29 #include "gui/app/app.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
30 #include "gui/app/gui.h"
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
31 #include "gui/interface.h"
35529
8ad4d2fb46e8 Rebuild GUI directory structure.
ib
parents: 35528
diff changeset
32 #include "gui/dialog/dialog.h"
35788
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
33 #include "gui/wm/ws.h"
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
34 #include "gui/wm/wsxdnd.h"
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
35
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
36 int videoVisible = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
37
35780
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
38 static void uiVideoDraw( void )
34697
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 == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
41
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
42 if ( guiApp.videoWindow.State == wsWindowFocusIn ) videoVisible++;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
43 if ( guiApp.videoWindow.State == wsWindowFocusOut && metacity_hack != 3 ) videoVisible--;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
44
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
45 if ( !guiApp.videoWindow.Mapped ||
35757
b1d32b46514e Get rid of uiVideoRender.
ib
parents: 35751
diff changeset
46 guiApp.videoWindow.Visible == wsWindowNotVisible ||
b1d32b46514e Get rid of uiVideoRender.
ib
parents: 35751
diff changeset
47 guiInfo.Playing) return;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
48
35757
b1d32b46514e Get rid of uiVideoRender.
ib
parents: 35751
diff changeset
49 if ( guiApp.videoWindow.State == wsWindowExpose )
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
50 {
35739
6b82e3079aea Remove unnecessary wsWindowBackground() calls.
ib
parents: 35681
diff changeset
51 wsWindowBackground(&guiApp.videoWindow, guiApp.video.R, guiApp.video.G, guiApp.video.B);
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35664
diff changeset
52 if ( guiApp.video.Bitmap.Image ) wsImageDraw( &guiApp.videoWindow );
34697
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
35780
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
56 static void uiVideoMouse( int Button,int X,int Y,int RX,int RY )
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
57 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
58 static int mplVideoMoved = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
59 static int msButton = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
60
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
61 uiPlaybarShow( Y );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
62
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
63 switch( Button )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
64 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
65 case wsRRMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
66 gtkShow( ivShowPopUpMenu,NULL );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
67 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
68 case wsPMMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
69 gtkShow( ivHidePopUpMenu,NULL );
35766
16ed8155439b Rename uiShowMenu() uiMenuShow() and uiHideMenu() uiMenuHide().
ib
parents: 35762
diff changeset
70 uiMenuShow( RX,RY );
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
71 msButton=wsPMMouseButton;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
72 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
73 case wsRMMouseButton:
35766
16ed8155439b Rename uiShowMenu() uiMenuShow() and uiHideMenu() uiMenuHide().
ib
parents: 35762
diff changeset
74 uiMenuHide( RX,RY,1 );
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
75 msButton=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
76 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
77 /* --- */
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
78 case wsPLMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
79 gtkShow( ivHidePopUpMenu,NULL );
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
80 sx=X; sy=Y;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
81 msButton=wsPLMouseButton;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
82 mplVideoMoved=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
83 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
84 case wsMoveMouse:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
85 switch ( msButton )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
86 {
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
87 case wsPLMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
88 mplVideoMoved=1;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
89 if ( !guiApp.videoWindow.isFullScreen )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
90 {
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35664
diff changeset
91 wsWindowMove( &guiApp.videoWindow,True,RX - sx,RY - sy );
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
92 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
93 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
94 case wsPMMouseButton:
35779
8ad72f9cf697 Fix segmentation fault with menu window.
ib
parents: 35778
diff changeset
95 if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
96 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
97 default: uiPlaybarShow( Y ); break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
98 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
99 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
100 case wsRLMouseButton:
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
101 if ( ( !mplVideoMoved )&&( guiApp.videoWindow.isFullScreen ) )
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
102 {
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35664
diff changeset
103 // NOTE TO MYSELF: this doesn't work, fix later with wsWindowLayer()?
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35664
diff changeset
104 if( videoVisible++%2 ) wsWindowRaiseTop( wsDisplay,guiApp.mainWindow.WindowID );
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35664
diff changeset
105 else wsWindowRaiseTop( wsDisplay,guiApp.videoWindow.WindowID );
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
106 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
107 msButton=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
108 mplVideoMoved=0;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
109 break;
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
110 }
ac6b38cd0d45 Rename sub window video window.
ib
parents:
diff changeset
111 }
35780
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
112
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
113 void uiVideoInit (void)
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
114 {
36288
63e8bfb208c6 Remove property wsWaitMap and function wsWindowMapWait().
ib
parents: 35796
diff changeset
115 wsWindowCreate(&guiApp.videoWindow, guiApp.video.x, guiApp.video.y, guiApp.video.width, guiApp.video.height, wsShowFrame | wsHideWindow | wsAspect, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer - Video");
35788
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
116 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[video] videoWindow ID: 0x%x\n", (int) guiApp.videoWindow.WindowID);
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
117 wsWindowIcon(wsDisplay, guiApp.videoWindow.WindowID, &guiIcon);
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
118 if (guiApp.video.Bitmap.Image)
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
119 {
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
120 wsImageResize(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
121 wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image);
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
122 }
e3dcd5854344 Move video window initialization code to uiVideoInit().
ib
parents: 35780
diff changeset
123 wsXDNDMakeAwareness(&guiApp.videoWindow);
35780
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
124 guiApp.videoWindow.DrawHandler = uiVideoDraw;
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
125 guiApp.videoWindow.MouseHandler = uiVideoMouse;
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
126 guiApp.videoWindow.KeyHandler = guiApp.mainWindow.KeyHandler;
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
127 guiApp.videoWindow.DNDHandler = guiApp.mainWindow.DNDHandler;
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
128 }
35796
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35788
diff changeset
129
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35788
diff changeset
130 void uiVideoDone (void)
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35788
diff changeset
131 {
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35788
diff changeset
132 wsWindowDestroy(&guiApp.videoWindow);
36291
b2edfe1a11a6 Process events after destroying a window.
ib
parents: 36288
diff changeset
133 wsEvents();
35796
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35788
diff changeset
134 }