-
Notifications
You must be signed in to change notification settings - Fork 771
Description
Describe the bug
Issue:
When using the arrow keys continuously pointer input stops responding.
Background:
I'm creating an application in Winui 3. Since updating from version 1.2 to version 1.3, pointer input stops working completely after a few seconds in the scenario where I simultaneously use the arrow keys continuously. In this app this results in no part of the application responding to any pointer input, except for the buttons in the title bar. When using other keys on the keyboard it resumes to normal behavior, but this is less than optimal.
This occurs even when no keyboard events are handled and a Canvas is used to display a object at the pointer position like in the example below.
Steps to reproduce the bug
- Create a new Black App, Packaged (WinUI 3 in Desktop)
Note: This should be a project targeting the 1.3 version of the Microsoft.WindowsAppSDK. This issue did not occur in version 1.2 or earlier versions to my knowledge.
- Replace the MainWindow.xaml content (the StackPanel) with the following code:
<Grid> <Canvas Background="White" x:Name="PointerTestCanvas" PointerMoved="CanvasOnPointerMoved" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsHitTestVisible="True" > <Rectangle x:Name="PointerTestRectangle" Fill="Red" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="0" Width="100" Height="100" /> </Canvas> </Grid>
- Remove the myButton_Click method from the code behind of MainWindow.xaml.cs.
- Add the following code to the code behind of MainWindow.xaml.cs:
private void CanvasOnPointerMoved(object sender, PointerRoutedEventArgs e) { var position = e.GetCurrentPoint(sender as UIElement); Canvas.SetLeft(PointerTestRectangle, position.Position.X); Canvas.SetTop(PointerTestRectangle, position.Position.Y); }
- Run the application, make sure it has focus, and move the mouse/pointer so the rectangle will follow it. Keep one (or more) of the arrow keys pressed a couple of seconds (does not seem to be consistent and might sometimes take up to 10 seconds ) and watch as the pointer stops responding. In this case, as soon as you release the arrow key the pointer resumes normal behaviour.
If the application doesn't have focus this issue will not occur.
Expected behavior
I expected the mouse/pointer to keep responding to events like it did before version 1.3, even while the arrow keys are continuously used (like in for instance a game).
Screenshots
No response
NuGet package version
Windows App SDK 1.3.2: 1.3.230602002
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
Doesn't seem to matter if:
- It's a packaged or non-packaged app.
- It's .NET 6 or .NET 7
- It's a SwapChainPanel instead of a Canvas UI element.
- Key modifiers are added to the input.