Merge branch 'master' of https://github.com/ZDoom/gzdoom into gzdoom-update-4-12-1

This commit is contained in:
Rachael Alexanderson 2024-04-21 11:05:59 -04:00
commit 112c6cbccf
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
90 changed files with 1227 additions and 834 deletions

View file

@ -128,6 +128,8 @@ void Win32DisplayWindow::SetWindowFrame(const Rect& box)
void Win32DisplayWindow::SetClientFrame(const Rect& box)
{
// This function is currently unused but needs to be disabled because it contains Windows API calls that were only added in Windows 10.
#if 0
double dpiscale = GetDpiScale();
RECT rect = {};
@ -141,6 +143,7 @@ void Win32DisplayWindow::SetClientFrame(const Rect& box)
AdjustWindowRectExForDpi(&rect, style, FALSE, exstyle, GetDpiForWindow(WindowHandle));
SetWindowPos(WindowHandle, nullptr, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOACTIVATE | SWP_NOZORDER);
#endif
}
void Win32DisplayWindow::Show()
@ -268,9 +271,22 @@ int Win32DisplayWindow::GetPixelHeight() const
return box.bottom;
}
typedef UINT(WINAPI* GetDpiForWindow_t)(HWND);
double Win32DisplayWindow::GetDpiScale() const
{
return GetDpiForWindow(WindowHandle) / 96.0;
static GetDpiForWindow_t pGetDpiForWindow = nullptr;
static bool done = false;
if (!done)
{
HMODULE hMod = GetModuleHandleA("User32.dll");
if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
done = true;
}
if (pGetDpiForWindow)
return pGetDpiForWindow(WindowHandle) / 96.0;
else
return 1.0;
}
std::string Win32DisplayWindow::GetClipboardText()