diff Gui/mplayer/mw.h @ 6967:0fa27966ac47

add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
author pontscho
date Sun, 11 Aug 2002 13:12:38 +0000
parents e32d3d0d8998
children 7242f1840f8d
line wrap: on
line diff
--- a/Gui/mplayer/mw.h	Sun Aug 11 10:52:22 2002 +0000
+++ b/Gui/mplayer/mw.h	Sun Aug 11 13:12:38 2002 +0000
@@ -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 );
+
+}