-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: Prevent DXGI from intercepting Alt+Enter and PrintScreen #18970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
You can test this PR using the following package version. |
|
@cla-avalonia agree |
@@ -24,6 +24,14 @@ internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase | |||
private IUnknown? _renderTexture; | |||
private RECT _clientRect; | |||
|
|||
[Flags] | |||
enum AssociationFlags : ushort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confused by the ushort
here before realizing that the current parameters had the wrong types.
Please wait for #18991 to get merged, then remove the ushort
.
@@ -24,6 +24,14 @@ internal unsafe class DxgiRenderTarget : EglPlatformSurfaceRenderTargetBase | |||
private IUnknown? _renderTexture; | |||
private RECT _clientRect; | |||
|
|||
[Flags] | |||
enum AssociationFlags : ushort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please define this in DirectXEnums.cs
for consistency (the name could be DXGI_MWA
).
Also, the second parameter for MakeWindowAssociation()
in DirectX.idl
could probably now be typed.
What does the pull request do?
This fixes an issue with forced key shortcuts caused by DXGI composition. By default, DXGI hooks into the window message queue, intercepts the PrintScreen key or Alt+Enter key sequence, and forces any Avalonia app into fullscreen mode. There is currently no way to disable this feature.
This behavior only occurs for apps using
Win32CompositionMode.LowLatencyDxgiSwapChain
. Other composition modes are not affected.https://groups.google.com/g/angleproject/c/Ks8QXP6UVBk
What is the current behavior?
Any Avalonia app using Win32CompositionMode.LowLatencyDxgiSwapChain switches to fullscreen mode when the Alt+Enter key sequence is pressed.
What is the updated/expected behavior with this PR?
The updated behavior entirely disables forced fullscreen via Alt+Enter, as well as the PrintScreen key interception.
How was the solution implemented (if it's not obvious)?
The solution involves setting the appropriate flags using
MakeWindowAssociation
.https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-makewindowassociation
Breaking changes
None