added experimental (cross-platform) drag and drop test code
[rocksndiamonds.git] / src / events.c
index e770480d67a25c14b0b0e7f0bb3fd57172cba206..f8a888ade1161aafedc37b655bd711f8a5d9858b 100644 (file)
@@ -268,6 +268,14 @@ void HandleOtherEvents(Event *event)
       HandleJoystickEvent(event);
       break;
 
+    case SDL_DROPFILE:
+      HandleDropFileEvent(event);
+      break;
+
+    case SDL_DROPTEXT:
+      HandleDropTextEvent(event);
+      break;
+
     default:
       break;
   }
@@ -1518,6 +1526,30 @@ void HandleClientMessageEvent(ClientMessageEvent *event)
     CloseAllAndExit(0);
 }
 
+static void HandleDropFileEventExt(char *filename)
+{
+  Error(ERR_DEBUG, "DROP FILE EVENT: '%s'", filename);
+}
+
+static void HandleDropTextEventExt(char *text)
+{
+  Error(ERR_DEBUG, "DROP TEXT EVENT: '%s'", text);
+}
+
+void HandleDropFileEvent(Event *event)
+{
+  HandleDropFileEventExt(event->drop.file);
+
+  SDL_free(event->drop.file);
+}
+
+void HandleDropTextEvent(Event *event)
+{
+  HandleDropTextEventExt(event->drop.file);
+
+  SDL_free(event->drop.file);
+}
+
 void HandleButton(int mx, int my, int button, int button_nr)
 {
   static int old_mx = 0, old_my = 0;