*** MPlayer-20020802/./Gui/Makefile Thu Jul 25 23:26:29 2002 --- MPlayer-20020802.new/./Gui/Makefile Tue Aug 6 18:08:17 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-20020802/./Gui/mplayer/mw.h Thu Jul 25 23:26:34 2002 --- MPlayer-20020802.new/./Gui/mplayer/mw.h Mon Aug 5 20:57:39 2002 *************** *** 651,653 **** --- 651,676 ---- } if ( msg != evNone ) mplEventHandling( msg,0 ); } + + /* this will be used to handle Drag&Drop files */ + void mplDandDHandler(const char* str) + { + struct stat buf; + if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { + /* this is not a directory so try to play it */ + gfree( (void **)&guiIntfStruct.Filename); + guiIntfStruct.Filename = strdup(str); + guiIntfStruct.StreamType=STREAMTYPE_FILE; + guiIntfStruct.FilenameChanged=1; + gfree( (void **)&guiIntfStruct.AudioFile ); + gfree( (void **)&guiIntfStruct.Subtitlename ); + printf("Received D&D %s\n",str); + /* FIXME: this doesn't work if already playing....*/ + /* stop */ + mplEventHandling( evStop,0 ); + /* play */ + mplEventHandling( evPlay,0 ); + } else { + printf("Received not a file: %s !\n",str); + } + } *** MPlayer-20020802/./Gui/wm/ws.h Thu Jul 25 23:26:38 2002 --- MPlayer-20020802.new/./Gui/wm/ws.h Mon Aug 5 19:53:17 2002 *************** *** 128,134 **** wsTIdle Idle; wsTKeyHandler KeyHandler; wsTMouseHandler MouseHandler; ! wsRemoteHandler RemoteHandler; int Alt; int Shift; --- 128,134 ---- wsTIdle Idle; wsTKeyHandler KeyHandler; wsTMouseHandler MouseHandler; ! wsRemoteHandler DandDHandler; int Alt; int Shift; *** MPlayer-20020802/./Gui/mplayer/mplayer.c Tue Jul 30 14:50:20 2002 --- MPlayer-20020802.new/./Gui/mplayer/mplayer.c Mon Aug 5 19:50:09 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" *************** *** 67,72 **** --- 71,77 ---- 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 ); *************** *** 78,83 **** --- 83,89 ---- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); + wsXDNDMakeAwareness(&appMPlayer.mainWindow); mplMenuInit(); *************** *** 90,99 **** --- 96,107 ---- 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-20020802/./Gui/wm/ws.c Thu Jul 25 23:26:38 2002 --- MPlayer-20020802.new/./Gui/wm/ws.c Mon Aug 5 19:49:50 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" *************** *** 214,260 **** int eventbase; int errorbase; ! if(mDisplay){ ! wsDisplay=mDisplay; ! } else { ! char * DisplayName = ":0.0"; ! if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); ! wsDisplay=XOpenDisplay( DisplayName ); ! if ( !wsDisplay ) ! { ! mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] couldn't open the display !\n" ); ! exit( 0 ); ! } ! } ! ! { /* on remote display XShm will be disabled - LGB */ ! char *dispname=DisplayString(wsDisplay); ! int localdisp=1; ! if (dispname&&*dispname!=':') { ! localdisp=0; ! wsUseXShm=0; } - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE"); - if (!localdisp) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Remote display, disabling XMITSHM\n"); - } if ( !XShmQueryExtension( wsDisplay ) ) ! { ! mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported X shared memory extension.\n" ); ! wsUseXShm=0; ! } #ifdef HAVE_XSHAPE ! if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) ) { ! mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported XShape extension.\n" ); ! wsUseXShape=0; } #else ! wsUseXShape=0; #endif ! XSynchronize( wsDisplay,True ); ! wsScreen=DefaultScreen( wsDisplay ); wsRootWin=RootWindow( wsDisplay,wsScreen ); wsMaxX=DisplayWidth( wsDisplay,wsScreen ); --- 215,264 ---- int eventbase; int errorbase; ! if(mDisplay){ ! wsDisplay=mDisplay; ! } else { ! char * DisplayName = ":0.0"; ! if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); ! wsDisplay=XOpenDisplay( DisplayName ); ! if ( !wsDisplay ) ! { ! mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] couldn't open the display !\n" ); ! exit( 0 ); ! } } + /* enable DND atoms */ + wsXDNDInitialize(); + + { /* on remote display XShm will be disabled - LGB */ + char *dispname=DisplayString(wsDisplay); + int localdisp=1; + if (dispname&&*dispname!=':') { + localdisp=0; + wsUseXShm=0; + } + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE"); + if (!localdisp) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Remote display, disabling XMITSHM\n"); + } + if ( !XShmQueryExtension( wsDisplay ) ) ! { ! mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported X shared memory extension.\n" ); ! wsUseXShm=0; ! } #ifdef HAVE_XSHAPE ! if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) ) { ! mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported XShape extension.\n" ); ! wsUseXShape=0; } #else ! wsUseXShape=0; #endif ! XSynchronize( wsDisplay,True ); ! wsScreen=DefaultScreen( wsDisplay ); wsRootWin=RootWindow( wsDisplay,wsScreen ); wsMaxX=DisplayWidth( wsDisplay,wsScreen ); *************** *** 550,563 **** { case ClientMessage: if ( Event->xclient.message_type == wsWindowList[l]->AtomProtocols ) ! { if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomDeleteWindow ) { i=wsWindowClosed; goto expose; } if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomTakeFocus ) { 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; --- 554,570 ---- { case ClientMessage: if ( Event->xclient.message_type == wsWindowList[l]->AtomProtocols ) ! { if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomDeleteWindow ) { i=wsWindowClosed; goto expose; } if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomTakeFocus ) { 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,698 ---- } break; + case SelectionNotify: + /* Handle DandD */ + wsXDNDProcessSelection(wsWindowList[l],Event); + break; + } XFlush( wsDisplay ); XSync( wsDisplay,False );