Browse Source

Backends: OSX: fixed ImGui_ImplOSX_GetWindowSize and ConvertNSRect. (#6009)

Mikko Sivulainen 2 years ago
parent
commit
16aaf60697
2 changed files with 7 additions and 2 deletions
  1. 2 2
      backends/imgui_impl_osx.mm
  2. 5 0
      docs/CHANGELOG.txt

+ 2 - 2
backends/imgui_impl_osx.mm

@@ -816,7 +816,7 @@ struct ImGuiViewportDataOSX
 
 static void ConvertNSRect(NSScreen* screen, NSRect* r)
 {
-    r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
+    r->origin.y = screen.frame.size.height - r->origin.y - r->size.height;
 }
 
 static void ImGui_ImplOSX_CreateWindow(ImGuiViewport* viewport)
@@ -924,7 +924,7 @@ static ImVec2 ImGui_ImplOSX_GetWindowSize(ImGuiViewport* viewport)
 
     NSWindow* window = data->Window;
     NSSize size = window.contentLayoutRect.size;
-    return ImVec2(size.width, size.width);
+    return ImVec2(size.width, size.height);
 }
 
 static void ImGui_ImplOSX_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)

+ 5 - 0
docs/CHANGELOG.txt

@@ -144,6 +144,11 @@ Other changes:
 - Misc: fixed compile-time detection of SSE features on MSVC 32-bits builds. (#5943) [@TheMostDiligent]
 - Backends: Allegro5: restoring using al_draw_indexed_prim() when Allegro version is >= 5.2.5. (#5937) [@Espyo]
 
+Docking+Viewports Branch:
+
+- Backends: OSX: fixed typo in ImGui_ImplOSX_GetWindowSize that would cause issues when resiing
+  from OS decorations, if they are enabled on secondary viewports. (#6009) [@sivu]
+
 
 -----------------------------------------------------------------------
  VERSION 1.89.1 (Released 2022-11-24)