Browse Source
fix: Prevent DXGI from intercepting Alt+Enter and PrintScreen (#18970)
* disable key shortcuts forced by dxgi composition
* moved enum, fixed types
pull/19067/head
M0N7Y5
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
11 additions and
1 deletions
-
src/Windows/Avalonia.Win32/DirectX/DirectXEnums.cs
-
src/Windows/Avalonia.Win32/DirectX/DxgiRenderTarget.cs
|
|
|
@ -213,6 +213,14 @@ namespace Avalonia.Win32.DirectX |
|
|
|
DXGI_ERROR_WAS_STILL_DRAWING = 0x887A000A |
|
|
|
} |
|
|
|
|
|
|
|
[Flags] |
|
|
|
internal enum DXGI_MWA : uint |
|
|
|
{ |
|
|
|
DXGI_MWA_NO_WINDOW_CHANGES = 1, |
|
|
|
DXGI_MWA_NO_ALT_ENTER = 2, |
|
|
|
DXGI_MWA_NO_PRINT_SCREEN = 4 |
|
|
|
} |
|
|
|
|
|
|
|
internal static class DxgiErrorExtensions |
|
|
|
{ |
|
|
|
public static bool IsDeviceLostError(this DXGI_ERROR error) |
|
|
|
|
|
|
|
@ -23,7 +23,7 @@ namespace Avalonia.Win32.DirectX |
|
|
|
|
|
|
|
private IUnknown? _renderTexture; |
|
|
|
private RECT _clientRect; |
|
|
|
|
|
|
|
|
|
|
|
public DxgiRenderTarget(EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo window, EglContext context, DxgiConnection connection) : base(context) |
|
|
|
{ |
|
|
|
_window = window; |
|
|
|
@ -68,6 +68,8 @@ namespace Avalonia.Win32.DirectX |
|
|
|
null |
|
|
|
); |
|
|
|
|
|
|
|
_dxgiFactory.MakeWindowAssociation(window.Handle, (uint)(DXGI_MWA.DXGI_MWA_NO_ALT_ENTER | DXGI_MWA.DXGI_MWA_NO_PRINT_SCREEN)); |
|
|
|
|
|
|
|
GetClientRect(_window.Handle, out var pClientRect); |
|
|
|
_clientRect = pClientRect; |
|
|
|
} |
|
|
|
|