Skip to content

Commit 5875f6a

Browse files
committed
[UI] Windows: Disable rounded corners
1 parent 9c8e0cc commit 5875f6a

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

docs/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ drivers.
1313
* For Visual Studio 2022, MSBuild `v142` must be used due to a compiler bug; See [#2003](https://github.com/xenia-project/xenia/issues/2003).
1414
* [Python 3.6+](https://www.python.org/downloads/)
1515
* Ensure Python is in PATH.
16-
* Windows 10 SDK version 10.0.19041.0 (for Visual Studio 2019, this or any newer version)
16+
* Windows 11 SDK version 10.0.22000.0 (for Visual Studio 2019, this or any newer version)
1717

1818
```
1919
git clone https://github.com/xenia-project/xenia.git

premake5.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ workspace("xenia")
225225
platforms({"Windows"})
226226
-- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions.
227227
-- 10.0.19041.0: D3D12_HEAP_FLAG_CREATE_NOT_ZEROED.
228+
-- 10.0.22000.0: DWMWA_WINDOW_CORNER_PREFERENCE.
228229
filter("action:vs2017")
229-
systemversion("10.0.19041.0")
230+
systemversion("10.0.22000.0")
230231
filter("action:vs2019")
231232
systemversion("10.0")
232233
filter({})

src/xenia/ui/premake5.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ project("xenia-ui")
2121

2222
filter("platforms:Windows")
2323
links({
24-
"DXGI",
24+
"dwmapi",
25+
"dxgi",
2526
})

src/xenia/ui/window_win.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "xenia/ui/virtual_key.h"
2424
#include "xenia/ui/windowed_app_context_win.h"
2525

26-
// For per-monitor DPI awareness v1.
2726
#include <ShellScalingApi.h>
27+
#include <dwmapi.h>
2828

2929
namespace xe {
3030
namespace ui {
@@ -182,6 +182,14 @@ bool Win32Window::OpenImpl() {
182182
}
183183
}
184184

185+
// Disable rounded corners starting with Windows 11 (or silently receive and
186+
// ignore E_INVALIDARG on Windows versions before 10.0.22000.0), primarily to
187+
// preserve all pixels of the guest output.
188+
DWM_WINDOW_CORNER_PREFERENCE window_corner_preference = DWMWCP_DONOTROUND;
189+
DwmSetWindowAttribute(hwnd_, DWMWA_WINDOW_CORNER_PREFERENCE,
190+
&window_corner_preference,
191+
sizeof(window_corner_preference));
192+
185193
// Disable flicks.
186194
ATOM atom = GlobalAddAtomW(L"MicrosoftTabletPenServiceProperty");
187195
const DWORD_PTR dwHwndTabletProperty =

xenia-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ class BuildShadersCommand(Command):
920920
print('ERROR: could not find 32-bit Program Files')
921921
return 1
922922
windows_sdk_bin_path = os.path.join(
923-
program_files_path, 'Windows Kits/10/bin/10.0.19041.0/x64')
923+
program_files_path, 'Windows Kits/10/bin/10.0.22000.0/x64')
924924
if not os.path.exists(windows_sdk_bin_path):
925925
print('ERROR: could not find Windows 10 SDK binaries')
926926
return 1

0 commit comments

Comments
 (0)