win32: use USER_DEFAULT_SCREEN_DPI instead of explicit 96 value

This commit is contained in:
Dimitriy Ryazantcev
2023-12-21 14:47:56 +02:00
committed by Sam Lantinga
parent a2e05480d6
commit cb90653695
4 changed files with 6 additions and 8 deletions

View File

@@ -158,9 +158,6 @@ static int WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL m
{
SDL_VideoData *videodata = SDL_GetVideoDevice() ? SDL_GetVideoDevice()->driverdata : NULL;
RECT rect;
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
UINT frame_dpi;
#endif
/* Client rect, in points */
switch (rect_type) {
@@ -202,8 +199,9 @@ static int WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL m
/* With per-monitor v2, the window border/titlebar size depend on the DPI, so we need to call AdjustWindowRectExForDpi instead of
AdjustWindowRectEx. */
if (videodata) {
UINT frame_dpi;
SDL_WindowData *data = window->driverdata;
frame_dpi = (data && videodata->GetDpiForWindow) ? videodata->GetDpiForWindow(data->hwnd) : 96;
frame_dpi = (data && videodata->GetDpiForWindow) ? videodata->GetDpiForWindow(data->hwnd) : USER_DEFAULT_SCREEN_DPI;
if (videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, frame_dpi) == 0) {
return WIN_SetError("AdjustWindowRectExForDpi()");
}