diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-16 09:49:55 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-16 09:49:55 +0100 |
| commit | fd60e2241af0ebcb190a751a8be9699cbb87156b (patch) | |
| tree | 5607f5a1e0d96fb263e8accffcd558e54279d9a8 /src/unix/main_unix.cpp | |
| parent | 1e191607c478f2d6d78ae2b80855d05f877bd8bb (diff) | |
glfw drag drop
Diffstat (limited to 'src/unix/main_unix.cpp')
| -rw-r--r-- | src/unix/main_unix.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/unix/main_unix.cpp b/src/unix/main_unix.cpp index 8f4ac04..755b617 100644 --- a/src/unix/main_unix.cpp +++ b/src/unix/main_unix.cpp @@ -60,6 +60,15 @@ static void glfw_error_callback(int error, const char* description) fprintf(stderr, "GLFW Error %d: %s\n", error, description); } +static void drop_callback(GLFWwindow* window, int count, const char** paths) +{ + // We only accept 1 file for now.. + for (int i = 0; i < 1; i++) { + utf8ncpy(dragdrop_data.path, paths[i], MAX_INPUT_LENGTH); + dragdrop_data.did_drop = true; + } +} + // Main code int main(int, char**) { @@ -102,6 +111,7 @@ int main(int, char**) glfwSetWindowSizeLimits(window, 800, 600, GLFW_DONT_CARE, GLFW_DONT_CARE); glfwMakeContextCurrent(window); + glfwSetDropCallback(window, drop_callback); glfwSwapInterval(1); // Enable vsync IMGUI_CHECKVERSION(); |
