Skip to content

Drag detection in main window is way too sensitive, causing some taps to be "ignored" #4231

@svobs

Description

@svobs

System and IINA version:

  • macOS 13.1
  • IINA 1.3.1 (latest develop: da1e06c)

I've been frustrated by this issue for quite a while now, and although I couldn't find anything via a quick search, I'm pretty sure I've come across at least a couple user reports that noted there was "no way to close the side panel" or that clicking to close didn't work reliably. I finally committed a big chunk of time to tracking it down, and I think I've found the culprit.

To get a better view of how clicks were being registered, I placed these logging statements at the start of these methods in MainWindowController:

  override func mouseDown(with event: NSEvent) {
    Logger.log("MainWindow mouseDown \(event.locationInWindow)", level: .verbose, subsystem: player.subsystem)
...

  override func mouseDragged(with event: NSEvent) {
    Logger.log("MainWindow mouseDrag \(event.locationInWindow)", level: .verbose, subsystem: player.subsystem)
...

  override func mouseUp(with event: NSEvent) {
  Logger.log("MainWindow mouseUp! isDragging: \(isDragging), isResizingSidebar: \(isResizingSidebar), clickCount: \(event.clickCount)", level: .verbose, subsystem: player.subsystem)
...

When I ran IINA with my test logging, I saw messages in the log like these:

01:06:22.638 [player0][v] MainWindow: mouseDown: (247.8671875, 417.46875)
01:06:22.640 [player0][v] MainWindow: mouseDragged: (247.8671875, 417.5859375)
01:06:22.767 [player0][v] MainWindow mouseUp! isDragging: true, isResizingSidebar: false, clickCount=1

This declared my tap was a "drag" (and thus not a click) even though my click lasted for 127ms and the drag distance was only 0.1pt in screen coordinates!

I should point out that I'm using the trackpad on a 16" MacBook Pro M1 Pro. Unlike most developers, I never use a mouse. (It's one of the main reasons I use Macs instead of other operating systems: multi-touch on on Linux/Windows has been almost unusable). And I happen to wear a glove size XL - I've got large hands and fingers. So I can see how this problem may not be noticeable for a mouse user, or someone who has smaller fingers. But for me, Apple's trackpad is so sensitive that it will send a "drag" notification even if my finger does a tiny rolling motion during a tap, or if my motion isn't straight down and up again. This is an unreasonable amount of precision to expect, and it doesn't align with other apps' behavior.

Expected behavior:

If the user does what a reasonable person considers to be a "tap", IINA should respond to it as a tap. It should only think the user is dragging once they drag some very small minimum distance, or hold it down longer than some reasonable time threshold, or both.

Actual behavior:

Sometimes users' taps or clicks are basically ignored because IINA incorrectly concluded that they wanted to quickly move the window by a single pixel or less.

Steps to reproduce:

See above.

How often does this happen?

When trying to close a side panel by tapping the video, there's about a 50-75% chance that my first tap will fail and a second attempt is needed. Probably the frequency varies widely between different users based on their usage patterns, and maybe trackpad users are more affected than mouse users.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions