Skip to content
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

Touchpad scrolling not possible #979

Closed
Paul-Weisser opened this issue May 24, 2019 · 71 comments · Fixed by #5131
Closed

Touchpad scrolling not possible #979

Paul-Weisser opened this issue May 24, 2019 · 71 comments · Fixed by #5131
Assignees
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@Paul-Weisser
Copy link

Environment

Windows build number: Microsoft Windows [Version 10.0.18898.1000]
Windows Terminal version (if applicable): pulled and built today (WindowsTerminalDev_0.0.1.0_x64__8wekyb3d8bbwe)

Steps to reproduce

Not entirely sure if this is intended behaviour or an issue to other users but I am not able to scroll through the new terminal with my touchpad on my Notebook (Alienware).

It works with my mouse but not with the touchpad. I can scroll through the native console/ poweshell though. Can somebody reproduce this?

Expected behavior

That I can scroll through the curren window-history using two-finger-touch on the touchpad.

Actual behavior

It wont scroll.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 24, 2019
@Paul-Weisser Paul-Weisser changed the title Bug Report Touchpad scrolling not possible May 24, 2019
@zadjii-msft
Copy link
Member

Can you try setting a breakpoint in TermControl::_MouseScrollHandler to see if that's getting hit?

Two-finger scrolling works just fine with my surfacebook, so I'm thinking that it's something specific to your device.

@zadjii-msft zadjii-msft added Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Product-Terminal The new Windows Terminal. labels May 24, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 24, 2019
@Paul-Weisser
Copy link
Author

Okay I'm starting to feel a little stupid. I cleaned the solution and build CascadiaPackage on Debug x64 with the breakpoints in TermControl::_MouseScrollHandler but it wont stop there.

I need a little help how to get VS (2019) stopping at this class...

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 24, 2019
@DHowett-MSFT
Copy link
Contributor

You might be in need of this debugging doc.

@DHowett-MSFT DHowett-MSFT added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels May 24, 2019
@zadjii-msft
Copy link
Member

Maybe try something that you can be sure is hitting, like TermControl::_KeyDownHandler

@Paul-Weisser
Copy link
Author

Paul-Weisser commented May 24, 2019

Thanks @DHowett-MSFT, missed that one!

But now with a working debug-mode there are several memory-violation-exceptions popping by twinapi.appcore.dll which my VS for some reason cannot ignore... (The terminal does not crash though)
So I am not able to reach the breakpoints...

grafik

Since it seems like nobody else is having these issues I will let it be and accept the fact, that something is wrong with my maschine. But I think its still interesting, that the new terminal is the only app where I am unable to scroll with two fingers.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 24, 2019
@rehnarama
Copy link

I have this issue as well though!

My touchpad uses the Synaptics ClickPad drivers, not microsoft precision drivers, perhaps there is an issue there?

@rehnarama
Copy link

rehnarama commented May 26, 2019

@zadjii-msft , After some debugging:

Can you try setting a breakpoint in TermControl::_MouseScrollHandler to see if that's getting hit?

Two-finger scrolling works just fine with my surfacebook, so I'm thinking that it's something specific to your device.

The PointerWheelChanged handler bound to TermControl::_MouseScrollHandler is never called.

Maybe try something that you can be sure is hitting, like TermControl::_KeyDownHandler

All other pointer handlers (and key handlers) work as expected.

@Paul-Weisser Paul-Weisser reopened this May 26, 2019
@Paul-Weisser
Copy link
Author

@rehnarama
I tried both, Microsoft and synaptics drivers
Maybe it's an locale issue (I'm on a German locale)
Since there have been other issues regarding locale and getting user-input right?

@rehnarama
Copy link

rehnarama commented May 27, 2019

@rehnarama
I tried both, Microsoft and synaptics drivers
Maybe it's an locale issue (I'm on a German locale)
Since there have been other issues regarding locale and getting user-input right?

Could be, (Swedish locale here at least). I've also tried a minimal UWP app, and there were no problem with firing the PointerWheelChanged event there.


I've just now noticed that, when disabling "Scroll Inactive Windows" in settings, the scrolling with an external mouse becomes unreliable as well! With unreliable I mean it works sometimes (when hovering over rendered text?), and then suddenly stops working (usually when trying to scroll empty area, but not always).

Since scrolling inactive windows doesn't work with synaptics drivers, it might be a focusing issue of some sorts? Or perhaps turning off "Scroll Inactive Windows" setting would be a seperate issue?

@zadjii-msft
Copy link
Member

I really doubt that locale would affect mouse input, but I guess I'm not an expert in the input stack.

The "scroll inactive windows think" might be a good lead on tracking this bug down though. Considering I don't believe anyone on the dev team has a device this is reproing on, the more help we can get the better :)

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels May 28, 2019
@Paul-Weisser
Copy link
Author

I can't dig into this for the next four weeks...
If nobody else fixes this until then I will have a closer look (after I fixed the weird memory access violation...)

@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label May 28, 2019
@wolf99
Copy link
Contributor

wolf99 commented Mar 19, 2020

Doesn't work for me either.

Terminal 0.10.761.0
Windows: 1909 (18363.720)

This hasn't worked for me since I first installed WT last year. Mouse wheel scrolling hasn't worked either (haven't tried that with the 0.10 release yet though), is there a separate issue for mouse wheel scrolling or should that be covered here also?

@zadjii-msft
Copy link
Member

@wolf99 I'm sure that there's another issue that's tracking the mouse scrolling not working, but this one isn't it. I fortunately have a personal HP laptop that repros this bug with it's touchpad, so I'm going to be using that to debug and investigate. However, I'd doubt that this investigation would also apply to all mouse devices. I don't want you thinking that resolving this issue will also fix your mouse issue.

@wolf99
Copy link
Contributor

wolf99 commented Mar 19, 2020

@zadjii-msft Just tried 0.10 release with mouse, it's working now! 😄
Glad you're able to repro the track pad issue as it is affecting a lot of people by the look of this issue.

@zadjii-msft
Copy link
Member

zadjii-msft commented Mar 24, 2020

Oh no this is horrifying.

This might not apply super broadly, but this is what I've found with my investigation this morning. I've got a HP Spectre 2017 x360 that I use at home, with a touchpad using the synaptics drivers.

From what I can tell, the Synaptics touchpads don't support "Scroll inactive windows" at all. notepad.exe, the Settings app, nothing. Even with "Scroll inactive windows when I hover over them" enabled.
image
I'm positive that the trackpad is the problem here, because using an external mouse works fine for both scrolling inactive windows and the Terminal on this laptop.

Turns out, this is a very broad problem. Even info from 3 years ago points at solutions that are decades old (and not verified).

What does this have to do with the Terminal?

As it turns out, XAML Islands, which we're using to host our XAML content (read: the entire UI), uses an inactive HWND to host the XAML content. So we're never even getting the mouse events in TermControl::_MouseScrollHandler. This issue is more specifically being tracked by #2606 and microsoft/microsoft-ui-xaml#2101. I'm betting that this is also going to be the root cause of this issue here.

I'm going to investigate if our root HWND gets the trackpad scrolling events that the XAML Island is ignoring. Maybe I can manually forward them to the XAML island somehow? I'm not overly optimistic at this point.

/cc @Austin-Lamb @ocalvo

@pamtbaau
Copy link

@zadjii-msft, I'm using a Lenovo B590 using Synaptics Touchpad v7.5 drivers.

notepad.exe scrolls fine. In fact, every app scrolls fine, except Microsoft Terminal...

Any other app you would like me to test?

@Uxorious
Copy link

FYI: A few releases back, it started working for me on an HP Spectre x360 with Synaptics drivers.
I can also scroll background/inactive windows.

@dkter
Copy link
Contributor

dkter commented Mar 24, 2020

@pamtbaau

notepad.exe scrolls fine.

does it scroll when you have another window in the foreground? (i.e. open two windows side by side, then try to scroll the inactive one.)

@pamtbaau
Copy link

@dkter, @zadjii-msft 🤦‍♂ You're right, it doesn't work...

@Uxorious
Copy link

Huh that is really interesting.
For me it works sometimes - but it depends on what the FOREGROUND app is.

For example, I tried it earlier with Outlook in the foreground and Notepad in the background.
That worked.

But when I received this last mail, I tried it again. This time with Chrome/Gmail in the foreground.
This does NOT work.

@msbrunoalves
Copy link

Oh no this is horrifying.

This might not apply super broadly, but this is what I've found with my investigation this morning. I've got a HP Spectre 2017 x360 that I use at home, with a touchpad using the synaptics drivers.

From what I can tell, the Synaptics touchpads don't support "Scroll inactive windows" at all. notepad.exe, the Settings app, nothing. Even with "Scroll inactive windows when I hover over them" enabled.
image
I'm positive that the trackpad is the problem here, because using an external mouse works fine for both scrolling inactive windows and the Terminal on this laptop.

Turns out, this is a very broad problem. Even info from 3 years ago points at solutions that are decades old (and not verified).

What does this have to do with the Terminal?

As it turns out, XAML Islands, which we're using to host our XAML content (read: the entire UI), uses an inactive HWND to host the XAML content. So we're never even getting the mouse events in TermControl::_MouseScrollHandler. This issue is more specifically being tracked by #2606 and microsoft/microsoft-ui-xaml#2101. I'm betting that this is also going to be the root cause of this issue here.

I'm going to investigate if our root HWND gets the trackpad scrolling events that the XAML Island is ignoring. Maybe I can manually forward them to the XAML island somehow? I'm not overly optimistic at this point.

/cc @Austin-Lamb @ocalvo

That probably explains why scroll doesn't work with VMWare or Virtualbox either

@mquevill
Copy link

Huh that is really interesting.
For me it works sometimes - but it depends on what the FOREGROUND app is.

For example, I tried it earlier with Outlook in the foreground and Notepad in the background.
That worked.

But when I received this last mail, I tried it again. This time with Chrome/Gmail in the foreground.
This does NOT work.

I have the same behavior on my system. Scrolls fine with the touchpad while inactive when Settings is in the foreground; does not scroll when Chrome is in the foreground.

When the window is active, my touchpad will not scroll at all. Mouse wheel works fine (in all cases). But I have never run into issues with any other applications with my touchpad (granted, it's an older model).

Windows Terminal 0.10.781.0
Windows 10 Pro 1909 (18363.720)
Synaptics Driver 19.2.17.55

@zadjii-msft
Copy link
Member

Thanks for the clarification everyone! It seems like on my machine, I can also repro this behavior where different foreground apps change whether an inactive window can be scrolled or not. This is an incredibly peculiar bug, which might be partially related to this. I'm still trying to work on a workaround, but we'll see if that's possible or not :/

zadjii-msft added a commit that referenced this issue Mar 25, 2020
  Also for good measure, let's link this to #979
@Paul-Weisser
Copy link
Author

@zadjii-msft Just checked out the branch you referenced. Looks promising! Fixes this issue for me 👍

BTW: Props to your commit messages 🥇

@ghost ghost added the In-PR This issue has a related PR label Mar 26, 2020
@ghost ghost closed this as completed in #5131 Apr 1, 2020
@ghost ghost removed the In-PR This issue has a related PR label Apr 1, 2020
ghost pushed a commit that referenced this issue Apr 1, 2020
## 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.
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Apr 1, 2020
@wolf99
Copy link
Contributor

wolf99 commented Apr 1, 2020

Props on the effort here @zadjii-msft !
I look forward to this landing on my machine 👨‍💻

@ghost
Copy link

ghost commented Apr 22, 2020

🎉This issue was addressed in #5131, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.:tada:

Handy links:

@mysticatea
Copy link

I have confirmed that my ThinkPad Compact USB Keyboard with TrackPoint can scroll Windows Terminal. Thank you very much!

@waelkdouh
Copy link

It now works on my surface book. Thanks.

@wolf99
Copy link
Contributor

wolf99 commented May 2, 2020

Can confirm this is working on my HP Envy. Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.