Mercurial > mplayer.hg
annotate gui/ui/video.c @ 36531:3cd07587a35d
asxparser: Declare variables in the blocks that need them.
author | reimar |
---|---|
date | Sun, 19 Jan 2014 11:13:04 +0000 |
parents | b2edfe1a11a6 |
children | 1236a692d0c6 |
rev | line source |
---|---|
34697 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
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 | 21 #include <string.h> |
22 | |
23 #include "libvo/x11_common.h" | |
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 | 26 #include "mp_core.h" |
27 | |
35528 | 28 #include "ui.h" |
35525 | 29 #include "gui/app/app.h" |
30 #include "gui/app/gui.h" | |
34697 | 31 #include "gui/interface.h" |
35529 | 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 | 35 |
36 int videoVisible = 0; | |
37 | |
35780 | 38 static void uiVideoDraw( void ) |
34697 | 39 { |
40 if ( guiApp.videoWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); | |
41 | |
42 if ( guiApp.videoWindow.State == wsWindowFocusIn ) videoVisible++; | |
43 if ( guiApp.videoWindow.State == wsWindowFocusOut && metacity_hack != 3 ) videoVisible--; | |
44 | |
45 if ( !guiApp.videoWindow.Mapped || | |
35757 | 46 guiApp.videoWindow.Visible == wsWindowNotVisible || |
47 guiInfo.Playing) return; | |
34697 | 48 |
35757 | 49 if ( guiApp.videoWindow.State == wsWindowExpose ) |
34697 | 50 { |
35739 | 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 | 53 } |
54 } | |
55 | |
35780 | 56 static void uiVideoMouse( int Button,int X,int Y,int RX,int RY ) |
34697 | 57 { |
58 static int mplVideoMoved = 0; | |
59 static int msButton = 0; | |
60 | |
61 uiPlaybarShow( Y ); | |
62 | |
63 switch( Button ) | |
64 { | |
65 case wsRRMouseButton: | |
66 gtkShow( ivShowPopUpMenu,NULL ); | |
67 break; | |
68 case wsPMMouseButton: | |
69 gtkShow( ivHidePopUpMenu,NULL ); | |
35766
16ed8155439b
Rename uiShowMenu() uiMenuShow() and uiHideMenu() uiMenuHide().
ib
parents:
35762
diff
changeset
|
70 uiMenuShow( RX,RY ); |
34697 | 71 msButton=wsPMMouseButton; |
72 break; | |
73 case wsRMMouseButton: | |
35766
16ed8155439b
Rename uiShowMenu() uiMenuShow() and uiHideMenu() uiMenuHide().
ib
parents:
35762
diff
changeset
|
74 uiMenuHide( RX,RY,1 ); |
34697 | 75 msButton=0; |
76 break; | |
77 /* --- */ | |
78 case wsPLMouseButton: | |
79 gtkShow( ivHidePopUpMenu,NULL ); | |
80 sx=X; sy=Y; | |
81 msButton=wsPLMouseButton; | |
82 mplVideoMoved=0; | |
83 break; | |
84 case wsMoveMouse: | |
85 switch ( msButton ) | |
86 { | |
87 case wsPLMouseButton: | |
88 mplVideoMoved=1; | |
89 if ( !guiApp.videoWindow.isFullScreen ) | |
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 | 92 } |
93 break; | |
94 case wsPMMouseButton: | |
35779 | 95 if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 ); |
34697 | 96 break; |
97 default: uiPlaybarShow( Y ); break; | |
98 } | |
99 break; | |
100 case wsRLMouseButton: | |
101 if ( ( !mplVideoMoved )&&( guiApp.videoWindow.isFullScreen ) ) | |
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 | 106 } |
107 msButton=0; | |
108 mplVideoMoved=0; | |
109 break; | |
110 } | |
111 } | |
35780 | 112 |
113 void uiVideoInit (void) | |
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 | 124 guiApp.videoWindow.DrawHandler = uiVideoDraw; |
125 guiApp.videoWindow.MouseHandler = uiVideoMouse; | |
126 guiApp.videoWindow.KeyHandler = guiApp.mainWindow.KeyHandler; | |
127 guiApp.videoWindow.DNDHandler = guiApp.mainWindow.DNDHandler; | |
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 | 133 wsEvents(); |
35796
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35788
diff
changeset
|
134 } |