SDL: win32: use USER_DEFAULT_SCREEN_DPI instead of explicit 96 value

From cb90653695aadb193f163ddde9a684b333298d14 Mon Sep 17 00:00:00 2001
From: Dimitriy Ryazantcev <[EMAIL REDACTED]>
Date: Thu, 21 Dec 2023 14:47:56 +0200
Subject: [PATCH] win32: use USER_DEFAULT_SCREEN_DPI instead of explicit 96
 value

---
 src/video/windows/SDL_windowsevents.c | 2 +-
 src/video/windows/SDL_windowsmodes.c  | 4 ++--
 src/video/windows/SDL_windowsmouse.c  | 2 +-
 src/video/windows/SDL_windowswindow.c | 6 ++----
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 3a8c89337f28..89e05cd50254 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -948,7 +948,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
             UINT dpi;
 
-            dpi = 96;
+            dpi = USER_DEFAULT_SCREEN_DPI;
             size.top = 0;
             size.left = 0;
             size.bottom = h;
diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c
index 1845c452bd4f..8f01bf0060ab 100644
--- a/src/video/windows/SDL_windowsmodes.c
+++ b/src/video/windows/SDL_windowsmodes.c
@@ -186,9 +186,9 @@ static float WIN_GetContentScale(SDL_VideoDevice *_this, HMONITOR hMonitor)
     }
     if (dpi == 0) {
         /* Safe default */
-        dpi = 96;
+        dpi = USER_DEFAULT_SCREEN_DPI;
     }
-    return dpi / 96.0f;
+    return dpi / (float)USER_DEFAULT_SCREEN_DPI;
 }
 
 static SDL_bool WIN_GetDisplayMode(SDL_VideoDevice *_this, HMONITOR hMonitor, LPCWSTR deviceName, DWORD index, SDL_DisplayMode *mode, SDL_DisplayOrientation *natural_orientation, SDL_DisplayOrientation *current_orientation)
diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c
index a037407c925f..9f0e6d2dccda 100644
--- a/src/video/windows/SDL_windowsmouse.c
+++ b/src/video/windows/SDL_windowsmouse.c
@@ -508,7 +508,7 @@ static void WIN_SetEnhancedMouseScale(int mouse_speed)
     float xpoints[5];
     float ypoints[5];
     float scale_points[10];
-    const int dpi = 96; // FIXME, how do we handle different monitors with different DPI?
+    const int dpi = USER_DEFAULT_SCREEN_DPI; // FIXME, how do we handle different monitors with different DPI?
     const float display_factor = 3.5f * (150.0f / dpi);
 
     if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\Mouse", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 07f6c9a2f00f..78f6aeaff00f 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -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()");
                 }