diff src/frame-x.c @ 179:9ad43877534d r20-3b16

Import from CVS: tag r20-3b16
author cvs
date Mon, 13 Aug 2007 09:52:19 +0200
parents 6075d714658b
children e121b013d1f0
line wrap: on
line diff
--- a/src/frame-x.c	Mon Aug 13 09:51:18 2007 +0200
+++ b/src/frame-x.c	Mon Aug 13 09:52:19 2007 +0200
@@ -366,9 +366,9 @@
 	return;
       f = XFRAME (XCAR (rest));
 
-#ifndef HAVE_WINDOWMAKER
+#ifndef HAVE_SESSION
       x_wm_maybe_store_wm_command (f);
-#endif /* HAVE_WINDOWMAKER */
+#endif /* HAVE_SESSION */
 
     }
 }
@@ -1178,32 +1178,61 @@
 
   Lisp_Object path = Qnil;
   Lisp_Object frame = Qnil;
+  Lisp_Object dnd_data = Qnil;
+  Lisp_Object dnd_type = Qnil;
 
-  struct gcpro gcpro1, gcpro2;
+  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
   Type = DndDataType (event); 
-  if ((Type != DndFile) && (Type != DndFiles) && (Type != DndExe))
-    return;
+  if (Type < 0)  /* pseudo event produces -1 as type */
+    {
+      stderr_out("DndDropHandler: pseudo drop received\n");
+      return;
+    }
+
   DndGetData (&Data, &Size);
   
-  GCPRO2 (path, frame);
+  GCPRO4 (path, frame, dnd_data, dnd_type);
 
   frame = make_frame ((struct frame *) data);
 
-  if (Type == DndFiles)
+  stderr_out("DndDropHandler: real drop received (T%d Sl%d)\n",Type,Size);
+  
+  switch (Type)
     {
+    case DndFiles:
       while (*Data)
 	{
 	  len = strlen ((char*) Data);
-	  path = make_string ((char*) Data, len);
+	  path = make_ext_string ((char*) Data, len, FORMAT_FILENAME);
 	  va_run_hook_with_args (Qdrag_and_drop_functions, 2, frame, path);
 	  Data += len+1;
 	}
-    }
-  else
-    {
-      path = make_string ((char*) Data, strlen (Data));    
+      break;
+    case DndFile:
+      path = make_ext_string ((char*) Data, strlen(Data), FORMAT_FILENAME);
       va_run_hook_with_args (Qdrag_and_drop_functions, 2, frame, path);
+      break;
+    case DndText:
+      dnd_data = make_ext_string ((char *) Data, strlen(Data), FORMAT_FILENAME);
+      va_run_hook_with_args (Qdrag_and_drop_functions, 3, frame, path, dnd_data);
+      break;
+    case DndDir:
+    case DndLink:
+    case DndExe:
+    case DndURL:
+    case DndMIME:
+      dnd_type = make_int (Type);
+      dnd_data = make_ext_string ((char*) Data, strlen(Data), FORMAT_FILENAME);
+      va_run_hook_with_args (Qdrag_and_drop_functions, 4,
+			     frame, path, dnd_data, dnd_type);
+      break;
+    default: /* Unknown, RawData and any other type */
+      dnd_type = make_int (Type);
+      dnd_data = make_ext_string ((char*) Data, Size, FORMAT_BINARY);
+      va_run_hook_with_args (Qdrag_and_drop_functions, 4,
+			     frame, path, dnd_data, dnd_type);
+      break;
     }
 
   UNGCPRO;
@@ -1870,9 +1899,9 @@
 	/* tell the window manager about us. */
 	x_wm_store_class_hints (shell_widget, XtName (frame_widget));
 
-#ifndef HAVE_WINDOWMAKER
+#ifndef HAVE_SESSION
 	x_wm_maybe_store_wm_command (f);
-#endif /* HAVE_WINDOWMAKER */
+#endif /* HAVE_SESSION */
 
 	x_wm_hack_wm_protocols (shell_widget);
       }
@@ -2447,10 +2476,10 @@
   Widget w = FRAME_X_SHELL_WIDGET (f);
   Lisp_Object popup, frame;
 
-#ifndef HAVE_WINDOWMAKER
+#ifndef HAVE_SESSION
   if (FRAME_X_TOP_LEVEL_FRAME_P (f))
     x_wm_maybe_move_wm_command (f);
-#endif /* HAVE_WINDOWMAKER */
+#endif /* HAVE_SESSION */
 
   /* Frames with the popup property are using other frames as their
      widget parent.  Deleting them are their parent has already been