From 8fd0a041355e3cfc6556bbe1e00f262d9a897946 Mon Sep 17 00:00:00 2001 From: Luca Lolli <920858+dashandslash@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:30:26 +0200 Subject: [PATCH] Backends: SDL3: Fix backend in docking/multi-viewports branch. (#6483) The definition has been renamed to SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED. Display scale is no longer available in SDL_DisplayMode but can be retrieved using SDL_GetDisplayContentScale. --- backends/imgui_impl_sdl3.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backends/imgui_impl_sdl3.cpp b/backends/imgui_impl_sdl3.cpp index 063170166..47fe49f24 100644 --- a/backends/imgui_impl_sdl3.cpp +++ b/backends/imgui_impl_sdl3.cpp @@ -306,7 +306,7 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event) case SDL_EVENT_DISPLAY_CONNECTED: case SDL_EVENT_DISPLAY_DISCONNECTED: case SDL_EVENT_DISPLAY_MOVED: - case SDL_EVENT_DISPLAY_SCALE_CHANGED: + case SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED: { bd->WantUpdateMonitors = true; return true; @@ -651,8 +651,7 @@ static void ImGui_ImplSDL3_UpdateMonitors() monitor.WorkSize = ImVec2((float)r.w, (float)r.h); // FIXME-VIEWPORT: On MacOS SDL reports actual monitor DPI scale, ignoring OS configuration. We may want to set // DpiScale to cocoa_window.backingScaleFactor here. - const SDL_DisplayMode* display_mode = SDL_GetCurrentDisplayMode(display_id); - monitor.DpiScale = display_mode->display_scale; + monitor.DpiScale = SDL_GetDisplayContentScale(display_id); monitor.PlatformHandle = (void*)(intptr_t)n; platform_io.Monitors.push_back(monitor); }