Skip to content

Commit

Permalink
Fix the size of the window does not re-scale with the change of the g…
Browse files Browse the repository at this point in the history
…uiscale.
  • Loading branch information
Gasparoken committed Jul 12, 2023
1 parent c33e474 commit 8a6f781
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/modules/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ void load_window_pos(Window* window, const char* section,
if (get_multiple_displays()) {
Rect frame = get_config_rect(section, "WindowFrame", gfx::Rect());
if (!frame.isEmpty()) {
// Re-scale the window size.
frame.w *= guiscale();
frame.h *= guiscale();
limit_with_workarea(parentDisplay, frame);
window->loadNativeFrame(frame);
}
Expand All @@ -450,13 +453,19 @@ void save_window_pos(Window* window, const char* section)
if (!window->lastNativeFrame().isEmpty()) {
const os::Window* mainNativeWindow = manager->display()->nativeWindow();
rc = window->lastNativeFrame();
// De-scale the window size to save it normalized.
rc.w /= guiscale();
rc.h /= guiscale();
set_config_rect(section, "WindowFrame", rc);
rc.offset(-mainNativeWindow->frame().origin());
rc /= mainNativeWindow->scale();
}
else {
del_config_value(section, "WindowFrame");
rc = window->bounds();
// De-scale the window size to save it normalized.
rc.w /= guiscale();
rc.h /= guiscale();
}

set_config_rect(section, "WindowPos", rc);
Expand Down

0 comments on commit 8a6f781

Please sign in to comment.