[PR #5131] Manually pass mouse wheel messages to TermControls #26134

Closed
opened 2026-01-31 09:14:11 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/5131

State: closed
Merged: Yes


Summary of the Pull Request

As we've learned in #979, not all touchpads are created equal. Some of them have bad drivers that makes scrolling inactive windows not work. For whatever reason, these devices think the Terminal is all one giant inactive window, so we don't get the mouse wheel events through the XAML stack. We do however get the event as a WM_MOUSEWHEEL on those devices (a message we don't get on devices with normally functioning trackpads).

This PR attempts to take that WM_MOUSEWHEEL and manually dispatch it to the TermControl, so we can at least scroll the terminal content.

Unfortunately, this solution is not very general purpose. This only works to scroll controls that manually implement our own IMouseWheelListener interface. As we add more controls, we'll need to continue manually implementing this interface, until the underlying XAML Islands bug is fixed. I don't love this. I'd rather have a better solution, but it seems that we can't synthesize a more general-purpose PointerWheeled event that could get routed through the XAML tree as normal.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

I've also added a til::point conversion to winrt::Windows::Foundation::Point, and some scaling operators for point

Validation Steps Performed

  • It works on my HP Spectre 2017 with a synaptics trackpad
    • I also made sure to test that tmux works in panes on this laptop
  • It works on my slaptop, and DOESN'T follow this hack codepath on this machine.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/5131 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request As we've learned in #979, not all touchpads are created equal. Some of them have bad drivers that makes scrolling inactive windows not work. For whatever reason, these devices think the Terminal is all one giant inactive window, so we don't get the mouse wheel events through the XAML stack. We do however get the event as a `WM_MOUSEWHEEL` on those devices (a message we don't get on devices with normally functioning trackpads). This PR attempts to take that `WM_MOUSEWHEEL` and manually dispatch it to the `TermControl`, so we can at least scroll the terminal content. Unfortunately, this solution is not very general purpose. This only works to scroll controls that manually implement our own `IMouseWheelListener` interface. As we add more controls, we'll need to continue manually implementing this interface, until the underlying XAML Islands bug is fixed. **I don't love this**. I'd rather have a better solution, but it seems that we can't synthesize a more general-purpose `PointerWheeled` event that could get routed through the XAML tree as normal. ## References * #2606 and microsoft/microsoft-ui-xaml#2101 - these bugs are also tracking a similar "inactive windows" / "scaled mouse events" issue in XAML ## PR Checklist * [x] Closes #979 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments I've also added a `til::point` conversion _to_ `winrt::Windows::Foundation::Point`, and some scaling operators for `point` ## Validation Steps Performed * It works on my HP Spectre 2017 with a synaptics trackpad - I also made sure to test that `tmux` works in panes on this laptop * It works on my slaptop, and DOESN'T follow this hack codepath on this machine.
claunia added the pull-request label 2026-01-31 09:14:11 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26134