From 01cc2b91e189e4d268eddd38f3ba917133a07adc Mon Sep 17 00:00:00 2001
From: Steel Titanium <steeltitanium1@gmail.com>
Date: Thu, 19 Dec 2019 22:11:45 -0500
Subject: [PATCH] Drag and drop file event

---
 src/sdl/i_video.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index c876a323f..5ba0c166a 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -853,6 +853,7 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
 void I_GetEvent(void)
 {
 	SDL_Event evt;
+	char* dropped_filedir;
 	// We only want the first motion event,
 	// otherwise we'll end up catching the warp back to center.
 	//int mouseMotionOnce = 0;
@@ -1029,6 +1030,11 @@ void I_GetEvent(void)
 				if (currentMenu == &OP_JoystickSetDef)
 					M_SetupJoystickMenu(0);
 			 	break;
+			case SDL_DROPFILE:
+				dropped_filedir = evt.drop.file;
+				COM_BufInsertText(va("addfile \"%s\"", dropped_filedir));
+				SDL_free(dropped_filedir);    // Free dropped_filedir memory
+				break;
 			case SDL_QUIT:
 				I_Quit();
 				M_QuitResponse('y');
-- 
GitLab