game_window: respect per-monitor DPI scale

Co-Authored-By: Darío <538504+DarioSamo@users.noreply.github.com>
This commit is contained in:
Hyper 2025-02-07 10:11:06 +00:00
parent 871515b3be
commit 71bb081645
2 changed files with 8 additions and 6 deletions

View file

@ -351,10 +351,12 @@ file(CHMOD ${DIRECTX_DXC_TOOL} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
if (WIN32) if (WIN32)
target_link_libraries(UnleashedRecomp PRIVATE target_link_libraries(UnleashedRecomp PRIVATE
comctl32 comctl32
ntdll dwmapi
winmm ntdll
Shcore
Synchronization Synchronization
winmm
) )
endif() endif()

View file

@ -9,7 +9,7 @@
#if _WIN32 #if _WIN32
#include <dwmapi.h> #include <dwmapi.h>
#pragma comment(lib, "dwmapi.lib") #include <shellscalingapi.h>
#endif #endif
#include <res/images/game_icon.bmp.h> #include <res/images/game_icon.bmp.h>
@ -184,7 +184,7 @@ void GameWindow::Init(const char* sdlVideoDriver)
SDL_AddEventWatch(Window_OnSDLEvent, s_pWindow); SDL_AddEventWatch(Window_OnSDLEvent, s_pWindow);
#ifdef _WIN32 #ifdef _WIN32
SetProcessDPIAware(); SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
#endif #endif
Config::WindowSize.LockCallback = [](ConfigDef<int32_t>* def) Config::WindowSize.LockCallback = [](ConfigDef<int32_t>* def)
@ -442,7 +442,7 @@ void GameWindow::ResetDimensions()
uint32_t GameWindow::GetWindowFlags() uint32_t GameWindow::GetWindowFlags()
{ {
uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE; uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
if (Config::WindowState == EWindowState::Maximised) if (Config::WindowState == EWindowState::Maximised)
flags |= SDL_WINDOW_MAXIMIZED; flags |= SDL_WINDOW_MAXIMIZED;