ref: 0182ab6eb3cb445065b2100f6cfc35d8780016ce
parent: b3591ba3da395a9dcd790b312df1751e7cf45bad
author: Clownacy <[email protected]>
date: Wed Apr 1 17:43:04 EDT 2020
Get drag-and-drop working again
--- a/src/Backends/Platform.h
+++ b/src/Backends/Platform.h
@@ -11,6 +11,7 @@
void PlatformBackend_HideMouse(void);
void PlatformBackend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height);
void PlatformBackend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height);
+void PlaybackBackend_EnableDragAndDrop(void);
BOOL PlatformBackend_SystemTask(void);
void PlatformBackend_ShowMessageBox(const char *title, const char *message);
unsigned long PlatformBackend_GetTicks(void);
--- a/src/Backends/Platform/GLFW3.cpp
+++ b/src/Backends/Platform/GLFW3.cpp
@@ -217,6 +217,13 @@
Backend_HandleWindowResize(width, height);
}
+static void DragAndDropCallback(GLFWwindow *window, int count, const char **paths)
+{
+ (void)window;
+
+ LoadProfile(paths[0]);
+}
+
void PlatformBackend_Init(void)
{
glfwInit();
@@ -311,6 +318,11 @@
free(rgba_pixels);
}
+}
+
+void PlaybackBackend_EnableDragAndDrop(void)
+{
+ glfwSetDropCallback(window, DragAndDropCallback);
}
BOOL PlatformBackend_SystemTask(void)
--- a/src/Backends/Platform/SDL2.cpp
+++ b/src/Backends/Platform/SDL2.cpp
@@ -85,6 +85,11 @@
SDL_SetCursor(cursor);
}
+void PlaybackBackend_EnableDragAndDrop(void)
+{
+ SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
+}
+
BOOL PlatformBackend_SystemTask(void)
{
while (SDL_PollEvent(NULL) || !bActive)
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -270,7 +270,7 @@
}
#ifdef DEBUG_SAVE
- //SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
+ PlaybackBackend_EnableDragAndDrop();
#endif
// Set up window icon