Fix #9993: Handle DPI changes on macOS and Windows
This commit is contained in:
committed by
Michael Lutz
parent
bda602f4b0
commit
45d98f689a
@@ -1269,8 +1269,12 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
/** Screen the window is on changed. */
|
||||
- (void)windowDidChangeBackingProperties:(NSNotification *)notification
|
||||
{
|
||||
bool did_adjust = AdjustGUIZoom();
|
||||
|
||||
/* Reallocate screen buffer if necessary. */
|
||||
driver->AllocateBackingStore();
|
||||
|
||||
if (did_adjust) ReInitAllWindows(true);
|
||||
}
|
||||
|
||||
/** Presentation options to use for full screen mode. */
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
#define PM_QS_INPUT 0x20000
|
||||
#endif
|
||||
|
||||
#ifndef WM_DPICHANGED
|
||||
#define WM_DPICHANGED 0x02E0
|
||||
#endif
|
||||
|
||||
bool _window_maximize;
|
||||
static Dimension _bck_resolution;
|
||||
DWORD _imm_props;
|
||||
@@ -670,6 +674,24 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
auto did_adjust = AdjustGUIZoom();
|
||||
|
||||
/* Resize the window to match the new DPI setting. */
|
||||
RECT *prcNewWindow = (RECT *)lParam;
|
||||
SetWindowPos(hwnd,
|
||||
NULL,
|
||||
prcNewWindow->left,
|
||||
prcNewWindow->top,
|
||||
prcNewWindow->right - prcNewWindow->left,
|
||||
prcNewWindow->bottom - prcNewWindow->top,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
if (did_adjust) ReInitAllWindows(true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* needed for wheel */
|
||||
#if !defined(WM_MOUSEWHEEL)
|
||||
# define WM_MOUSEWHEEL 0x020A
|
||||
|
||||
Reference in New Issue
Block a user