[Mplayer-cvslog] CVS: main/Gui/mplayer mplayer.c,1.33,1.34 mw.h,1.74,1.75 play.c,1.71,1.72

Zoltan Ponekker pontscho at mplayerhq.hu
Sun Aug 11 15:12:40 CEST 2002


Update of /cvsroot/mplayer/main/Gui/mplayer
In directory mail:/var/tmp.root/cvs-serv32452/mplayer

Modified Files:
	mplayer.c mw.h play.c 
Log Message:
add xdnd support (from Gregory Kovriga <gkovriga at techunix.technion.ac.il>) and fix -subdelay bug

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mplayer.c	5 Aug 2002 01:14:14 -0000	1.33
+++ mplayer.c	11 Aug 2002 13:12:38 -0000	1.34
@@ -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 @@
 
  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 @@
   wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
 
  wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
+ wsXDNDMakeAwareness(&appMPlayer.mainWindow);
 
  mplMenuInit();
 
@@ -94,10 +100,12 @@
  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 );

Index: mw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.h,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- mw.h	4 Aug 2002 20:44:15 -0000	1.74
+++ mw.h	11 Aug 2002 13:12:38 -0000	1.75
@@ -650,3 +650,45 @@
    }
  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 );
+
+}

Index: play.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- play.c	5 Aug 2002 01:14:14 -0000	1.71
+++ play.c	11 Aug 2002 13:12:38 -0000	1.72
@@ -246,8 +246,11 @@
 
 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 );




More information about the MPlayer-cvslog mailing list