|
@@ -29,6 +29,7 @@
|
|
// CHANGELOG
|
|
// CHANGELOG
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
|
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
|
|
|
+// 2024-11-05: [Docking] Added Linux workaround for spurious mouse up events emitted while dragging and creating new viewport. (#3158, #7733, #7922)
|
|
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
|
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
|
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
|
|
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
|
|
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
|
|
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
|
|
@@ -172,6 +173,8 @@ struct ImGui_ImplGlfw_Data
|
|
double Time;
|
|
double Time;
|
|
GLFWwindow* MouseWindow;
|
|
GLFWwindow* MouseWindow;
|
|
GLFWcursor* MouseCursors[ImGuiMouseCursor_COUNT];
|
|
GLFWcursor* MouseCursors[ImGuiMouseCursor_COUNT];
|
|
|
|
+ bool MouseIgnoreButtonUpWaitForFocusLoss;
|
|
|
|
+ bool MouseIgnoreButtonUp;
|
|
ImVec2 LastValidMousePos;
|
|
ImVec2 LastValidMousePos;
|
|
GLFWwindow* KeyOwnerWindows[GLFW_KEY_LAST];
|
|
GLFWwindow* KeyOwnerWindows[GLFW_KEY_LAST];
|
|
bool InstalledCallbacks;
|
|
bool InstalledCallbacks;
|
|
@@ -367,6 +370,10 @@ void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int acti
|
|
if (bd->PrevUserCallbackMousebutton != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
|
if (bd->PrevUserCallbackMousebutton != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
|
bd->PrevUserCallbackMousebutton(window, button, action, mods);
|
|
bd->PrevUserCallbackMousebutton(window, button, action, mods);
|
|
|
|
|
|
|
|
+ // Workaround for Linux: ignore mouse up events which are following an focus loss following a viewport creation
|
|
|
|
+ if (bd->MouseIgnoreButtonUp && action == GLFW_RELEASE)
|
|
|
|
+ return;
|
|
|
|
+
|
|
ImGui_ImplGlfw_UpdateKeyModifiers(window);
|
|
ImGui_ImplGlfw_UpdateKeyModifiers(window);
|
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
@@ -451,6 +458,10 @@ void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused)
|
|
if (bd->PrevUserCallbackWindowFocus != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
|
if (bd->PrevUserCallbackWindowFocus != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
|
bd->PrevUserCallbackWindowFocus(window, focused);
|
|
bd->PrevUserCallbackWindowFocus(window, focused);
|
|
|
|
|
|
|
|
+ // Workaround for Linux: when losing focus with MouseIgnoreButtonUpWaitForFocusLoss set, we will temporarily ignore subsequent Mouse Up events
|
|
|
|
+ bd->MouseIgnoreButtonUp = (bd->MouseIgnoreButtonUpWaitForFocusLoss && focused == 0);
|
|
|
|
+ bd->MouseIgnoreButtonUpWaitForFocusLoss = false;
|
|
|
|
+
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
io.AddFocusEvent(focused != 0);
|
|
io.AddFocusEvent(focused != 0);
|
|
}
|
|
}
|
|
@@ -965,6 +976,7 @@ void ImGui_ImplGlfw_NewFrame()
|
|
io.DeltaTime = bd->Time > 0.0 ? (float)(current_time - bd->Time) : (float)(1.0f / 60.0f);
|
|
io.DeltaTime = bd->Time > 0.0 ? (float)(current_time - bd->Time) : (float)(1.0f / 60.0f);
|
|
bd->Time = current_time;
|
|
bd->Time = current_time;
|
|
|
|
|
|
|
|
+ bd->MouseIgnoreButtonUp = false;
|
|
ImGui_ImplGlfw_UpdateMouseData();
|
|
ImGui_ImplGlfw_UpdateMouseData();
|
|
ImGui_ImplGlfw_UpdateMouseCursor();
|
|
ImGui_ImplGlfw_UpdateMouseCursor();
|
|
|
|
|
|
@@ -1104,6 +1116,11 @@ static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport)
|
|
ImGui_ImplGlfw_ViewportData* vd = IM_NEW(ImGui_ImplGlfw_ViewportData)();
|
|
ImGui_ImplGlfw_ViewportData* vd = IM_NEW(ImGui_ImplGlfw_ViewportData)();
|
|
viewport->PlatformUserData = vd;
|
|
viewport->PlatformUserData = vd;
|
|
|
|
|
|
|
|
+ // Workaround for Linux: ignore mouse up events corresponding to losing focus of the previously focused window (#7733, #3158, #7922)
|
|
|
|
+#ifdef __linux__
|
|
|
|
+ bd->MouseIgnoreButtonUpWaitForFocusLoss = true;
|
|
|
|
+#endif
|
|
|
|
+
|
|
// GLFW 3.2 unfortunately always set focus on glfwCreateWindow() if GLFW_VISIBLE is set, regardless of GLFW_FOCUSED
|
|
// GLFW 3.2 unfortunately always set focus on glfwCreateWindow() if GLFW_VISIBLE is set, regardless of GLFW_FOCUSED
|
|
// With GLFW 3.3, the hint GLFW_FOCUS_ON_SHOW fixes this problem
|
|
// With GLFW 3.3, the hint GLFW_FOCUS_ON_SHOW fixes this problem
|
|
glfwWindowHint(GLFW_VISIBLE, false);
|
|
glfwWindowHint(GLFW_VISIBLE, false);
|