Backends: OSX: Fixed not submitting Monitors info when viewports are not enabled. (#7257)

This commit is contained in:
actboy168
2024-01-23 10:22:56 +08:00
committed by ocornut
parent eb42e164dd
commit 54ef4092a9
2 changed files with 3 additions and 1 deletions

View File

@@ -435,6 +435,7 @@ bool ImGui_ImplOSX_Init(NSView* view)
bd->Window = view.window ?: NSApp.orderedWindows.firstObject; bd->Window = view.window ?: NSApp.orderedWindows.firstObject;
ImGuiViewport* main_viewport = ImGui::GetMainViewport(); ImGuiViewport* main_viewport = ImGui::GetMainViewport();
main_viewport->PlatformHandle = main_viewport->PlatformHandleRaw = (__bridge_retained void*)bd->Window; main_viewport->PlatformHandle = main_viewport->PlatformHandleRaw = (__bridge_retained void*)bd->Window;
ImGui_ImplOSX_UpdateMonitors();
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
ImGui_ImplOSX_InitPlatformInterface(); ImGui_ImplOSX_InitPlatformInterface();
@@ -1088,7 +1089,6 @@ static void ImGui_ImplOSX_UpdateMonitors()
static void ImGui_ImplOSX_InitPlatformInterface() static void ImGui_ImplOSX_InitPlatformInterface()
{ {
ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_GetBackendData(); ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_GetBackendData();
ImGui_ImplOSX_UpdateMonitors();
// Register platform interface (will be coupled with a renderer interface) // Register platform interface (will be coupled with a renderer interface)
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();

View File

@@ -73,6 +73,8 @@ Docking+Viewports Branch:
- Added ImGuiDockNodeFlags_DockedWindowsInFocusRoute to automatically make a dockspace connect - Added ImGuiDockNodeFlags_DockedWindowsInFocusRoute to automatically make a dockspace connect
the focus route of its docked window. This is provided a convenience in case you have windows the focus route of its docked window. This is provided a convenience in case you have windows
where a connection is not explicit. (#6798) where a connection is not explicit. (#6798)
- Backends: OSX: Fixed not submitting Monitors info when viewports are not enabled, leading to
missing e.g. DpiScale info. (#7257) [@actboy168]
----------------------------------------------------------------------- -----------------------------------------------------------------------