Browse Source
Fix EntryPointNotFound on Windows 8 due to missing version check (#6471)
* Prevent calls to unavailable entrypoint 'GetDpiForMonitor' on Win8 (#5357)
* Introduce Windows8 platform constant
* wip
Co-authored-by: Tim Schneeberger <tim.schneeberger@outlook.de>
Co-authored-by: Tim Schneeberger <thebone.main@gmail.com>
Co-authored-by: Dan Walmsley <dan@walms.co.uk>
pull/6476/head
Tako
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
14 additions and
9 deletions
-
src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
-
src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs
-
src/Windows/Avalonia.Win32/FramebufferManager.cs
-
src/Windows/Avalonia.Win32/PlatformConstants.cs
-
src/Windows/Avalonia.Win32/Win32GlManager.cs
-
src/Windows/Avalonia.Win32/Win32Platform.cs
-
src/Windows/Avalonia.Win32/WindowImpl.cs
|
|
@ -12,6 +12,7 @@ |
|
|
</ItemGroup> |
|
|
</ItemGroup> |
|
|
<ItemGroup> |
|
|
<ItemGroup> |
|
|
<ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" /> |
|
|
<ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" /> |
|
|
|
|
|
<ProjectReference Include="..\Avalonia.Win32\Avalonia.Win32.csproj" /> |
|
|
</ItemGroup> |
|
|
</ItemGroup> |
|
|
<Import Project="..\..\..\build\Rx.props" /> |
|
|
<Import Project="..\..\..\build\Rx.props" /> |
|
|
<Import Project="..\..\..\build\SharpDX.props" /> |
|
|
<Import Project="..\..\..\build\SharpDX.props" /> |
|
|
|
|
|
@ -1,4 +1,5 @@ |
|
|
using Avalonia.Platform; |
|
|
using Avalonia.Platform; |
|
|
|
|
|
using Avalonia.Win32; |
|
|
using Avalonia.Win32.Interop; |
|
|
using Avalonia.Win32.Interop; |
|
|
using SharpDX; |
|
|
using SharpDX; |
|
|
using SharpDX.DXGI; |
|
|
using SharpDX.DXGI; |
|
|
@ -21,7 +22,7 @@ namespace Avalonia.Direct2D1 |
|
|
|
|
|
|
|
|
protected override Size2F GetWindowDpi() |
|
|
protected override Size2F GetWindowDpi() |
|
|
{ |
|
|
{ |
|
|
if (UnmanagedMethods.ShCoreAvailable) |
|
|
if (UnmanagedMethods.ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8) |
|
|
{ |
|
|
{ |
|
|
uint dpix, dpiy; |
|
|
uint dpix, dpiy; |
|
|
|
|
|
|
|
|
|
|
|
@ -87,7 +87,7 @@ namespace Avalonia.Win32 |
|
|
|
|
|
|
|
|
private Vector GetCurrentDpi() |
|
|
private Vector GetCurrentDpi() |
|
|
{ |
|
|
{ |
|
|
if (UnmanagedMethods.ShCoreAvailable) |
|
|
if (UnmanagedMethods.ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8) |
|
|
{ |
|
|
{ |
|
|
var monitor = |
|
|
var monitor = |
|
|
UnmanagedMethods.MonitorFromWindow(_hwnd, UnmanagedMethods.MONITOR.MONITOR_DEFAULTTONEAREST); |
|
|
UnmanagedMethods.MonitorFromWindow(_hwnd, UnmanagedMethods.MONITOR.MONITOR_DEFAULTTONEAREST); |
|
|
|
|
|
@ -1,8 +1,13 @@ |
|
|
|
|
|
using System; |
|
|
|
|
|
|
|
|
namespace Avalonia.Win32 |
|
|
namespace Avalonia.Win32 |
|
|
{ |
|
|
{ |
|
|
static class PlatformConstants |
|
|
public static class PlatformConstants |
|
|
{ |
|
|
{ |
|
|
public const string WindowHandleType = "HWND"; |
|
|
public const string WindowHandleType = "HWND"; |
|
|
public const string CursorHandleType = "HCURSOR"; |
|
|
public const string CursorHandleType = "HCURSOR"; |
|
|
|
|
|
|
|
|
|
|
|
public static readonly Version Windows8 = new Version(6, 2); |
|
|
|
|
|
public static readonly Version Windows7 = new Version(6, 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
@ -1,4 +1,3 @@ |
|
|
using System; |
|
|
|
|
|
using Avalonia.OpenGL; |
|
|
using Avalonia.OpenGL; |
|
|
using Avalonia.OpenGL.Angle; |
|
|
using Avalonia.OpenGL.Angle; |
|
|
using Avalonia.OpenGL.Egl; |
|
|
using Avalonia.OpenGL.Egl; |
|
|
@ -9,7 +8,6 @@ namespace Avalonia.Win32 |
|
|
{ |
|
|
{ |
|
|
static class Win32GlManager |
|
|
static class Win32GlManager |
|
|
{ |
|
|
{ |
|
|
private static readonly Version Windows7 = new Version(6, 1); |
|
|
|
|
|
|
|
|
|
|
|
public static void Initialize() |
|
|
public static void Initialize() |
|
|
{ |
|
|
{ |
|
|
@ -22,7 +20,7 @@ namespace Avalonia.Win32 |
|
|
return wgl; |
|
|
return wgl; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > Windows7) |
|
|
if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > PlatformConstants.Windows7) |
|
|
{ |
|
|
{ |
|
|
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); |
|
|
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); |
|
|
|
|
|
|
|
|
|
|
|
@ -94,7 +94,7 @@ namespace Avalonia |
|
|
|
|
|
|
|
|
namespace Avalonia.Win32 |
|
|
namespace Avalonia.Win32 |
|
|
{ |
|
|
{ |
|
|
class Win32Platform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform, IPlatformIconLoader, IPlatformLifetimeEventsImpl |
|
|
public class Win32Platform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform, IPlatformIconLoader, IPlatformLifetimeEventsImpl |
|
|
{ |
|
|
{ |
|
|
private static readonly Win32Platform s_instance = new Win32Platform(); |
|
|
private static readonly Win32Platform s_instance = new Win32Platform(); |
|
|
private static Thread _uiThread; |
|
|
private static Thread _uiThread; |
|
|
|
|
|
@ -764,8 +764,8 @@ namespace Avalonia.Win32 |
|
|
RegisterTouchWindow(_hwnd, 0); |
|
|
RegisterTouchWindow(_hwnd, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (ShCoreAvailable) |
|
|
if (ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8) |
|
|
{ |
|
|
{ |
|
|
var monitor = MonitorFromWindow( |
|
|
var monitor = MonitorFromWindow( |
|
|
_hwnd, |
|
|
_hwnd, |
|
|
MONITOR.MONITOR_DEFAULTTONEAREST); |
|
|
MONITOR.MONITOR_DEFAULTTONEAREST); |
|
|
|