]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Window mode status bar DPI change handling.
authorToni Wilen <twilen@winuae.net>
Sat, 23 Jan 2021 13:50:38 +0000 (15:50 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 23 Jan 2021 13:50:38 +0000 (15:50 +0200)
od-win32/dxwrap.h
od-win32/win32.cpp
od-win32/win32gfx.cpp

index 2672add95d089bb062ff3fd142586854c51a5ccc..d31dcbaca50396adba1f0e6bf086bce3e9a32b76 100644 (file)
@@ -110,6 +110,7 @@ struct AmigaMonitor {
        RECT amigawin_rect, mainwin_rect;
        RECT amigawinclip_rect;
        int window_extra_width, window_extra_height;
+       int window_extra_height_bar;
        int win_x_diff, win_y_diff;
        int setcursoroffset_x, setcursoroffset_y;
        int mouseposx, mouseposy;
@@ -118,7 +119,6 @@ struct AmigaMonitor {
        int ratio_width, ratio_height;
        int ratio_adjust_x, ratio_adjust_y;
        bool ratio_sizing;
-       int prevsbheight;
        bool render_ok, wait_render;
 
        int in_sizemove;
index 4c7bdf780ab895d4347842be2fb7e0b557812b63..8639a5198ba2d8464738978221e30397d07d424d 100644 (file)
@@ -2740,9 +2740,9 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                        LPMINMAXINFO lpmmi;
                        lpmmi = (LPMINMAXINFO)lParam;
                        lpmmi->ptMinTrackSize.x = 160 + mon->window_extra_width;
-                       lpmmi->ptMinTrackSize.y = 128 + mon->window_extra_height;
+                       lpmmi->ptMinTrackSize.y = 128 + mon->window_extra_height + mon->window_extra_height_bar;
                        lpmmi->ptMaxTrackSize.x = max_uae_width + mon->window_extra_width;
-                       lpmmi->ptMaxTrackSize.y = max_uae_height + mon->window_extra_height;
+                       lpmmi->ptMaxTrackSize.y = max_uae_height + mon->window_extra_height + mon->window_extra_height_bar;
                }
                return 0;
 
@@ -2793,9 +2793,9 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                                                        int w = mon->mainwin_rect.right - mon->mainwin_rect.left;
                                                        int h = mon->mainwin_rect.bottom - mon->mainwin_rect.top;
                                                        if (w != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.width + mon->window_extra_width ||
-                                                               h != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height + mon->window_extra_height) {
+                                                               h != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height + mon->window_extra_height + mon->window_extra_height_bar) {
                                                                        changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.width = w - mon->window_extra_width;
-                                                                       changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height = h - mon->window_extra_height;
+                                                                       changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height = h - (mon->window_extra_height + mon->window_extra_height_bar);
                                                                        set_config_changed();
                                                        }
                                                }
index d1588f74fc17e86150a893eef53e52af45dbdc2a..beab1e129cdb879070c1065d05ccf4d886e16e42 100644 (file)
@@ -2249,8 +2249,11 @@ static int getstatuswindowheight(int monid, HWND hwnd)
        if (!h)
                return def;
        wi.cbSize = sizeof wi;
-       if (GetWindowInfo (h, &wi))
+       if (GetWindowInfo(h, &wi)) {
+               int dpi = getdpiforwindow(h);
                def = wi.rcWindow.bottom - wi.rcWindow.top;
+               def = def * dpi / 96;
+       }
        DestroyWindow(h);
        return def;
 }
@@ -3690,18 +3693,18 @@ static int create_windows_2(struct AmigaMonitor *mon)
                        else
                                ny = rc.top + (rc.bottom - rc.top - nh);
                }
-               if (w != nw || h != nh || x != nx || y != ny || sbheight != mon->prevsbheight) {
+               if (w != nw || h != nh || x != nx || y != ny || sbheight != mon->window_extra_height_bar) {
                        w = nw;
                        h = nh;
                        x = nx;
                        y = ny;
+                       mon->window_extra_height_bar = sbheight;
                        mon->in_sizemove++;
-                       if (mon->hMainWnd && !fsw && !dxfs && !d3dfs && !rp_isactive ()) {
-                               mon->window_extra_height += (sbheight - mon->prevsbheight);
+                       if (mon->hMainWnd && !fsw && !dxfs && !d3dfs && !rp_isactive()) {
                                GetWindowRect(mon->hMainWnd, &r);
                                x = r.left;
                                y = r.top;
-                               SetWindowPos(mon->hMainWnd, HWND_TOP, x, y, w + mon->window_extra_width, h + mon->window_extra_height,
+                               SetWindowPos(mon->hMainWnd, HWND_TOP, x, y, w + mon->window_extra_width, h + mon->window_extra_height + mon->window_extra_height_bar,
                                        SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER);
                                x = gap;
                                y = gap;
@@ -3725,7 +3728,6 @@ static int create_windows_2(struct AmigaMonitor *mon)
                        mon->amigawin_rect.left, mon->amigawin_rect.top, mon->amigawin_rect.right - mon->amigawin_rect.left, mon->amigawin_rect.bottom - mon->amigawin_rect.top);
                updatemouseclip(mon);
                rp_screenmode_changed ();
-               mon->prevsbheight = sbheight;
                return 1;
        }
 
@@ -3823,14 +3825,18 @@ static int create_windows_2(struct AmigaMonitor *mon)
                                                rc.bottom -= sbheight;
                                                rc.bottom += sbheight2;
                                                sbheight = sbheight2;
+                                               DestroyWindow(mon->hMainWnd);
+                                               mon->hMainWnd = NULL;
                                                continue;
                                        }
                                }
                                break;
                        }
                        GetWindowRect(mon->hMainWnd, &rc2);
-                       mon->window_extra_width = rc2.right - rc2.left - mon->currentmode.current_width;
-                       mon->window_extra_height = rc2.bottom - rc2.top - mon->currentmode.current_height;
+                       mon->window_extra_width = (rc2.right - rc2.left) - mon->currentmode.current_width;
+                       mon->window_extra_height = (rc2.bottom - rc2.top) - mon->currentmode.current_height;
+                       mon->window_extra_height -= sbheight;
+                       mon->window_extra_height_bar = sbheight;
                        createstatuswindow(mon);
                        createstatusline(mon->monitor_id);
                } else {
@@ -3891,7 +3897,7 @@ static int create_windows_2(struct AmigaMonitor *mon)
        if (dxfs || d3dfs)
                movecursor (x + w / 2, y + h / 2);
        addnotifications (mon->hAmigaWnd, FALSE, FALSE);
-       mon->prevsbheight = sbheight;
+       mon->window_extra_height_bar = sbheight;
 
        if (mon->monitor_id) {
                ShowWindow(mon->hMainWnd, SW_SHOWNOACTIVATE);