Skip to content

Conversation

@Thesola10
Copy link
Collaborator

@Thesola10 Thesola10 commented Jan 29, 2024

This closes #764 by implementing a broker function, Utils.getPointerCoords(), which selects from global.get_cursor() and a memorized set of coordinates from the last touch event on Stage.

Hopefully this approach will also correct future touchscreen misbehavior.

Edit 2024-03-09:

This PR has been repurposed as a continuation for accidentally superseded by the broker partly introduced in #791.

@Thesola10
Copy link
Collaborator Author

Thesola10 commented Jan 29, 2024

Currently does not work as coordinates do not seem to update. The way I understand it, the Stage is somehow not the global vantage point I thought it would be events-wise. What I need is an Actor that can intercept every single touch-event in the entirety of GNOME Shell...

@Thesola10 Thesola10 requested a review from jtaala January 29, 2024 22:44
Comment on lines 496 to +497
// move to current cursor position
let [x, y, _mods] = global.get_pointer();
let [x, y, _mods] = Utils.getPointerCoords();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely unwarranted -- if we want touch coords to remain separate from a UX standpoint, this just won't cut it. Then again, I'm not even sure how that may relate to drag-and-drop softlock, so I'll wait until I get my code to work before I undo this change.

@Thesola10
Copy link
Collaborator Author

Another proposal, which fixes the immediate issue of centering touch window movement, is to discard changes to grab.js in this PR, and instead apply this patch:

diff --git a/grab.js b/grab.js
index 5aee3ec..9956e81 100644
--- a/grab.js
+++ b/grab.js
@@ -63,7 +63,7 @@ export class MoveGrab {
 
         this.initialY = clone.targetY;
         Easer.removeEase(clone);
-        let [gx, gy, $] = global.get_pointer();
+        let [gx, gy, $] = Utils.getPointerCoords();
 
         let px = (gx - actor.x) / actor.width;
         let py = (gy - actor.y) / actor.height;

However this is much less elegant and may cause confusion as to the role of Utils.getPointerCoords(), as well as keeping the fugly warp hack from #736.

@Thesola10 Thesola10 added the touchscreen Issue is related to touch screen functionality label Jan 29, 2024
@Thesola10
Copy link
Collaborator Author

Thesola10 commented Jan 30, 2024

Might have to use Clutter.GestureAction but that involves building an entire class just for that. Would've loved to use SwipeTracker.TouchSwipeGesture, but that's private.

@Thesola10 Thesola10 changed the base branch from release to develop January 30, 2024 10:52
Thesola10 added a commit that referenced this pull request 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
Copy link
Collaborator Author

Pushed #791 as an alternate version of this fix, implementing this solution.

Thesola10 added a commit that referenced this pull request 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!
@Thesola10
Copy link
Collaborator Author

I wonder if it's because CLUTTER_EVENT_PROPAGATE causes Clutter to omit followups? Behavior is very inconsistent, it works on the panel so why not the root Stage?

@Thesola10 Thesola10 changed the title Add global coordinates broker to take touchscreen events into account Improve global coordinates broker to track ongoing touch events Mar 9, 2024
jtaala added a commit that referenced this pull request 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.
@jtaala jtaala merged commit 592fea2 into develop Mar 9, 2024
@jtaala jtaala deleted the global-touch-coords branch March 9, 2024 21:09
Thesola10 added a commit that referenced this pull request Mar 9, 2024
Thesola10 added a commit that referenced this pull request Mar 9, 2024
@Thesola10
Copy link
Collaborator Author

Thesola10 commented Mar 9, 2024

huh. this is annoying
I had intended to turn this PR into a develop + revert fbca4 for bookkeeping and stuff, but since i accidentally also pushed the merge commit from #791 this PR is marked as merged as well.

headdesk

@Thesola10 Thesola10 changed the title Improve global coordinates broker to track ongoing touch events Add global touch coords broker Mar 9, 2024
@jtaala
Copy link
Collaborator

jtaala commented Mar 9, 2024

huh. this is annoying I had intended to turn this PR into a develop + revert fbca4 for bookkeeping and stuff, but since i accidentally also pushed the merge commit from #791 this PR is marked as merged as well.

I noticed that - do you need me to revert anything?

@Thesola10
Copy link
Collaborator Author

nah, the branch is still there in the correct state so you can delete it if you want, as long as the comment and commit message are there it's fine

@Thesola10 Thesola10 restored the global-touch-coords branch March 9, 2024 21:41
@Thesola10 Thesola10 deleted the global-touch-coords branch March 9, 2024 21:41
@Thesola10 Thesola10 restored the global-touch-coords branch March 9, 2024 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

touchscreen Issue is related to touch screen functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants