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.
This commit is contained in:
Luca Lolli 2023-06-01 11:30:26 +02:00 committed by GitHub
parent 823a1385a2
commit 8fd0a04135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}