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

Window touch drag-and-drop starts at pointer, not at finger #764

Closed
Thesola10 opened this issue Jan 29, 2024 · 1 comment · Fixed by #766
Closed

Window touch drag-and-drop starts at pointer, not at finger #764

Thesola10 opened this issue Jan 29, 2024 · 1 comment · Fixed by #766
Assignees
Labels
bug Undesirable behavior touchscreen Issue is related to touch screen functionality

Comments

@Thesola10
Copy link
Collaborator

Thesola10 commented Jan 29, 2024

Describe the bug
This is a technical addendum to #736. The way touch-based window dragging works, the initial coordinates when grabbing begins is used to determine the relative pointer position to the window using the global pointer. However, just as in #735, the global pointer cannot be used as a coordinates source for touch events.

This bug exists mainly as a self reminder, though anyone is free to pick it up.

To Reproduce

  1. Tap and hold a window titlebar with a touch screen
  2. Drag the window

Expected behavior
Same behavior as mouse-based drag-and-drop

Screenshots
The window jumps relative to where the pointer was when the gesture started

System information:
Irrelevant -- trust me :)

@Thesola10 Thesola10 added bug Undesirable behavior touchscreen Issue is related to touch screen functionality labels Jan 29, 2024
@Thesola10 Thesola10 self-assigned this Jan 29, 2024
@Thesola10
Copy link
Collaborator Author

Thesola10 commented Jan 29, 2024

Any solution would require retrieving touch coordinates before a touch event is explicitly captured, just as MoveGrab.begin() is being called.

Either we need to keep track of the global stage's last touch event (and while we're at it, develop a pointer broker between cursor and touch events), or a touch event context must be extracted from the window grab event... somehow...

let [gx, gy, $] = global.get_pointer();

Above is the exact line of code where touch-based coordinates are required but cannot be retrieved using touch events like below:

PaperWM/grab.js

Lines 88 to 95 in 35afc1a

this.signals.connect(this.actor, "touch-event", (act, evt) => {
if (evt.type() === Clutter.EventType.TOUCH_END) {
this.end();
}
else {
this.motion(act, evt);
}
});

Thesola10 added a commit that referenced this issue Mar 5, 2024
This approach calls Utils.getPointerCoords() (the unified touch broker)
when the event starts ONLY. Since the touch tracker fails to update once
the event is "adopted" by a widget, we still need to update the global
cursor's coordinates.

This superficially fixes #764, but REVERT this commit before working on
cleaning up touch handling!
Thesola10 added a commit that referenced this issue Mar 8, 2024
This approach calls Utils.getPointerCoords() (the unified touch broker)
when the event starts ONLY. Since the touch tracker fails to update once
the event is "adopted" by a widget, we still need to update the global
cursor's coordinates.

This superficially fixes #764, but REVERT this commit before working on
cleaning up touch handling!
jtaala added a commit that referenced this issue Mar 9, 2024
This PR functionally fixes #764 but is non-ideal from a code quality
standpoint. The cleaner version and discussion around it is and should
remain in #766, this PR is a hotfix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesirable behavior touchscreen Issue is related to touch screen functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant