Wayland: a touch makes its window Device::focusedWindow and nothing puts the pointer's window back, so the mouse's events go to the touched window #194
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#194
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
For the first finger,
touch_downmakes the touched windowDevice::focusedWindow, and nothing puts the previous one back when the finger lifts.wl_pointer's motion, button and axis events carry no surface and go tofocusedWindow. So with two windows, a touch on one while the pointer is over the other sends the mouse's events to the touched window, in the other window's coordinates. Line numbers refer toc006519.Details
implementations/Crafter.Graphics-Device.cpp:737:focusedWindow = windowintouch_down.touch_up(:749-768) andtouch_cancel(:792-803) leave it as it is.pointer_handle_button(:484-508),PointerListenerHandleMotion(:510-517) andPointerListenerHandleAxis(:549-563) all act onfocusedWindow.PointerListenerHandleEnter(:528) andPointerListenerHandleLeave(:545) set it otherwise.:715-718, "so the clipboard has a serial and Device::focusedWindow a window". The clipboard takes its serial fromDevice::focusedWindow->lastPointerSerial_(implementations/Crafter.Graphics-Clipboard.cpp:238-239).Concrete case
The pointer is over window A, so
focusedWindowis A. A finger taps window B:focusedWindowis B, and stays B after the up. The mouse moves within A.wl_pointer.motionis relative to A's surface, and B getsPointerMovewith those coordinates, then the clicks and the wheel. It lasts until the pointer leaves A, when B gets thePointerLeavecall andfocusedWindowbecomes null, and enters a surface again.With one window there is little to see: after a touch the window is
focusedWindowwithoutmouseInside, which is what the comment intends.Found by reading the code, in the pre-push review of 364d210..c006519. It is older than that range. Not reproduced. Whether a compositor sends the pointer a new enter after a touch elsewhere, which would repair it, was not checked.
Suggested fix
Keep the pointer's window and the touch's apart. Either let the stand-in events use the touch's own window without writing
focusedWindow, and give the clipboard another way to the touched window's serial (touchWindow, or the window the last serial came from); or remember the pointer's window intouch_downand put it back when the primary finger lifts or is cancelled.