Reposition window when changing dpi

This commit is contained in:
martinfouilleul 2023-02-08 18:51:26 +01:00
parent 3f58b2ac3d
commit c0601961f1
1 changed files with 16 additions and 1 deletions

View File

@ -262,7 +262,18 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam)
case WM_DPICHANGED:
{
printf("DPI changed!\n");
u32 dpi = HIWORD(wParam);
RECT rect = *(RECT*)lParam;
SetWindowPos(mpWindow->win32.hWnd,
HWND_TOP,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
SWP_NOACTIVATE | SWP_NOZORDER);
//TODO: send a message
} break;
@ -270,6 +281,8 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SIZING:
{
//TODO: take dpi into account
RECT* rect = (RECT*)lParam;
mp_event event = {0};
@ -281,6 +294,8 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOVING:
{
//TODO: take dpi into account
RECT* rect = (RECT*)lParam;
mp_event event = {0};