Browse Source
Fix AOT incompatible code (#7534)
* Fix AOT incompatible code
Use code patterns which are AOT-friendly. That improves R2R and Native AOT scenarios
pull/7548/head
Andrii Kurdiumov
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
7 deletions
-
src/Avalonia.X11/NativeDialogs/Gtk.cs
-
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
-
src/Windows/Avalonia.Win32/WindowImpl.cs
|
|
|
@ -63,7 +63,7 @@ namespace Avalonia.X11.NativeDialogs |
|
|
|
public static IDisposable ConnectSignal<T>(IntPtr obj, string name, T handler) |
|
|
|
{ |
|
|
|
var handle = GCHandle.Alloc(handler); |
|
|
|
var ptr = Marshal.GetFunctionPointerForDelegate((Delegate)(object)handler); |
|
|
|
var ptr = Marshal.GetFunctionPointerForDelegate<T>(handler); |
|
|
|
using (var utf = new Utf8Buffer(name)) |
|
|
|
{ |
|
|
|
var id = g_signal_connect_object(obj, utf, ptr, IntPtr.Zero, 0); |
|
|
|
|
|
|
|
@ -862,7 +862,7 @@ namespace Avalonia.Win32.Interop |
|
|
|
|
|
|
|
public void Init() |
|
|
|
{ |
|
|
|
biSize = (uint)Marshal.SizeOf(this); |
|
|
|
biSize = (uint)sizeof(BITMAPINFOHEADER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1521,7 +1521,7 @@ namespace Avalonia.Win32.Interop |
|
|
|
internal static Version RtlGetVersion() |
|
|
|
{ |
|
|
|
RTL_OSVERSIONINFOEX v = new RTL_OSVERSIONINFOEX(); |
|
|
|
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf(v); |
|
|
|
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf<RTL_OSVERSIONINFOEX>(); |
|
|
|
if (RtlGetVersion(ref v) == 0) |
|
|
|
{ |
|
|
|
return new Version((int)v.dwMajorVersion, (int)v.dwMinorVersion, (int)v.dwBuildNumber); |
|
|
|
@ -1914,7 +1914,7 @@ namespace Avalonia.Win32.Interop |
|
|
|
get |
|
|
|
{ |
|
|
|
WINDOWPLACEMENT result = new WINDOWPLACEMENT(); |
|
|
|
result.Length = Marshal.SizeOf(result); |
|
|
|
result.Length = Marshal.SizeOf<WINDOWPLACEMENT>(); |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -228,7 +228,7 @@ namespace Avalonia.Win32 |
|
|
|
return new Size(rcWindow.Width, rcWindow.Height) / RenderScaling; |
|
|
|
} |
|
|
|
|
|
|
|
DwmGetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_EXTENDED_FRAME_BOUNDS, out var rect, Marshal.SizeOf(typeof(RECT))); |
|
|
|
DwmGetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_EXTENDED_FRAME_BOUNDS, out var rect, Marshal.SizeOf<RECT>()); |
|
|
|
return new Size(rect.Width, rect.Height) / RenderScaling; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -337,7 +337,7 @@ namespace Avalonia.Win32 |
|
|
|
private WindowTransparencyLevel Win8xEnableBlur(WindowTransparencyLevel transparencyLevel) |
|
|
|
{ |
|
|
|
var accent = new AccentPolicy(); |
|
|
|
var accentStructSize = Marshal.SizeOf(accent); |
|
|
|
var accentStructSize = Marshal.SizeOf<AccentPolicy>(); |
|
|
|
|
|
|
|
if (transparencyLevel == WindowTransparencyLevel.AcrylicBlur) |
|
|
|
{ |
|
|
|
@ -392,7 +392,7 @@ namespace Avalonia.Win32 |
|
|
|
bool canUseAcrylic = Win32Platform.WindowsVersion.Major > 10 || Win32Platform.WindowsVersion.Build >= 19628; |
|
|
|
|
|
|
|
var accent = new AccentPolicy(); |
|
|
|
var accentStructSize = Marshal.SizeOf(accent); |
|
|
|
var accentStructSize = Marshal.SizeOf<AccentPolicy>(); |
|
|
|
|
|
|
|
if (transparencyLevel == WindowTransparencyLevel.AcrylicBlur && !canUseAcrylic) |
|
|
|
{ |
|
|
|
|