|
@@ -21,6 +21,7 @@
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
|
|
+// 2023-03-16: Inputs: Fixed key modifiers handling on secondary viewports (docking branch). Broken on 2023/01/04. (#6248, #6034)
|
|
|
// 2023-03-14: Emscripten: Avoid using glfwGetError() and glfwGetGamepadState() which are not correctly implemented in Emscripten emulation. (#6240)
|
|
|
// 2023-02-03: Emscripten: Registering custom low-level mouse wheel handler to get more accurate scrolling impulses on Emscripten. (#4019, #6096)
|
|
|
// 2023-01-18: Handle unsupported glfwGetVideoMode() call on e.g. Emscripten.
|
|
@@ -298,14 +299,13 @@ static ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int key)
|
|
|
|
|
|
// X11 does not include current pressed/released modifier key in 'mods' flags submitted by GLFW
|
|
|
// See https://github.com/ocornut/imgui/issues/6034 and https://github.com/glfw/glfw/issues/1630
|
|
|
-static void ImGui_ImplGlfw_UpdateKeyModifiers()
|
|
|
+static void ImGui_ImplGlfw_UpdateKeyModifiers(GLFWwindow* window)
|
|
|
{
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
- ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
|
|
- io.AddKeyEvent(ImGuiMod_Ctrl, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS));
|
|
|
- io.AddKeyEvent(ImGuiMod_Shift, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS));
|
|
|
- io.AddKeyEvent(ImGuiMod_Alt, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_ALT) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS));
|
|
|
- io.AddKeyEvent(ImGuiMod_Super, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS));
|
|
|
+ io.AddKeyEvent(ImGuiMod_Ctrl, (glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS));
|
|
|
+ io.AddKeyEvent(ImGuiMod_Shift, (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS));
|
|
|
+ io.AddKeyEvent(ImGuiMod_Alt, (glfwGetKey(window, GLFW_KEY_LEFT_ALT) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS));
|
|
|
+ io.AddKeyEvent(ImGuiMod_Super, (glfwGetKey(window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS));
|
|
|
}
|
|
|
|
|
|
static bool ImGui_ImplGlfw_ShouldChainCallback(GLFWwindow* window)
|
|
@@ -320,7 +320,7 @@ void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int acti
|
|
|
if (bd->PrevUserCallbackMousebutton != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
|
|
bd->PrevUserCallbackMousebutton(window, button, action, mods);
|
|
|
|
|
|
- ImGui_ImplGlfw_UpdateKeyModifiers();
|
|
|
+ ImGui_ImplGlfw_UpdateKeyModifiers(window);
|
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
if (button >= 0 && button < ImGuiMouseButton_COUNT)
|
|
@@ -384,7 +384,7 @@ void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int keycode, int scancode, i
|
|
|
if (action != GLFW_PRESS && action != GLFW_RELEASE)
|
|
|
return;
|
|
|
|
|
|
- ImGui_ImplGlfw_UpdateKeyModifiers();
|
|
|
+ ImGui_ImplGlfw_UpdateKeyModifiers(window);
|
|
|
|
|
|
if (keycode >= 0 && keycode < IM_ARRAYSIZE(bd->KeyOwnerWindows))
|
|
|
bd->KeyOwnerWindows[keycode] = (action == GLFW_PRESS) ? window : nullptr;
|