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