Skip to content

Commit

Permalink
Handle WM_DPICHANGED
Browse files Browse the repository at this point in the history
  • Loading branch information
Spodi committed Nov 9, 2023
1 parent c75ff36 commit 3a700a4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/graphic/Fast3D/gfx_dxgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,16 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par
case WM_CLOSE:
dxgi.is_running = false;
break;
case WM_DPICHANGED: {
RECT* const prcNewWindow = (RECT*)l_param;
SetWindowPos(h_wnd, NULL, prcNewWindow->left, prcNewWindow->top, prcNewWindow->right - prcNewWindow->left,
prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE);
dxgi.posX = prcNewWindow->left;
dxgi.posY = prcNewWindow->top;
dxgi.current_width = prcNewWindow->right - prcNewWindow->left;
dxgi.current_height = prcNewWindow->bottom - prcNewWindow->top;
break;
}
case WM_ENDSESSION:
// This hopefully gives the game a chance to shut down, before windows kills it.
if (w_param == TRUE) {
Expand Down

0 comments on commit 3a700a4

Please sign in to comment.