From 5b97f998822d31ed65ad8cbb65ff3283a9be39bd Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 7 Mar 2024 12:14:14 +0000 Subject: [PATCH] osx hdpi fixes --- src/dlangui/core/events.d | 8 ++++---- src/dlangui/core/types.d | 2 +- src/dlangui/platforms/sdl/sdlapp.d | 8 ++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/dlangui/core/events.d b/src/dlangui/core/events.d index 860adec91..87c145078 100644 --- a/src/dlangui/core/events.d +++ b/src/dlangui/core/events.d @@ -52,13 +52,13 @@ struct Accelerator { version (OSX) { static if (true) { if (keyFlags & KeyFlag.Control) - buf ~= "Ctrl+"; + buf ~= "⌃ "; //"Ctrl+"; if (keyFlags & KeyFlag.Shift) - buf ~= "Shift+"; + buf ~= "⇧ "; //"Shift+"; if (keyFlags & KeyFlag.Option) - buf ~= "Opt+"; + buf ~= "⌥ "; //"Opt+"; if (keyFlags & KeyFlag.Command) - buf ~= "Cmd+"; + buf ~= "⌘ "; //"Cmd+"; } else { if (keyFlags & KeyFlag.Control) buf ~= "⌃"; diff --git a/src/dlangui/core/types.d b/src/dlangui/core/types.d index e7f8d7bb5..2d7f21685 100644 --- a/src/dlangui/core/types.d +++ b/src/dlangui/core/types.d @@ -348,7 +348,7 @@ private __gshared int PRIVATE_SCREEN_DPI_OVERRIDE = 0; return PRIVATE_SCREEN_DPI_OVERRIDE ? PRIVATE_SCREEN_DPI_OVERRIDE : PRIVATE_SCREEN_DPI; } -/// get screen DPI detection override value, if non 0 - this value is used instead of DPI detected by platform, if 0, value detected by platform will be used) +/// get screen DPI detection override value, if non 0 - this value is used instead of DPI detected by platform, if 0, value detected by platform will be used @property int overrideScreenDPI() { return PRIVATE_SCREEN_DPI_OVERRIDE; } diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index 9f4ac325f..1d5b784fc 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -1618,8 +1618,11 @@ bool sdlUpdateScreenDpi(int displayIndex = 0) { if (numDisplays < displayIndex + 1) return false; float hdpi = 0; - if (SDL_GetDisplayDPI(displayIndex, null, &hdpi, null)) + float ddpi = 0; + float vdpi = 0; + if (SDL_GetDisplayDPI(displayIndex, &ddpi, &hdpi, &vdpi)) return false; + Log.d("SDL_GetDisplayDPI(", displayIndex, ") : ddpi=", ddpi, " hdpi=", hdpi, " vdpi=", vdpi); int idpi = cast(int)hdpi; if (idpi < 32 || idpi > 2000) return false; @@ -1690,9 +1693,10 @@ int sdlmain(string[] args) { Platform.setInstance(sdl); + sdlUpdateScreenDpi(0); + currentTheme = createDefaultTheme(); - sdlUpdateScreenDpi(0); Platform.instance.uiTheme = "theme_default";