Improved (and hopefully, properly fixed) window size and position restoring when returning back from full screen if the window is resizable and set to remember the size and position.

This commit is contained in:
OBattler
2020-12-26 17:21:38 +01:00
parent 0c3eeeb591
commit 9f5c60c1bc
2 changed files with 9 additions and 5 deletions

View File

@@ -102,7 +102,7 @@ extern HANDLE ghMutex;
extern LCID lang_id;
extern HICON hIcon[256];
extern RECT oldclip;
extern int sbar_height;
extern int sbar_height, user_resize;
// extern int status_is_open;

View File

@@ -811,8 +811,11 @@ plat_setfullscreen(int on)
if (vid_resize) {
/* scale the screen base on DPI */
if (window_remember) {
temp_x = window_w;
temp_y = window_h;
MoveWindow(hwndMain, window_x, window_y, window_w, window_h, TRUE);
GetClientRect(hwndMain, &rect);
temp_x = rect.right - rect.left + 1;
temp_y = rect.bottom - rect.top + 1 - sbar_height;
} else {
if (dpi_scale) {
temp_x = MulDiv(unscaled_size_x, dpi, 96);
@@ -821,9 +824,10 @@ plat_setfullscreen(int on)
temp_x = unscaled_size_x;
temp_y = unscaled_size_y;
}
/* Main Window. */
ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height);
}
/* Main Window. */
ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height);
/* Render window. */
MoveWindow(hwndRender, 0, 0, temp_x, temp_y, TRUE);