Skip to content

fix: Fix pointer and keyboard events not raised on CoreWindow - #20506

Merged
dr1rrb merged 1 commit into
masterfrom
dev/dr/coreWindowEvents
May 23, 2025
Merged

dr1rrb merged 1 commit into
masterfrom
dev/dr/coreWindowEvents

Conversation

@dr1rrb

@dr1rrb dr1rrb commented May 22, 2025

Copy link
Copy Markdown
Member

closes #20350

Bugfix

Fix pointer and keyboard events not raised on CoreWindow

What is the current behavior?

Pointer and keyboard input source are not set on the CoreWindow on desktop target as it reports as "Xaml Island"(as expected, cf. #20491)

What is the new behavior?

We ignore the content root type and set the sources as long as we have a CoreWindow instance.

PR Checklist

@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label May 22, 2025
@dr1rrb dr1rrb mentioned this pull request May 22, 2025
3 of 6 tasks
@dr1rrb
dr1rrb enabled auto-merge May 22, 2025 15:15
@dr1rrb
dr1rrb requested a review from Copilot May 22, 2025 15:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures pointer and keyboard events are raised on CoreWindow by removing the ContentRootType guard and always registering the input sources.

  • Always call SetPointerInputSource on CoreWindow regardless of content root type.
  • Always call SetKeyboardInputSource on CoreWindow regardless of content root type.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.Managed.cs Removed ContentRootType check to always invoke SetPointerInputSource
src/Uno.UI/UI/Xaml/Internal/InputManager.Keyboard.skia.cs Removed ContentRootType check to always invoke SetKeyboardInputSource
Comments suppressed due to low confidence (2)

src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.Managed.cs:83

  • Add a comment explaining why the ContentRootType check was removed to clarify the intent and aid future maintainers.
CoreWindow.GetForCurrentThreadSafe()?.SetPointerInputSource(_source);

src/Uno.UI/UI/Xaml/Internal/InputManager.Keyboard.skia.cs:45

  • Add unit or UI tests to verify that keyboard events are properly routed through CoreWindow now that the guard is removed.
CoreWindow.GetForCurrentThreadSafe()?.SetKeyboardInputSource(_source);

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 166492 found UI Test snapshots differences: android-28-net8: 25, android-28-net8-Snap: 44, ios: 9, ios-Snap: 45, skia-linux-screenshots: 81, skia-windows-screenshots: 402, wasm: 44, wasm-automated-net9.0-WinUI-Benchmarks-automated: 0, wasm-automated-net9.0-WinUI-Default-automated: 22, wasm-automated-net9.0-WinUI-RuntimeTests-0: 0, wasm-automated-net9.0-WinUI-RuntimeTests-1: 0, wasm-automated-net9.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net8: 25 changed over 824

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • MinMaxTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • UpDownTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • When_Clip_Is_Set_On_Child_Element_original
    • FlyoutTest_When_NoOverlayInputPassThroughElement_Then_DontPassThrough_woOff_UITests_Shared_Windows_UI_Xaml_Controls_Flyout_Flyout_OverlayInputPassThroughElement
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • TextBox_Selection_IsReadOnly_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_Selection
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • When_Clip_Is_Set_On_Child_Element_UITests_Windows_UI_Xaml_UIElementTests_UIElement_Clipping
    • When_Clip_Is_Set_On_Child_Element_validation
    • When_Clip_Is_Set_On_Container_Element_UITests_Windows_UI_Xaml_Clipping_Clipping652
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_NoSelection_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
  • android-28-net8-Snap: 44 changed over 1067

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Pickers_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • SwipeControl_MUXControlsTestApp_SwipeControlPage2_MUXControlsTestApp_SwipeControlPage2
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Microsoft_UI_Composition_UITests_Windows_UI_Composition_Vector3KeyFrameAnimationSample_UITests_Windows_UI_Composition_Vector3KeyFrameAnimationSample
    • Info_UITests_Microsoft_UI_Xaml_Controls_InfoBadgeTests_InfoBadgePage_UITests_Microsoft_UI_Xaml_Controls_InfoBadgeTests_InfoBadgePage
    • RatingControl_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage_UITests_Microsoft_UI_Xaml_Controls_RatingControlTests_RatingControlPage
    • TextBlock_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_LayoutAlignment_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_LayoutAlignment
    • TextBlock_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_MeasureCache_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_MeasureCache
    • TextBlock_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_RelativeTextSize_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_RelativeTextSize
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • TeachingTip_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • Scrolling_MUXControlsTestApp_ScrollViewWithScrollControllersPage_MUXControlsTestApp_ScrollViewWithScrollControllersPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_NoSize_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_NoSize
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
    • Scrolling_MUXControlsTestApp_ScrollViewDynamicPage_MUXControlsTestApp_ScrollViewDynamicPage
    • Scrolling_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage
    • Gesture_Recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
  • ios: 9 changed over 255

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • MinMaxTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • TextBox_Selection_IsReadOnly_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_Selection
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • UpDownTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • BasicExpressionTest_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_ExpressionTest
    • Check_ListView_Swallows_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
  • ios-Snap: 45 changed over 984

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_PanelImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_PanelImageBrush
    • Microsoft_UI_Composition_UITests_Windows_UI_Composition_Vector3KeyFrameAnimationSample_UITests_Windows_UI_Composition_Vector3KeyFrameAnimationSample
    • Brushes_ImageBrushStretch_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushStretch
    • Brushes_BorderImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_BorderImageBrush
    • Grid_Grid_DataBound_ColumnRow_Definitions_Uno_UI_Samples_Content_UITests_GridTestsControl_Grid_DataBound_ColumnRow_Definitions
    • Icons_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Wider_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Wider
    • Info_UITests_Microsoft_UI_Xaml_Controls_InfoBadgeTests_InfoBadgePage_UITests_Microsoft_UI_Xaml_Controls_InfoBadgeTests_InfoBadgePage
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Uno_UI_Samples_UITests_Image_Image_Stretch
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
    • NavigationView_MUXControlsTestApp_NavigationViewCompactPaneLengthTestPage_MUXControlsTestApp_NavigationViewCompactPaneLengthTestPage
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • NumberBox_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_Description_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_Description
    • NumberBox_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_ExpressionTest_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_ExpressionTest
    • NumberBox_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_Header_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_Header
    • Pickers_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • SwipeControl_MUXControlsTestApp_SwipeControlPage2_MUXControlsTestApp_SwipeControlPage2
    • TextBlock_TextBlock_FixedWidth_With_DataBound_Run_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBlock_FixedWidth_With_DataBound_Run
    • TextBox_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_Selection_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_Selection
    • Grid_CenteredGridinGridwiththreefixedsizechildren_Uno_UI_Samples_Content_UITests_GridTestsControl_CenteredGridinGridwiththreefixedsizechildren
  • skia-linux-screenshots: 81 changed over 2246

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • ApplicationViewSizing.png-dark
    • AppWindowPositionAndSize.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ImageIconPage.png-dark
    • ImageWithLateSourceUniformToFill.png-dark
    • ImageWithLateSourceUniformToFill.png
    • Image_Stretch_None.png-dark
    • Image_Stretch_None.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
  • skia-windows-screenshots: 402 changed over 2246

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppWindowPositionAndSize.png
    • AuthenticationBroker_Demo.png-dark
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
    • BreadcrumbBarPage.png
    • Clipping652.png-dark
    • Clipping652.png
    • AndroidWindowInsets.png
    • AnimatedIconPage.png
    • AppWindowClosing.png
    • BorderWithNullBrushAndNonZeroThickness.png-dark
    • BorderWithNullBrushAndNonZeroThickness.png
    • Buttons.png-dark
    • Buttons.png
    • DataTransferManager.png-dark
    • DataTransferManager.png
    • EasClientDeviceInformation.png-dark
    • EasClientDeviceInformation.png
    • IconSourceElementTests.png-dark
    • IconSourceElementTests.png
  • wasm: 44 changed over 1051

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListView_Image
    • UITests.Windows_UI_ViewManagement.ApplicationViewSizing
    • UITests.Windows_UI_Xaml_Controls.ComboBox.ComboBox_Stretch
    • UITests.Windows_UI_Xaml_Controls.CommandBar.BackButtonTitle.CommandBar_Frame
    • UITests.Windows_UI_Xaml_Media_Animation.DoubleAnimation_FinalState_Opacity
    • UITests.Windows_UI_Xaml_Media_Animation.DoubleAnimation_FinalState_Transforms
    • Uno.UI.Samples.Content.UITests.CommandBar.CommandBar_With_Long_Sentences
    • UITests.Shared.Windows_UI_Xaml.ViusalStateTests.VisualState_AdaptiveTrigger_Storyboard
    • Uno.UI.Samples.Content.UITests.ButtonTestsControl.RadioButton_Multiple_Unnamed_Groups
    • initial_state
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Microsoft_UI_Xaml_Controls.CommandBarTests.CommandBar_Primary_And_Secondary
    • UITests.Shared.Windows_UI_Xaml_Controls.CommandBar.CommandBar_Xaml_Automated
    • UITests.Windows_UI_Xaml_Controls.ImageTests.SvgImageSource_MultiLoad
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewHeaderFooter_ImplicitlyBinded
    • UITests.Windows_UI_Composition.Vector3KeyFrameAnimationSample
    • UITests.Windows_UI_Xaml_Controls.ImageTests.SvgImageSource_FromMsAppData
    • Uno.UI.Samples.Content.UITests.GridView.GridView_Item_TextBlock_And_Button
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
  • wasm-automated-net9.0-WinUI-Benchmarks-automated: 0 changed over 1

  • wasm-automated-net9.0-WinUI-Default-automated: 22 changed over 876

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_TextTrimming_Is_Set_Then_Ellipsis_Is_Used_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_TextTrimming
    • ToggleCollapsedStateToVerifyClipping_UITests_Shared_Microsoft_UI_Xaml_Controls_ExpanderTests_ExpanderColorValidationPage
    • When_MaxLines_Then_AlignmentPositionIsCorrect_Uno_UI_Samples_Content_UITests_TextBlockControl_SimpleText_MaxLines_Two_With_Wrap
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • MinMaxTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Default_StrokeThickness_MyEllipse
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • UpDownTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Default_StrokeThickness_MyRect
    • Default_StrokeThickness_MyLine
    • Default_StrokeThickness_MyPolyline
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_Theme_Changed_No_Crash_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • BasicExpressionTest_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_ExpressionTest
    • Default_StrokeThickness_MyPolygon
  • wasm-automated-net9.0-WinUI-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net9.0-WinUI-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net9.0-WinUI-RuntimeTests-2: 0 changed over 1

@dr1rrb
dr1rrb merged commit 8be4459 into master May 23, 2025
@dr1rrb
dr1rrb deleted the dev/dr/coreWindowEvents branch May 23, 2025 00:51
@HakanL

HakanL commented May 23, 2025

Copy link
Copy Markdown

Can you back port this into Uno6.0?

@dr1rrb

dr1rrb commented May 23, 2025

Copy link
Copy Markdown
Member Author

@HakanL not sure yet, waiting for QA to test it. Anyway 6.1 is already around the corner :)

@HakanL

HakanL commented May 23, 2025

Copy link
Copy Markdown

@HakanL not sure yet, waiting for QA to test it. Anyway 6.1 is already around the corner :)

I always struggle to figure out which dev build the merged PRs in Uno are in, can you tell me which one it's in so I can test this? Would it be in the latest dev-167?

@jeromelaban

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/6.0

@mergify

mergify Bot commented May 30, 2025 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.0

✅ Backports have been created

Details

jeromelaban added a commit that referenced this pull request May 30, 2025
…6.0/pr-20506

fix: Fix pointer and keyboard events not raised on CoreWindow (backport #20506)
DevTKSS pushed a commit to DevTKSS/uno that referenced this pull request May 31, 2025
…owEvents

fix: Fix pointer and keyboard events not raised on CoreWindow
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise the pointer events on CoreWindow

8 participants