From 5875f6ab3181fef2120cb33d56d58ec79cb7ee82 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Thu, 5 May 2022 21:46:20 +0300 Subject: [PATCH] [UI] Windows: Disable rounded corners --- docs/building.md | 2 +- premake5.lua | 3 ++- src/xenia/ui/premake5.lua | 3 ++- src/xenia/ui/window_win.cc | 10 +++++++++- xenia-build | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/building.md b/docs/building.md index 16430edb8..13e6e1f33 100644 --- a/docs/building.md +++ b/docs/building.md @@ -13,7 +13,7 @@ drivers. * For Visual Studio 2022, MSBuild `v142` must be used due to a compiler bug; See [#2003](https://github.com/xenia-project/xenia/issues/2003). * [Python 3.6+](https://www.python.org/downloads/) * Ensure Python is in PATH. -* Windows 10 SDK version 10.0.19041.0 (for Visual Studio 2019, this or any newer version) +* Windows 11 SDK version 10.0.22000.0 (for Visual Studio 2019, this or any newer version) ``` git clone https://github.com/xenia-project/xenia.git diff --git a/premake5.lua b/premake5.lua index f603b59af..449879afa 100644 --- a/premake5.lua +++ b/premake5.lua @@ -225,8 +225,9 @@ workspace("xenia") platforms({"Windows"}) -- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions. -- 10.0.19041.0: D3D12_HEAP_FLAG_CREATE_NOT_ZEROED. + -- 10.0.22000.0: DWMWA_WINDOW_CORNER_PREFERENCE. filter("action:vs2017") - systemversion("10.0.19041.0") + systemversion("10.0.22000.0") filter("action:vs2019") systemversion("10.0") filter({}) diff --git a/src/xenia/ui/premake5.lua b/src/xenia/ui/premake5.lua index 3b9e482c4..6aff82bec 100644 --- a/src/xenia/ui/premake5.lua +++ b/src/xenia/ui/premake5.lua @@ -21,5 +21,6 @@ project("xenia-ui") filter("platforms:Windows") links({ - "DXGI", + "dwmapi", + "dxgi", }) diff --git a/src/xenia/ui/window_win.cc b/src/xenia/ui/window_win.cc index f7ab5ff71..f2458b69d 100644 --- a/src/xenia/ui/window_win.cc +++ b/src/xenia/ui/window_win.cc @@ -23,8 +23,8 @@ #include "xenia/ui/virtual_key.h" #include "xenia/ui/windowed_app_context_win.h" -// For per-monitor DPI awareness v1. #include +#include namespace xe { namespace ui { @@ -182,6 +182,14 @@ bool Win32Window::OpenImpl() { } } + // Disable rounded corners starting with Windows 11 (or silently receive and + // ignore E_INVALIDARG on Windows versions before 10.0.22000.0), primarily to + // preserve all pixels of the guest output. + DWM_WINDOW_CORNER_PREFERENCE window_corner_preference = DWMWCP_DONOTROUND; + DwmSetWindowAttribute(hwnd_, DWMWA_WINDOW_CORNER_PREFERENCE, + &window_corner_preference, + sizeof(window_corner_preference)); + // Disable flicks. ATOM atom = GlobalAddAtomW(L"MicrosoftTabletPenServiceProperty"); const DWORD_PTR dwHwndTabletProperty = diff --git a/xenia-build b/xenia-build index d41b9f4b0..543114686 100755 --- a/xenia-build +++ b/xenia-build @@ -920,7 +920,7 @@ class BuildShadersCommand(Command): print('ERROR: could not find 32-bit Program Files') return 1 windows_sdk_bin_path = os.path.join( - program_files_path, 'Windows Kits/10/bin/10.0.19041.0/x64') + program_files_path, 'Windows Kits/10/bin/10.0.22000.0/x64') if not os.path.exists(windows_sdk_bin_path): print('ERROR: could not find Windows 10 SDK binaries') return 1