33using System . Windows . Media . Imaging ;
44using Microsoft . Win32 ;
55
6- namespace v2rayN ;
6+ namespace v2rayN . Common ;
77
88internal static class WindowsUtils
99{
@@ -40,13 +40,13 @@ public static void SetClipboardData(string strData)
4040 }
4141
4242 [ DllImport ( "dwmapi.dll" ) ]
43- public static extern int DwmSetWindowAttribute ( IntPtr hwnd , DWMWINDOWATTRIBUTE attribute , ref int attributeValue , uint attributeSize ) ;
43+ public static extern int DwmSetWindowAttribute ( nint hwnd , DWMWINDOWATTRIBUTE attribute , ref int attributeValue , uint attributeSize ) ;
4444
4545 public static ImageSource IconToImageSource ( Icon icon )
4646 {
4747 return Imaging . CreateBitmapSourceFromHIcon (
4848 icon . Handle ,
49- new System . Windows . Int32Rect ( 0 , 0 , icon . Width , icon . Height ) ,
49+ new Int32Rect ( 0 , 0 , icon . Width , icon . Height ) ,
5050 BitmapSizeOptions . FromEmptyOptions ( ) ) ;
5151 }
5252
@@ -65,9 +65,9 @@ public static void SetDarkBorder(Window window, string? theme)
6565 private static void SetDarkBorder ( Window window , bool dark )
6666 {
6767 // Make sure the handle is created before the window is shown
68- IntPtr hWnd = new WindowInteropHelper ( window ) . EnsureHandle ( ) ;
69- int attribute = dark ? 1 : 0 ;
70- uint attributeSize = ( uint ) Marshal . SizeOf ( attribute ) ;
68+ var hWnd = new WindowInteropHelper ( window ) . EnsureHandle ( ) ;
69+ var attribute = dark ? 1 : 0 ;
70+ var attributeSize = ( uint ) Marshal . SizeOf ( attribute ) ;
7171 DwmSetWindowAttribute ( hWnd , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 , ref attribute , attributeSize ) ;
7272 DwmSetWindowAttribute ( hWnd , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , ref attribute , attributeSize ) ;
7373 }
0 commit comments