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

Mouse hover during scrolling sometimes janks and focuses the wrong window #259

Closed
ngocphamm opened this issue Apr 20, 2020 · 12 comments
Closed
Labels
bug Something isn't working

Comments

@ngocphamm
Copy link

ngocphamm commented Apr 20, 2020

As mentioned in #256

Tried with 2 mice: Logitech MX Master, and an Elecom trackball. Laptop's trackpad 2-finger scroll is fine though.

image

@lwouis lwouis added the bug Something isn't working label Apr 20, 2020
@ngocphamm
Copy link
Author

A bit of update on more behaviors I've observed, and it looks like it's because of the Ctrl key being held down during.

  1. With Ctrl key being held down, both trackpad and mouse scroll don't work on Firefox too.
  2. With Ctrl key being held down, trackpad scroll works on AltTab window list, but not mouse (this is what reported above)
  3. I just realized from the menu bar icon, I can choose Show to show the window list. When I do that, both trackpad and mouse scroll work properly. That's when I realized it might be the Ctrl key.

@lwouis
Copy link
Owner

lwouis commented Apr 21, 2020

That info you shared is super helpful! It narrows down the issue. It might be a limitation from the OS, or we may be able to override the mouse-scroll event, and force it to happen whatever modifier is pressed. I can't work on this at the moment unfortunately since I don't have a mouse at hand.

@ngocphamm
Copy link
Author

That's no problem at all! For now I can always use the arrow keys (or keep cycling tab key) if I really need to. Also holding my breath for the support of up/down arrow keys 😉

@lwouis
Copy link
Owner

lwouis commented Apr 26, 2020

I found a mouse, and investigated. For me the issue only happens with the shift key, not ctrl. I'm very puzzled by why ctrl would be an issue.

Indeed, the shift key has always be a way to switch from vertical scroll to horizontal scroll on mouses on macOS. I use it all the time. I overrode the scrollwheel function to convert event with the shift key down from horizontal to vertical scrolls. On my machine, that solves the issue of holding shift if it's part of the main AltTab shortcut. It works for both mouse and trackpad.

Going back to you saying that ctrl was the issue for you. You said:

With Ctrl key being held down, both trackpad and mouse scroll don't work on Firefox too.

I downloaded Firefox, and I get the following behavior:

  • scroll => vertical scroll
  • shift + scroll => horizontal scroll
  • ctrl + scroll => zoom the page in/out
  • cmd + scroll => zoom the page in/out

How does ctrl break scroll for you in Firefox? I'm confused.

Could you please test with my local build that fixes the issue with shift?

AltTab.app.zip

Update: the cmd and ctrl keys are actually blocking the scrolling in IntelliJ! How come you have this in Firefox though, and not me?

@ngocphamm
Copy link
Author

Sorry I forgot to mention that I disabled ctrl and cmd scroll in Firefox because I accidentally trigger that way too often and I almost never have to zoom there. That might be the case here.

I disabled the zoom in Firefox by setting mousewheel.with_control.action and mousewheel.with_meta.action to 0 (about:config page)

However, for now I decided to switch AltTab to use Cmd + Tab (replace the OS shortcut) so this is no longer a problem for me. I just tried swiching back to Ctrl + Tab and the issue is still there.

BUT... I think I found the culprit!

I have this app called SteerMouse to add more functionality to my mice, and I just found out by default it set the mice to Ctrl + scroll to Zoom. I didn't even notice this setting in this app (have different settings for when different modifier key is pressed). When I set that to normal scrolling, everything works fine in AltTab again!

Screen Shot 2020-04-26 at 9 07 11 AM

@ngocphamm
Copy link
Author

It's been my own applications causing the isuse, so I apologize for making you invest your time on this. I will close the issue!

@lwouis
Copy link
Owner

lwouis commented Apr 26, 2020

Nono actually it was very interesting to investigate the issue, and even though it was not the original issue you had, i still fixed the issue with the shift key for people who use shift as part of their shortcut.

It was incredibly hard to find how to do it. I had to read about Responsive Scrolling, and find a way to modify the NSEvent without resorting to write objc (Apple has not ported some event handling objc APIs to Swift for some reason).

It also made me realize that the bouncing after a fast trackpad scroll creates a bouncing animation, and that animation doesn't play well with the mouse hover scrolling behavior i added a while ago to help always show mouse hover thumbnails entirely)

I'll re-open the ticket to track these 2 issues. I'll close it when it's merge onto master 👍

@lwouis lwouis reopened this Apr 26, 2020
@ngocphamm
Copy link
Author

ngocphamm commented Apr 26, 2020

It's absolutely inspiring seeing your enthusiasm working on this @lwouis. It's a completely free app yet you are very active with the issue with all the excitement. I'm a programmer myself (not doing apps using XCode though), so I admire you very much!

Do you happen to have a patreon/donation link? I can't give a lot but I want to give some.

@lwouis
Copy link
Owner

lwouis commented Apr 26, 2020

Thank you for the kind words @ngocphamm! Don't worry about donating! People like you make this enterprise worth the time investment. I find great joy thinking about people using this app, or people coming here to discuss things and having great interactions together :)

@lwouis
Copy link
Owner

lwouis commented Apr 27, 2020

I merged the fix for the shift key. Only thing remaining is this weird behavior where if you scroll up or down, and move your mouse while the scrolling animation is still going, it sometimes janks and scrolls to another thumbnail.

I thought it was related to when the view bounces once it reaches the last bit of content, but it's not. It's about mouse hovering while a scroll is happening. It only happens with the trackpad, as the mouse has no inertia-scrolling.

@lwouis lwouis changed the title Scrollbar not scrollable using external mouse Mouse hover during scrolling sometimes janks and focuses the wrong window Apr 27, 2020
@ngocphamm
Copy link
Author

ngocphamm commented Apr 27, 2020

I'm not sure about the technical side of the behavior, but I guess some other mice can also have inertia-scrolling-like feature, like the Logitech Master MX. Please let me know if you want me to test it for you, as I do have that mouse.

@lwouis
Copy link
Owner

lwouis commented Apr 27, 2020

I can reproduce with the trackpad locally so reproduction is fine. The issue is understanding why it's happening. I think i'll film with my iphone in slow-mo to better understand what's happening as it happens so fast.

There are a lot of subtleties with scrolling behavior for instance it took me a while to realize yesterday that if you scroll then move your mouse, the OS will slow down the previous scroll, probably because they assume you want to act now so they stop the inertia quickly

@lwouis lwouis closed this as completed in c7e5daa Jun 7, 2020
lwouis pushed a commit that referenced this issue Jun 7, 2020
## [4.1.1](v4.1.0...v4.1.1) (2020-06-07)

### Bug Fixes

* mouse hover during scroll bounce produced visual jank (closes [#259](#259)) ([c7e5daa](c7e5daa))
* sometimes switching apps wouldn't be noticed ([96a6ae6](96a6ae6))
* update korean localizations ([cec2756](cec2756))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants