mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-22 15:19:18 -05:00
Update rcore_desktop_win32.c
This commit is contained in:
@ -1877,13 +1877,23 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
|||||||
} break;
|
} break;
|
||||||
case WM_DPICHANGED:
|
case WM_DPICHANGED:
|
||||||
{
|
{
|
||||||
|
// Get current dpi scale factor
|
||||||
|
float scalex = HIWORD(wParam)/96.0f;
|
||||||
|
float scaley = LOWORD(wParam)/96.0f;
|
||||||
|
|
||||||
RECT *suggestedRect = (RECT *)lparam;
|
RECT *suggestedRect = (RECT *)lparam;
|
||||||
|
|
||||||
// Never set the window size to anything other than the suggested rect here
|
// Never set the window size to anything other than the suggested rect here
|
||||||
// Doing so can cause a window to stutter between monitors when transitioning between them
|
// Doing so can cause a window to stutter between monitors when transitioning between them
|
||||||
int result = (int)SetWindowPos(hwnd, NULL, suggestedRect->left, suggestedRect->top,
|
int result = (int)SetWindowPos(hwnd, NULL,
|
||||||
suggestedRect->right - suggestedRect->left, suggestedRect->bottom - suggestedRect->top, SWP_NOZORDER | SWP_NOACTIVATE);
|
suggestedRect->left, suggestedRect->top,
|
||||||
|
suggestedRect->right - suggestedRect->left,
|
||||||
|
suggestedRect->bottom - suggestedRect->top,
|
||||||
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
|
||||||
if (result == 0) TRACELOG(LOG_ERROR, "Failed to set window position [ERROR: %lu]", GetLastError());
|
if (result == 0) TRACELOG(LOG_ERROR, "Failed to set window position [ERROR: %lu]", GetLastError());
|
||||||
|
|
||||||
|
// TODO: Update screen data, render size, screen scaling, viewport...
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
|
|||||||
Reference in New Issue
Block a user