From bb7cbe7cff43bec7061a7a0ccabaf2755e7376ee Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Sep 2016 21:16:39 +0200 Subject: Small improvements to UI DPI scaling on Windows: * Use USER_DEFAULT_SCREEN_DPI define from WinUser.h * Change Win32 SDK target version to Windows Vista or greater * Define WM_DPICHANGED as preprocessor definition as in WinUser.h * Cull manual definitions of WM_MOUSEWHEEL and WHEEL_DELTA which are part of the Win32 SDK since Windows NT 4.0 --- indra/cmake/00-Common.cmake | 4 ++-- indra/llwindow/llwindowwin32.cpp | 18 +++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 86fc2dfff5..adc134c48c 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -83,8 +83,8 @@ if (WINDOWS) add_definitions(/WX) endif (NOT VS_DISABLE_FATAL_WARNINGS) - # configure win32 API for windows XP+ compatibility - set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") + # configure Win32 API for Windows Vista+ compatibility + set(WINVER "0x0600" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}") endif (WINDOWS) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 26bc819aab..4086db8e52 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -60,21 +60,13 @@ #include #include -// culled from winuser.h -#ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */ -const S32 WM_MOUSEWHEEL = 0x020A; -#endif -#ifndef WHEEL_DELTA /* Added to be compatible with later SDK's */ -const S32 WHEEL_DELTA = 120; /* Value for rolling one detent */ -#endif const S32 MAX_MESSAGE_PER_UPDATE = 20; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; const F32 ICON_FLASH_TIME = 0.5f; -const F32 DEFAULT_DPI = 96.0f; -#ifndef WM_DPICHANGED -const S32 WM_DPICHANGED = 0x02E0; +#ifndef WM_DPICHANGED +#define WM_DPICHANGED 0x02E0 #endif extern BOOL gDebugWindowProc; @@ -2631,7 +2623,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_DPICHANGED: { LPRECT lprc_new_scale; - F32 new_scale = LOWORD(w_param) / 96.0f; + F32 new_scale = LOWORD(w_param) / USER_DEFAULT_SCREEN_DPI; lprc_new_scale = (LPRECT)l_param; S32 new_width = lprc_new_scale->right - lprc_new_scale->left; S32 new_height = lprc_new_scale->bottom - lprc_new_scale->top; @@ -3990,7 +3982,7 @@ F32 LLWindowWin32::getSystemUISize() hr = pGDFM(hMonitor, MDT_EFFECTIVE_DPI, &dpix, &dpiy); if (hr == S_OK) { - scale_value = dpix / DEFAULT_DPI; + scale_value = dpix / USER_DEFAULT_SCREEN_DPI; } else { @@ -4009,7 +4001,7 @@ F32 LLWindowWin32::getSystemUISize() else { LL_WARNS() << "Could not load shcore.dll library (included by from Win 8.1 SDK). Using legacy DPI awareness API of Win XP/7" << LL_ENDL; - scale_value = GetDeviceCaps(hdc, LOGPIXELSX) / DEFAULT_DPI; + scale_value = GetDeviceCaps(hdc, LOGPIXELSX) / USER_DEFAULT_SCREEN_DPI; } ReleaseDC(hWnd, hdc); -- cgit v1.2.3