diff options
author | 2002-08-11 13:12:38 +0000 | |
---|---|---|
committer | 2002-08-11 13:12:38 +0000 | |
commit | 418dbef6efa7efd9ccd76bb1925f5eeaf5008b3e (patch) | |
tree | a0dd4ff3367cf1da204f5fb41029b790fdeec357 /Gui/mplayer | |
parent | 0f7ec7d88544be01df6c6710f1ddb4a8df77c9d6 (diff) |
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6968 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui/mplayer')
-rw-r--r-- | Gui/mplayer/mplayer.c | 8 | ||||
-rw-r--r-- | Gui/mplayer/mw.h | 42 | ||||
-rw-r--r-- | Gui/mplayer/play.c | 7 |
3 files changed, 55 insertions, 2 deletions
diff --git a/Gui/mplayer/mplayer.c b/Gui/mplayer/mplayer.c index 68c5a18815..90f33a82be 100644 --- a/Gui/mplayer/mplayer.c +++ b/Gui/mplayer/mplayer.c @@ -3,6 +3,9 @@ #include <stdio.h> #include <string.h> #include <inttypes.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include "./mplayer.h" #include "../events.h" @@ -14,6 +17,7 @@ #include "../wm/ws.h" #include "../wm/wskeys.h" #include "../wm/widget.h" +#include "../wm/wsxdnd.h" #include "../bitmap/bitmap.h" #include "../../config.h" @@ -71,6 +75,7 @@ void mplInit( void * disp ) wsDestroyImage( &appMPlayer.subWindow ); wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); + wsXDNDMakeAwareness(&appMPlayer.subWindow); vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); @@ -82,6 +87,7 @@ void mplInit( void * disp ) wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); + wsXDNDMakeAwareness(&appMPlayer.mainWindow); mplMenuInit(); @@ -94,10 +100,12 @@ void mplInit( void * disp ) appMPlayer.mainWindow.ReDraw=mplMainDraw; appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; + appMPlayer.mainWindow.DandDHandler=mplDandDHandler; appMPlayer.subWindow.ReDraw=mplSubDraw; appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; + appMPlayer.subWindow.DandDHandler=mplDandDHandler; wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); wsClearWindow( appMPlayer.subWindow ); diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index 3bc29c01fd..bf86bd8edd 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -650,3 +650,45 @@ void mplMainKeyHandle( int KeyCode,int Type,int Key ) } if ( msg != evNone ) mplEventHandling( msg,0 ); } + +/* this will be used to handle Drag&Drop files */ +void mplDandDHandler(int num,const char** files) +{ + struct stat buf; + int f = 0; + + if (num <= 0) + return; + + /* clear playlist */ + gtkSet(gtkDelPl,0,NULL); + + /* now fill it with new items */ + for(f=0; f < num; f++){ + char* str = files[f]; + plItem* item; + if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { + /* this is not a directory so try to play it */ + printf("Received D&D %s\n",str); + item = calloc(1,sizeof(plItem)); + /* FIXME: decompose file name ? */ + /* yes -- Pontscho */ + if ( strrchr( str,'/' ) ) + { + char * t = strdup( str ); + char * s = strrchr( t,'/' ); *s=0; s++; + item->name = gstrdup( s ); + item->path = gstrdup( t ); + free( t ); + } else { item->name = strdup(str); item->path = strdup(""); } + gtkSet(gtkAddPlItem,0,(void*)item); + } else { + printf("Received not a file: %s !\n",str); + } + } + + mplSetFileName( NULL,files[0] ); + if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); + mplEventHandling( evPlay,0 ); + +} diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c index 2c547a44a8..1f5d71495e 100644 --- a/Gui/mplayer/play.c +++ b/Gui/mplayer/play.c @@ -246,8 +246,11 @@ void ChangeSkin( char * name ) void mplSetFileName( char * dir,char * name ) { - if ( !name || !dir ) return; - guiSetDF( guiIntfStruct.Filename,dir,name ); + if ( !name ) return; + + if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name ) + else guiSetDF( guiIntfStruct.Filename,dir,name ) + guiIntfStruct.StreamType=STREAMTYPE_FILE; guiIntfStruct.FilenameChanged=1; gfree( (void **)&guiIntfStruct.AudioFile ); |