paperwm / PaperWM

Tiled scrollable window management for Gnome Shell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Thesola10 opened this issue · comments

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 :)

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);
}
});