Mercurial > mplayer.hg
annotate Gui/mplayer/mw.c @ 22515:cecab9cb54f6
r22521: Clarify -reuse-socket description.
author | voroshil |
---|---|
date | Mon, 12 Mar 2007 18:11:25 +0000 |
parents | a7e5b99ac083 |
children | 8c2056711a2a |
rev | line source |
---|---|
1693 | 1 |
2 // main window | |
3 | |
8055 | 4 #include <stdlib.h> |
5 #include <stdio.h> | |
6 #include <inttypes.h> | |
7 #include <sys/stat.h> | |
8 #include <unistd.h> | |
9 | |
17144 | 10 #include "app.h" |
11 #include "skin/font.h" | |
12 #include "skin/skin.h" | |
13 #include "wm/ws.h" | |
8055 | 14 |
17144 | 15 #include "../config.h" |
16 #include "../help_mp.h" | |
17 #include "../libvo/x11_common.h" | |
18 #include "../libvo/fastmemcpy.h" | |
8055 | 19 |
19271
64d82a45a05d
introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
ben
parents:
19104
diff
changeset
|
20 #include "../stream/stream.h" |
17144 | 21 #include "../mixer.h" |
22 #include "../libvo/sub.h" | |
23 #include "../mplayer.h" | |
22286 | 24 #include "../access_mpcontext.h" |
2447 | 25 |
17144 | 26 #include "../libmpdemux/demuxer.h" |
27 #include "../libmpdemux/stheader.h" | |
28 #include "../codec-cfg.h" | |
18185
34cc93e9848f
simpler and better subtitles switching, patch by Stanislav Maslovski <stanislav P maslovski A gmail P com>
gpoirier
parents:
18118
diff
changeset
|
29 #include "../m_option.h" |
34cc93e9848f
simpler and better subtitles switching, patch by Stanislav Maslovski <stanislav P maslovski A gmail P com>
gpoirier
parents:
18118
diff
changeset
|
30 #include "../m_property.h" |
8305
4c23944315d6
- add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8302
diff
changeset
|
31 |
13672 | 32 #define GUI_REDRAW_WAIT 375 |
8305
4c23944315d6
- add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8302
diff
changeset
|
33 |
8055 | 34 #include "play.h" |
35 #include "widgets.h" | |
36 | |
8043 | 37 extern unsigned int GetTimerMS( void ); |
38 | |
1693 | 39 unsigned char * mplDrawBuffer = NULL; |
40 int mplMainRender = 1; | |
2940 | 41 |
1693 | 42 int mplMainAutoPlay = 0; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
43 int mplMiddleMenu = 0; |
1693 | 44 |
45 int mainVisible = 1; | |
46 | |
47 int boxMoved = 0; | |
48 int sx = 0,sy = 0; | |
49 int i,pot = 0; | |
50 | |
8973 | 51 #include "common.h" |
1693 | 52 |
8058 | 53 void mplMainDraw( void ) |
1693 | 54 { |
55 | |
6043 | 56 if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit ); |
57 | |
1693 | 58 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || |
1729 | 59 !mainVisible ) return; |
60 // !appMPlayer.mainWindow.Mapped ) return; | |
61 | |
6794 | 62 if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose ) |
1693 | 63 { |
8973 | 64 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
65 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
66 | |
1693 | 67 memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); |
8973 | 68 Render( &appMPlayer.mainWindow,appMPlayer.Items,appMPlayer.NumberOfItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); |
1693 | 69 mplMainRender=0; |
70 } | |
71 wsPutImage( &appMPlayer.mainWindow ); | |
2854 | 72 // XFlush( wsDisplay ); |
1693 | 73 } |
74 | |
19104
2ec2301183cd
marks several read-only string parameters which aren't modified inside the called function as const. Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
18976
diff
changeset
|
75 extern void exit_player(const char* how); |
6280 | 76 extern int vcd_track; |
13672 | 77 static unsigned last_redraw_time = 0; |
1729 | 78 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
79 void mplEventHandling( int msg,float param ) |
1693 | 80 { |
8423 | 81 int iparam = (int)param; |
22286 | 82 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext); |
1693 | 83 |
84 switch( msg ) | |
85 { | |
86 // --- user events | |
87 case evExit: | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
88 exit_player( "Exit" ); |
1693 | 89 break; |
2994 | 90 |
6298 | 91 case evPlayNetwork: |
9040
2a0619fd84f0
- add new entry's to hungarian skin howto (please Gabu translate)
pontscho
parents:
8975
diff
changeset
|
92 gfree( (void **)&guiIntfStruct.Subtitlename ); |
2a0619fd84f0
- add new entry's to hungarian skin howto (please Gabu translate)
pontscho
parents:
8975
diff
changeset
|
93 gfree( (void **)&guiIntfStruct.AudioFile ); |
6298 | 94 guiIntfStruct.StreamType=STREAMTYPE_STREAM; |
95 goto play; | |
96 case evSetURL: | |
97 gtkShow( evPlayNetwork,NULL ); | |
98 break; | |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8305
diff
changeset
|
99 |
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8305
diff
changeset
|
100 case evSetAudio: |
8423 | 101 if ( !guiIntfStruct.demuxer || audio_id == iparam ) break; |
102 audio_id=iparam; | |
8484 | 103 goto play; |
8380 | 104 |
105 case evSetVideo: | |
8423 | 106 if ( !guiIntfStruct.demuxer || video_id == iparam ) break; |
107 video_id=iparam; | |
8484 | 108 goto play; |
8380 | 109 |
18118
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
110 case evSetSubtitle: |
22286 | 111 mp_property_do("sub",M_PROPERTY_SET,&iparam,guiIntfStruct.mpcontext); |
18185
34cc93e9848f
simpler and better subtitles switching, patch by Stanislav Maslovski <stanislav P maslovski A gmail P com>
gpoirier
parents:
18118
diff
changeset
|
112 break; |
18118
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
113 |
6280 | 114 #ifdef HAVE_VCD |
115 case evSetVCDTrack: | |
8423 | 116 guiIntfStruct.Track=iparam; |
6280 | 117 case evPlayVCD: |
7009 | 118 gtkSet( gtkClearStruct,0,(void *)guiALL ); |
6280 | 119 guiIntfStruct.StreamType=STREAMTYPE_VCD; |
120 goto play; | |
121 #endif | |
3054 | 122 #ifdef USE_DVDREAD |
2994 | 123 case evPlayDVD: |
5665 | 124 guiIntfStruct.DVD.current_title=1; |
125 guiIntfStruct.DVD.current_chapter=1; | |
126 guiIntfStruct.DVD.current_angle=1; | |
3618 | 127 play_dvd_2: |
7009 | 128 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
129 guiIntfStruct.StreamType=STREAMTYPE_DVD; |
8423 | 130 goto play; |
3054 | 131 #endif |
2994 | 132 case evPlay: |
133 case evPlaySwitchToPause: | |
6280 | 134 play: |
6713 | 135 |
6794 | 136 if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause; |
3618 | 137 |
6905 | 138 if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) ) |
6713 | 139 { |
140 plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL ); | |
141 plLastPlayed=next; | |
8423 | 142 mplSetFileName( next->path,next->name,STREAMTYPE_FILE ); |
6713 | 143 } |
144 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
145 switch ( guiIntfStruct.StreamType ) |
1693 | 146 { |
6298 | 147 case STREAMTYPE_STREAM: |
6280 | 148 case STREAMTYPE_FILE: |
7009 | 149 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiFilenames) ); |
6280 | 150 break; |
151 #ifdef HAVE_VCD | |
2995 | 152 case STREAMTYPE_VCD: |
7009 | 153 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) ); |
8933
bfe1b826cff1
add DVD and CDRom device entry's, and fix two 10l bug
pontscho
parents:
8883
diff
changeset
|
154 if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE ); |
7009 | 155 mplSetFileName( NULL,cdrom_device,STREAMTYPE_VCD ); |
6280 | 156 if ( guiIntfStruct.Playing != 2 ) |
157 { | |
158 if ( !guiIntfStruct.Track ) | |
159 { | |
8423 | 160 if ( guiIntfStruct.VCDTracks > 1 ) guiIntfStruct.Track=2; |
161 else guiIntfStruct.Track=1; | |
6280 | 162 } |
163 guiIntfStruct.DiskChanged=1; | |
164 } | |
165 break; | |
166 #endif | |
3054 | 167 #ifdef USE_DVDREAD |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
168 case STREAMTYPE_DVD: |
7009 | 169 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) ); |
8933
bfe1b826cff1
add DVD and CDRom device entry's, and fix two 10l bug
pontscho
parents:
8883
diff
changeset
|
170 if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE ); |
7009 | 171 mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD ); |
5667 | 172 if ( guiIntfStruct.Playing != 2 ) |
173 { | |
8423 | 174 guiIntfStruct.Title=guiIntfStruct.DVD.current_title; |
175 guiIntfStruct.Chapter=guiIntfStruct.DVD.current_chapter; | |
176 guiIntfStruct.Angle=guiIntfStruct.DVD.current_angle; | |
6280 | 177 guiIntfStruct.DiskChanged=1; |
5667 | 178 } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
179 break; |
3054 | 180 #endif |
1693 | 181 } |
8423 | 182 guiIntfStruct.NewPlay=1; |
1693 | 183 mplPlay(); |
184 break; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
185 #ifdef USE_DVDREAD |
3597 | 186 case evSetDVDSubtitle: |
8423 | 187 dvdsub_id=iparam; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
188 goto play_dvd_2; |
3597 | 189 break; |
190 case evSetDVDAudio: | |
8423 | 191 audio_id=iparam; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
192 goto play_dvd_2; |
3597 | 193 break; |
194 case evSetDVDChapter: | |
8423 | 195 guiIntfStruct.DVD.current_chapter=iparam; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
196 goto play_dvd_2; |
3597 | 197 break; |
198 case evSetDVDTitle: | |
8423 | 199 guiIntfStruct.DVD.current_title=iparam; |
5665 | 200 guiIntfStruct.DVD.current_chapter=1; |
201 guiIntfStruct.DVD.current_angle=1; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
202 goto play_dvd_2; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
203 break; |
3618 | 204 #endif |
1693 | 205 |
2994 | 206 case evPause: |
1693 | 207 case evPauseSwitchToPlay: |
208 NoPause: | |
4963 | 209 mplPause(); |
1693 | 210 break; |
211 | |
8423 | 212 case evStop: |
213 guiIntfStruct.Playing=guiSetStop; | |
214 mplState(); | |
215 guiIntfStruct.NoWindow=False; | |
216 break; | |
1693 | 217 |
218 case evLoadPlay: | |
219 mplMainAutoPlay=1; | |
6280 | 220 // guiIntfStruct.StreamType=STREAMTYPE_FILE; |
1693 | 221 case evLoad: |
6713 | 222 gtkSet( gtkDelPl,0,NULL ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
223 gtkShow( evLoad,NULL ); |
1693 | 224 break; |
6794 | 225 case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break; |
7169 | 226 case evDropSubtitle: |
227 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
228 guiLoadSubtitle( NULL ); | |
229 break; | |
6794 | 230 case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break; |
231 case evPrev: mplPrev(); break; | |
232 case evNext: mplNext(); break; | |
1693 | 233 |
6713 | 234 case evPlayList: gtkShow( evPlayList,NULL ); break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
235 case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break; |
6713 | 236 case evAbout: gtkShow( evAbout,NULL ); break; |
237 case evPreferences: gtkShow( evPreferences,NULL ); break; | |
238 case evEqualizer: gtkShow( evEqualizer,NULL ); break; | |
1693 | 239 |
8720 | 240 case evForward10min: mplRelSeek( 600 ); break; |
241 case evBackward10min: mplRelSeek( -600 );break; | |
1693 | 242 case evForward1min: mplRelSeek( 60 ); break; |
243 case evBackward1min: mplRelSeek( -60 ); break; | |
244 case evForward10sec: mplRelSeek( 10 ); break; | |
245 case evBackward10sec: mplRelSeek( -10 ); break; | |
246 case evSetMoviePosition: mplAbsSeek( param ); break; | |
247 | |
1860 | 248 case evIncVolume: vo_x11_putkey( wsGrayMul ); break; |
249 case evDecVolume: vo_x11_putkey( wsGrayDiv ); break; | |
22286 | 250 case evMute: mixer_mute( mixer ); break; |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
251 |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
252 case evSetVolume: |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
253 guiIntfStruct.Volume=param; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
254 goto set_volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
255 case evSetBalance: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
256 guiIntfStruct.Balance=param; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
257 set_volume: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
258 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
259 float l = guiIntfStruct.Volume * ( ( 100.0 - guiIntfStruct.Balance ) / 50.0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
260 float r = guiIntfStruct.Volume * ( ( guiIntfStruct.Balance ) / 50.0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
261 if ( l > guiIntfStruct.Volume ) l=guiIntfStruct.Volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
262 if ( r > guiIntfStruct.Volume ) r=guiIntfStruct.Volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
263 // printf( "!!! v: %.2f b: %.2f -> %.2f x %.2f\n",guiIntfStruct.Volume,guiIntfStruct.Balance,l,r ); |
22286 | 264 mixer_setvolume( mixer,l,r ); |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
265 } |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
266 if ( osd_level ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
267 { |
18287
292337d09af2
Remove updating of vo_mouse_timer_const from the main loop and also
uau
parents:
18185
diff
changeset
|
268 osd_visible=(GetTimerMS() + 1000) | 1; |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
269 vo_osd_progbar_type=OSD_VOLUME; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
270 vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
271 vo_osd_changed( OSDTYPE_PROGBAR ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
272 } |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
273 break; |
1847 | 274 |
1693 | 275 |
2994 | 276 case evIconify: |
8423 | 277 switch ( iparam ) |
2994 | 278 { |
279 case 0: wsIconify( appMPlayer.mainWindow ); break; | |
280 case 1: wsIconify( appMPlayer.subWindow ); break; | |
281 } | |
282 break; | |
14589 | 283 case evHalfSize: |
284 btnSet( evFullScreen,btnReleased ); | |
285 if ( guiIntfStruct.Playing ) | |
286 { | |
287 if ( appMPlayer.subWindow.isFullScreen ) | |
288 { | |
289 mplFullScreen(); | |
290 } | |
291 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth / 2, guiIntfStruct.MovieHeight / 2 ); | |
292 wsMoveWindow( &appMPlayer.subWindow, 0, | |
293 ( wsMaxX - guiIntfStruct.MovieWidth/2 )/2 + wsOrgX, | |
294 ( wsMaxY - guiIntfStruct.MovieHeight/2 )/2 + wsOrgY ); | |
295 } | |
296 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
297 case evDoubleSize: |
9202 | 298 btnSet( evFullScreen,btnReleased ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
299 if ( guiIntfStruct.Playing ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
300 { |
14006
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
301 if ( appMPlayer.subWindow.isFullScreen ) |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
302 { |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
303 mplFullScreen(); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
304 } |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
305 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth * 2, guiIntfStruct.MovieHeight * 2 ); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
306 wsMoveWindow( &appMPlayer.subWindow, 0, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
307 ( wsMaxX - guiIntfStruct.MovieWidth*2 )/2 + wsOrgX, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
308 ( wsMaxY - guiIntfStruct.MovieHeight*2 )/2 + wsOrgY ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
309 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
310 break; |
6623 | 311 case evNormalSize: |
9202 | 312 btnSet( evFullScreen,btnReleased ); |
6623 | 313 if ( guiIntfStruct.Playing ) |
314 { | |
14006
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
315 if ( appMPlayer.subWindow.isFullScreen ) |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
316 { |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
317 mplFullScreen(); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
318 } |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
319 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth, guiIntfStruct.MovieHeight ); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
320 wsMoveWindow( &appMPlayer.subWindow, 0, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
321 ( wsMaxX - guiIntfStruct.MovieWidth )/2 + wsOrgX, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
322 ( wsMaxY - guiIntfStruct.MovieHeight )/2 + wsOrgY ); |
6623 | 323 break; |
324 } else if ( !appMPlayer.subWindow.isFullScreen ) break; | |
2994 | 325 case evFullScreen: |
9202 | 326 if ( !guiIntfStruct.Playing && !gtkShowVideoWindow ) break; |
4981 | 327 mplFullScreen(); |
9202 | 328 if ( appMPlayer.subWindow.isFullScreen ) btnSet( evFullScreen,btnPressed ); |
329 else btnSet( evFullScreen,btnReleased ); | |
2994 | 330 break; |
1693 | 331 |
7541 | 332 case evSetAspect: |
8423 | 333 switch ( iparam ) |
7541 | 334 { |
335 case 2: movie_aspect=16.0f / 9.0f; break; | |
336 case 3: movie_aspect=4.0f / 3.0f; break; | |
337 case 4: movie_aspect=2.35; break; | |
338 case 1: | |
339 default: movie_aspect=-1; | |
340 } | |
341 wsClearWindow( appMPlayer.subWindow ); | |
8039 | 342 #ifdef USE_DVDREAD |
8423 | 343 if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2; |
8039 | 344 else |
345 #endif | |
8423 | 346 guiIntfStruct.NewPlay=1; |
7541 | 347 break; |
348 | |
1693 | 349 // --- timer events |
350 case evRedraw: | |
13672 | 351 { |
352 unsigned now = GetTimerMS(); | |
353 extern int mplPBFade; | |
354 if ((now > last_redraw_time) && | |
355 (now < last_redraw_time + GUI_REDRAW_WAIT) && | |
356 !mplPBFade) | |
357 break; | |
358 last_redraw_time = now; | |
359 } | |
1693 | 360 mplMainRender=1; |
361 wsPostRedisplay( &appMPlayer.mainWindow ); | |
8973 | 362 wsPostRedisplay( &appMPlayer.barWindow ); |
1693 | 363 break; |
364 // --- system events | |
6218 | 365 #ifdef MP_DEBUG |
1693 | 366 case evNone: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
367 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" ); |
1693 | 368 break; |
369 default: | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
370 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); |
1693 | 371 break; |
6218 | 372 #endif |
1693 | 373 } |
374 } | |
375 | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
376 #define itPLMButton (itNULL - 1) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
377 #define itPRMButton (itNULL - 2) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
378 |
1693 | 379 void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) |
380 { | |
381 static int itemtype = 0; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
382 int i; |
1693 | 383 wItem * item = NULL; |
384 float value = 0.0f; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
385 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
386 static int SelectedItem = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
387 int currentselected = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
388 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
389 for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
390 if ( ( appMPlayer.Items[i].pressed != btnDisabled )&& |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
391 ( wgIsRect( X,Y,appMPlayer.Items[i].x,appMPlayer.Items[i].y,appMPlayer.Items[i].x+appMPlayer.Items[i].width,appMPlayer.Items[i].y+appMPlayer.Items[i].height ) ) ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
392 { currentselected=i; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
393 |
1693 | 394 switch ( Button ) |
395 { | |
6651 | 396 case wsPMMouseButton: |
6755 | 397 gtkShow( evHidePopUpMenu,NULL ); |
1693 | 398 mplShowMenu( RX,RY ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
399 itemtype=itPRMButton; |
1693 | 400 break; |
6651 | 401 case wsRMMouseButton: |
5919 | 402 mplHideMenu( RX,RY,0 ); |
1693 | 403 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
404 |
1693 | 405 case wsPLMouseButton: |
6755 | 406 gtkShow( evHidePopUpMenu,NULL ); |
8973 | 407 sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
408 SelectedItem=currentselected; |
8973 | 409 if ( SelectedItem == -1 ) break; |
410 boxMoved=0; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
411 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
412 itemtype=item->type; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
413 item->pressed=btnPressed; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
414 switch( item->type ) |
1693 | 415 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
416 case itButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
417 if ( ( SelectedItem > -1 ) && |
8973 | 418 ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || |
419 ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) | |
420 { item->pressed=btnDisabled; } | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
421 break; |
1693 | 422 } |
423 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
424 case wsRLMouseButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
425 boxMoved=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
426 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
427 item->pressed=btnReleased; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
428 SelectedItem=-1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
429 if ( currentselected == - 1 ) { itemtype=0; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
430 value=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
431 switch( itemtype ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
432 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
433 case itPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
434 case itHPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
435 btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
436 mplEventHandling( item->msg,item->value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
437 value=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
438 break; |
17254 | 439 case itVPotmeter: |
440 btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); | |
441 mplEventHandling( item->msg,item->value ); | |
442 value=item->value; | |
443 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
444 } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
445 mplEventHandling( item->msg,value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
446 itemtype=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
447 break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
448 |
17087
4a56f15dee5f
Fix popup menu problems: GTK cannot get a grab while the button is down,
reimar
parents:
14589
diff
changeset
|
449 case wsRRMouseButton: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
450 gtkShow( evShowPopUpMenu,NULL ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
451 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
452 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
453 // --- rolled mouse ... de szar :))) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
454 case wsP5MouseButton: value=-2.5f; goto rollerhandled; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
455 case wsP4MouseButton: value= 2.5f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
456 rollerhandled: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
457 item=&appMPlayer.Items[currentselected]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
458 if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
459 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
460 item->value+=value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
461 btnModify( item->msg,item->value ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
462 mplEventHandling( item->msg,item->value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
463 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
464 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
465 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
466 // --- moving |
1693 | 467 case wsMoveMouse: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
468 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
469 switch ( itemtype ) |
1693 | 470 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
471 case itPLMButton: |
2854 | 472 wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) ); |
1693 | 473 mplMainRender=0; |
474 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
475 case itPRMButton: |
1693 | 476 mplMenuMouseHandle( X,Y,RX,RY ); |
477 break; | |
478 case itPotmeter: | |
1729 | 479 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 480 goto potihandled; |
8973 | 481 case itVPotmeter: |
17254 | 482 item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f; |
8973 | 483 goto potihandled; |
1693 | 484 case itHPotmeter: |
1729 | 485 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 486 potihandled: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
487 if ( item->value > 100.0f ) item->value=100.0f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
488 if ( item->value < 0.0f ) item->value=0.0f; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
489 mplEventHandling( item->msg,item->value ); |
1693 | 490 break; |
491 } | |
492 break; | |
493 } | |
494 } | |
495 | |
496 int keyPressed = 0; | |
497 | |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
498 void mplMainKeyHandle( int KeyCode,int Type,int Key ) |
1693 | 499 { |
500 int msg = evNone; | |
4950 | 501 |
4409 | 502 if ( Type != wsKeyPressed ) return; |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
503 |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
504 if ( !Key ) |
1693 | 505 { |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
506 switch ( KeyCode ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
507 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
508 case wsXFMMPrev: msg=evPrev; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
509 case wsXFMMStop: msg=evStop; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
510 case wsXFMMPlay: msg=evPlaySwitchToPause; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
511 case wsXFMMNext: msg=evNext; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
512 case wsXFMMVolUp: msg=evIncVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
513 case wsXFMMVolDown: msg=evDecVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
514 case wsXFMMMute: msg=evMute; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
515 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
516 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
517 else |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
518 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
519 switch ( Key ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
520 { |
8302 | 521 case wsEnter: msg=evPlay; break; |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
522 case wsXF86LowerVolume: msg=evDecVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
523 case wsXF86RaiseVolume: msg=evIncVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
524 case wsXF86Mute: msg=evMute; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
525 case wsXF86Play: msg=evPlaySwitchToPause; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
526 case wsXF86Stop: msg=evStop; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
527 case wsXF86Prev: msg=evPrev; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
528 case wsXF86Next: msg=evNext; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
529 case wsXF86Media: msg=evLoad; break; |
8973 | 530 case wsEscape: |
8302 | 531 if ( appMPlayer.subWindow.isFullScreen ) |
532 { | |
8973 | 533 if ( guiIntfStruct.event_struct ) ((XEvent *)guiIntfStruct.event_struct)->type=None; |
8302 | 534 mplEventHandling( evNormalSize,0 ); |
8973 | 535 return; |
8302 | 536 } |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
537 default: vo_x11_putkey( Key ); return; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
538 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
539 } |
4858 | 540 if ( msg != evNone ) mplEventHandling( msg,0 ); |
1693 | 541 } |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
542 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
543 /* this will be used to handle Drag&Drop files */ |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7009
diff
changeset
|
544 void mplDandDHandler(int num,char** files) |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
545 { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
546 struct stat buf; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
547 int f = 0; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
548 |
8481 | 549 char* subtitles = NULL; |
550 char* filename = NULL; | |
551 | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
552 if (num <= 0) |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
553 return; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
554 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
555 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
556 /* now fill it with new items */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
557 for(f=0; f < num; f++){ |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
558 char* str = strdup( files[f] ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
559 plItem* item; |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
560 |
6996 | 561 #ifdef USE_ICONV |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
562 if ( strchr( str,'%' ) ) |
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
563 { |
6996 | 564 char * tmp=gconvert_uri_to_filename( str ); |
565 free( str ); str=tmp; | |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
566 } |
6996 | 567 #endif |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
568 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
569 if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
570 /* this is not a directory so try to play it */ |
14156 | 571 mp_msg( MSGT_GPLAYER,MSGL_V,"Received D&D %s\n",str ); |
8481 | 572 |
573 /* check if it is a subtitle file */ | |
574 { | |
575 char* ext = strrchr(str,'.'); | |
576 if (ext) { | |
577 static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/"; | |
578 char* type; | |
579 int len; | |
580 if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\ | |
581 (type-supported)%4 == 0 && *(type+len) == '/'){ | |
582 /* handle subtitle file */ | |
583 gfree((void**)&subtitles); | |
584 subtitles = str; | |
585 continue; | |
586 } | |
587 } | |
588 } | |
589 | |
590 /* clear playlist */ | |
591 if (filename == NULL) { | |
592 filename = files[f]; | |
593 gtkSet(gtkDelPl,0,NULL); | |
594 } | |
595 | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
596 item = calloc(1,sizeof(plItem)); |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
597 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
598 /* FIXME: decompose file name ? */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
599 /* yes -- Pontscho */ |
8481 | 600 if ( strrchr( str,'/' ) ) { |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
601 char * s = strrchr( str,'/' ); *s=0; s++; |
8481 | 602 item->name = gstrdup( s ); |
603 item->path = gstrdup( str ); | |
604 } else { | |
605 item->name = strdup(str); | |
606 item->path = strdup(""); | |
607 } | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
608 gtkSet(gtkAddPlItem,0,(void*)item); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
609 } else { |
14156 | 610 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
611 } |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
612 free( str ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
613 } |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
614 |
8481 | 615 if (filename) { |
616 mplSetFileName( NULL,filename,STREAMTYPE_FILE ); | |
617 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); | |
618 mplEventHandling( evPlay,0 ); | |
619 } | |
620 if (subtitles) { | |
621 gfree((void**)&guiIntfStruct.Subtitlename); | |
622 guiIntfStruct.Subtitlename = subtitles; | |
623 guiLoadSubtitle(guiIntfStruct.Subtitlename); | |
624 } | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
625 } |