diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-16 20:16:29 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-16 20:16:29 +0000 |
commit | 3490a00e2b5952b9c49781859073e3515f78bcd7 (patch) | |
tree | 709a5c628e5a42c1a9cbb46c3a979cdf219fa176 /Gui | |
parent | 600abbc5271d25383fd98cae677a2f27fb9dab07 (diff) | |
download | mpv-3490a00e2b5952b9c49781859073e3515f78bcd7.tar.bz2 mpv-3490a00e2b5952b9c49781859073e3515f78bcd7.tar.xz |
applied Gregory's patch
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8482 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r-- | Gui/mplayer/mw.c | 55 | ||||
-rw-r--r-- | Gui/wm/wsxdnd.c | 5 |
2 files changed, 45 insertions, 15 deletions
diff --git a/Gui/mplayer/mw.c b/Gui/mplayer/mw.c index d59fd9f8e5..646e74dcb6 100644 --- a/Gui/mplayer/mw.c +++ b/Gui/mplayer/mw.c @@ -688,11 +688,12 @@ void mplDandDHandler(int num,char** files) struct stat buf; int f = 0; + char* subtitles = NULL; + char* filename = NULL; + if (num <= 0) return; - /* clear playlist */ - gtkSet(gtkDelPl,0,NULL); /* now fill it with new items */ for(f=0; f < num; f++){ @@ -710,16 +711,42 @@ void mplDandDHandler(int num,char** files) 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); + + /* check if it is a subtitle file */ + { + char* ext = strrchr(str,'.'); + if (ext) { + static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/"; + char* type; + int len; + if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\ + (type-supported)%4 == 0 && *(type+len) == '/'){ + /* handle subtitle file */ + gfree((void**)&subtitles); + subtitles = str; + continue; + } + } + } + + /* clear playlist */ + if (filename == NULL) { + filename = files[f]; + gtkSet(gtkDelPl,0,NULL); + } + item = calloc(1,sizeof(plItem)); /* FIXME: decompose file name ? */ /* yes -- Pontscho */ - if ( strrchr( str,'/' ) ) - { + if ( strrchr( str,'/' ) ) { char * s = strrchr( str,'/' ); *s=0; s++; - item->name = gstrdup( s ); - item->path = gstrdup( str ); - } else { item->name = strdup(str); item->path = strdup(""); } + item->name = gstrdup( s ); + item->path = gstrdup( str ); + } else { + item->name = strdup(str); + item->path = strdup(""); + } gtkSet(gtkAddPlItem,0,(void*)item); } else { printf("Received not a file: %s !\n",str); @@ -727,8 +754,14 @@ void mplDandDHandler(int num,char** files) free( str ); } - mplSetFileName( NULL,files[0],STREAMTYPE_FILE ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); - mplEventHandling( evPlay,0 ); - + if (filename) { + mplSetFileName( NULL,filename,STREAMTYPE_FILE ); + if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); + mplEventHandling( evPlay,0 ); + } + if (subtitles) { + gfree((void**)&guiIntfStruct.Subtitlename); + guiIntfStruct.Subtitlename = subtitles; + guiLoadSubtitle(guiIntfStruct.Subtitlename); + } } diff --git a/Gui/wm/wsxdnd.c b/Gui/wm/wsxdnd.c index c971c48afb..cc755e6e4b 100644 --- a/Gui/wm/wsxdnd.c +++ b/Gui/wm/wsxdnd.c @@ -163,7 +163,7 @@ wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event) unsigned long ret_items; /* while there is data left...*/ - while(ret_left){ + while(ret_left && atom_support == None){ XGetWindowProperty(wsDisplay,event->data.l[0],_XA_XdndTypeList, offset,256,False,XA_ATOM,&ret_type, &ret_format,&ret_items,&ret_left, @@ -183,9 +183,6 @@ wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event) break; } } - /* found it ! */ - if (atom_support != None) - break; } /* maybe next time ... */ XFree(ret_buff); |