8
8
9
9
using Avalonia ;
10
10
using Avalonia . Controls ;
11
+ using Avalonia . Platform ;
11
12
using Avalonia . Threading ;
12
13
13
14
namespace SourceGit . Native
14
15
{
15
16
[ SupportedOSPlatform ( "windows" ) ]
16
17
internal class Windows : OS . IBackend
17
18
{
18
- [ StructLayout ( LayoutKind . Sequential ) ]
19
- internal struct RTL_OSVERSIONINFOEX
20
- {
21
- internal uint dwOSVersionInfoSize ;
22
- internal uint dwMajorVersion ;
23
- internal uint dwMinorVersion ;
24
- internal uint dwBuildNumber ;
25
- internal uint dwPlatformId ;
26
- [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 128 ) ]
27
- internal string szCSDVersion ;
28
- }
29
-
30
19
internal struct RECT
31
20
{
32
21
public int left ;
@@ -72,9 +61,6 @@ internal struct MARGINS
72
61
public int cyBottomHeight ;
73
62
}
74
63
75
- [ DllImport ( "ntdll.dll" ) ]
76
- private static extern int RtlGetVersion ( ref RTL_OSVERSIONINFOEX lpVersionInformation ) ;
77
-
78
64
[ DllImport ( "dwmapi.dll" ) ]
79
65
private static extern int DwmExtendFrameIntoClientArea ( IntPtr hwnd , ref MARGINS margins ) ;
80
66
@@ -96,9 +82,7 @@ internal struct MARGINS
96
82
public void SetupApp ( AppBuilder builder )
97
83
{
98
84
// Fix drop shadow issue on Windows 10
99
- RTL_OSVERSIONINFOEX v = new RTL_OSVERSIONINFOEX ( ) ;
100
- v . dwOSVersionInfoSize = ( uint ) Marshal . SizeOf < RTL_OSVERSIONINFOEX > ( ) ;
101
- if ( RtlGetVersion ( ref v ) == 0 && ( v . dwMajorVersion < 10 || v . dwBuildNumber < 22000 ) )
85
+ if ( ! OperatingSystem . IsWindowsVersionAtLeast ( 10 , 22000 , 0 ) )
102
86
{
103
87
Window . WindowStateProperty . Changed . AddClassHandler < Window > ( ( w , _ ) => FixWindowFrameOnWin10 ( w ) ) ;
104
88
Control . LoadedEvent . AddClassHandler < Window > ( ( w , _ ) => FixWindowFrameOnWin10 ( w ) ) ;
@@ -107,6 +91,10 @@ public void SetupApp(AppBuilder builder)
107
91
108
92
public void SetupWindow ( Window window )
109
93
{
94
+ window . ExtendClientAreaChromeHints = ExtendClientAreaChromeHints . NoChrome ;
95
+ window . ExtendClientAreaToDecorationsHint = true ;
96
+ window . Classes . Add ( "fix_maximized_padding" ) ;
97
+
110
98
Win32Properties . AddWndProcHookCallback ( window , ( IntPtr hWnd , uint msg , IntPtr wParam , IntPtr lParam , ref bool handled ) =>
111
99
{
112
100
// Custom WM_NCHITTEST
0 commit comments