Skip to content

Commit

Permalink
osx hdpi fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
buggins committed Mar 7, 2024
1 parent 3f8494c commit 5b97f99
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/dlangui/core/events.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 ~= "";
Expand Down
2 changes: 1 addition & 1 deletion src/dlangui/core/types.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions src/dlangui/platforms/sdl/sdlapp.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1690,9 +1693,10 @@ int sdlmain(string[] args) {

Platform.setInstance(sdl);

sdlUpdateScreenDpi(0);

currentTheme = createDefaultTheme();

sdlUpdateScreenDpi(0);

Platform.instance.uiTheme = "theme_default";

Expand Down

0 comments on commit 5b97f99

Please sign in to comment.