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