*** MPlayer-20020810/./Gui/Makefile Thu Jul 25 23:26:29 2002 --- MPlayer-20020810.new/./Gui/Makefile Sat Aug 10 19:29:25 2002 *************** *** 14,20 **** CFLAGS = $(OPTIMIZE) $(INCDIR) $(DEBUG) ! SRCS = wm/ws.c wm/wsconv.c app.c events.c interface.c cfg.c \ bitmap/bitmap.c bitmap/tga/tga.c bitmap/bmp/bmp.c bitmap/png/png.c \ skin/skin.c skin/font.c skin/cut.c \ mplayer/mplayer.c mplayer/widgets.c mplayer/play.c \ --- 14,20 ---- CFLAGS = $(OPTIMIZE) $(INCDIR) $(DEBUG) ! SRCS = wm/ws.c wm/wsconv.c wm/wsxdnd.c app.c events.c interface.c cfg.c \ bitmap/bitmap.c bitmap/tga/tga.c bitmap/bmp/bmp.c bitmap/png/png.c \ skin/skin.c skin/font.c skin/cut.c \ mplayer/mplayer.c mplayer/widgets.c mplayer/play.c \ *** MPlayer-20020810/./Gui/mplayer/mw.h Sun Aug 4 23:44:15 2002 --- MPlayer-20020810.new/./Gui/mplayer/mw.h Sat Aug 10 19:30:27 2002 *************** *** 650,652 **** --- 650,692 ---- } 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 ? */ + item->name = strdup(str); + item->path = strdup(""); + gtkSet(gtkAddPlItem,0,(void*)item); + } else { + printf("Received not a file: %s !\n",str); + } + } + + gfree( (void **)&guiIntfStruct.Filename); + guiIntfStruct.Filename = strdup(files[0]); + guiIntfStruct.StreamType=STREAMTYPE_FILE; + guiIntfStruct.FilenameChanged=1; + gfree( (void **)&guiIntfStruct.AudioFile ); + gfree( (void **)&guiIntfStruct.Subtitlename ); + /* Restart playing */ + mplEventHandling( evStop,0 ); + mplEventHandling( evPlay,0 ); + } *** MPlayer-20020810/./Gui/wm/ws.h Thu Jul 25 23:26:38 2002 --- MPlayer-20020810.new/./Gui/wm/ws.h Sat Aug 10 17:17:15 2002 *************** *** 100,106 **** typedef void (*wsTIdle)( void ); typedef void (*wsTKeyHandler)( int KeyCode,int Type,int Key ); typedef void (*wsTMouseHandler)( int Button,int X,int Y,int RX,int RY ); ! typedef void (*wsRemoteHandler)( char * str ); typedef struct { --- 100,106 ---- typedef void (*wsTIdle)( void ); typedef void (*wsTKeyHandler)( int KeyCode,int Type,int Key ); typedef void (*wsTMouseHandler)( int Button,int X,int Y,int RX,int RY ); ! typedef void (*wsTDNDHandler)( int num,char ** str ); typedef struct { *************** *** 128,134 **** wsTIdle Idle; wsTKeyHandler KeyHandler; wsTMouseHandler MouseHandler; ! wsRemoteHandler RemoteHandler; int Alt; int Shift; --- 128,134 ---- wsTIdle Idle; wsTKeyHandler KeyHandler; wsTMouseHandler MouseHandler; ! wsTDNDHandler DandDHandler; int Alt; int Shift; *** MPlayer-20020810/./Gui/mplayer/mplayer.c Mon Aug 5 04:14:14 2002 --- MPlayer-20020810.new/./Gui/mplayer/mplayer.c Sat Aug 10 17:07:58 2002 *************** *** 3,8 **** --- 3,11 ---- #include #include #include + #include + #include + #include #include "./mplayer.h" #include "../events.h" *************** *** 14,19 **** --- 17,23 ---- #include "../wm/ws.h" #include "../wm/wskeys.h" #include "../wm/widget.h" + #include "../wm/wsxdnd.h" #include "../bitmap/bitmap.h" #include "../../config.h" *************** *** 71,76 **** --- 75,81 ---- 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,87 **** --- 87,93 ---- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); + wsXDNDMakeAwareness(&appMPlayer.mainWindow); mplMenuInit(); *************** *** 94,103 **** --- 100,111 ---- 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 ); *** MPlayer-20020810/./Gui/wm/ws.c Thu Jul 25 23:26:38 2002 --- MPlayer-20020810.new/./Gui/wm/ws.c Sat Aug 10 19:48:36 2002 *************** *** 21,26 **** --- 21,27 ---- #include "../../config.h" #include "ws.h" #include "wsconv.h" + #include "wsxdnd.h" #include "../../postproc/rgb2rgb.h" #include "../../mp_msg.h" #include "../../mplayer.h" *************** *** 227,232 **** --- 228,236 ---- } } + /* enable DND atoms */ + wsXDNDInitialize(); + { /* on remote display XShm will be disabled - LGB */ char *dispname=DisplayString(wsDisplay); int localdisp=1; *************** *** 557,563 **** { i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; } if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomRolle ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] rolled.\n" ); } ! } break; case MapNotify: i=wsWindowMapped; wsWindowList[l]->Mapped=wsMapped; goto expose; --- 561,570 ---- { i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; } if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomRolle ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] rolled.\n" ); } ! } else { ! /* try to process DND events */ ! wsXDNDProcessClientMessage(wsWindowList[l],&Event->xclient); ! } break; case MapNotify: i=wsWindowMapped; wsWindowList[l]->Mapped=wsMapped; goto expose; *************** *** 681,686 **** --- 688,697 ---- } break; + case SelectionNotify: + /* Handle DandD */ + wsXDNDProcessSelection(wsWindowList[l],Event); + break; } XFlush( wsDisplay ); XSync( wsDisplay,False );