1
0
mirror of synced 2025-01-18 09:04:52 +01:00

fix: Dropping files onto ImHex opening them twice

This commit is contained in:
WerWolv 2024-01-20 21:03:46 +01:00
parent 52fda5aeb7
commit 3e5967c5a7
4 changed files with 21 additions and 7 deletions

View File

@ -86,6 +86,13 @@ namespace hex {
RequestChangeTheme::post(hex::containsIgnoreCase(result, "uint32 1") ? "Light" : "Dark");
});
// Register file drop callback
glfwSetDropCallback(m_window, [](GLFWwindow *, int count, const char **paths) {
for (int i = 0; i < count; i++) {
EventFileDropped::post(reinterpret_cast<const char8_t *>(paths[i]));
}
});
if (themeFollowSystem)
EventOSThemeChanged::post();
}

View File

@ -52,6 +52,13 @@ namespace hex {
if (themeFollowSystem)
EventOSThemeChanged::post();
// Register file drop callback
glfwSetDropCallback(m_window, [](GLFWwindow *, int count, const char **paths) {
for (int i = 0; i < count; i++) {
EventFileDropped::post(reinterpret_cast<const char8_t *>(paths[i]));
}
});
setupMacosWindowStyle(m_window);
}

View File

@ -71,6 +71,13 @@ namespace hex {
RequestChangeTheme::post(!isDarkModeEnabled() ? "Light" : "Dark");
});
// Register file drop callback
glfwSetDropCallback(m_window, [](GLFWwindow *, int count, const char **paths) {
for (int i = 0; i < count; i++) {
EventFileDropped::post(reinterpret_cast<const char8_t *>(paths[i]));
}
});
if (themeFollowSystem)
EventOSThemeChanged::post();
}

View File

@ -1131,13 +1131,6 @@ namespace hex {
EventWindowClosing::post(window);
});
// Register file drop callback
glfwSetDropCallback(m_window, [](GLFWwindow *, int count, const char **paths) {
for (int i = 0; i < count; i++) {
EventFileDropped::post(reinterpret_cast<const char8_t *>(paths[i]));
}
});
glfwSetWindowSizeLimits(m_window, 480_scaled, 360_scaled, GLFW_DONT_CARE, GLFW_DONT_CARE);
glfwShowWindow(m_window);