From ee8fd5325a911a1ac11e4d2bbc1455e6c79e3285 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 8 Jul 2025 13:38:37 +0200 Subject: [PATCH] Backends: OSX: Fixed multi-viewport handling broken in 1.92.0. (#8644, #8777) --- backends/imgui_impl_osx.mm | 11 ++--------- docs/CHANGELOG.txt | 2 ++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/backends/imgui_impl_osx.mm b/backends/imgui_impl_osx.mm index 0e4a17f58..a07f20e9f 100644 --- a/backends/imgui_impl_osx.mm +++ b/backends/imgui_impl_osx.mm @@ -34,6 +34,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2025-XX-XX: Added support for multiple windows via the ImGuiPlatformIO interface. +// 2025-07-08: [Docking] Fixed multi-viewport handling broken on 2025-06-02. (#8644, #8777) // 2025-06-27: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursor support. // 2025-06-12: ImGui_ImplOSX_HandleEvent() only process event for window containing our view. (#8644) // 2025-05-15: [Docking] Add Platform_GetWindowFramebufferScale() handler, to allow varying Retina display density on multiple monitors. @@ -701,12 +702,7 @@ static ImGuiMouseSource GetMouseSource(NSEvent* event) static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) { // Only process events from the window containing ImGui view - void* event_handle = (__bridge void*)(event.window); - void* view_handle = (__bridge void*)(view.window); - if (event_handle == nullptr || view_handle == nullptr) - return false; - ImGuiViewport* viewport = ImGui::FindViewportByPlatformHandle(view_handle); - if (viewport == nullptr || viewport->PlatformHandleRaw != event_handle) + if (!ImGui::FindViewportByPlatformHandle((__bridge void*)event.window)) return false; ImGuiIO& io = ImGui::GetIO(); @@ -951,9 +947,6 @@ static void ImGui_ImplOSX_CreateWindow(ImGuiViewport* viewport) static void ImGui_ImplOSX_DestroyWindow(ImGuiViewport* viewport) { - NSWindow* window = (__bridge_transfer NSWindow*)viewport->PlatformHandleRaw; - window = nil; - if (ImGui_ImplOSX_ViewportData* vd = (ImGui_ImplOSX_ViewportData*)viewport->PlatformUserData) { NSWindow* window = vd->Window; diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 37b1474ba..8c0963570 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -63,6 +63,8 @@ Other changes: Docking+Viewports Branch: +- Backends: OSX: Fixed multi-viewport handling broken in 1.92.0. (#8644, #8777) [@cfillion] + ----------------------------------------------------------------------- VERSION 1.92.0 (Released 2025-06-25)