Bug 499576

Summary: [Wayland] zwp_tablet_tool_v2.proximity_in() event is sent with the parent surface, not the subsurface where the event actually occurred
Product: [Plasma] kwin Reporter: acct_cl
Component: wayland-genericAssignee: Joshua Goins <josh>
Status: RESOLVED FIXED    
Severity: minor CC: josh, nicolas.fella
Priority: NOR    
Version First Reported In: 6.2.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=498386
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description acct_cl 2025-02-06 04:54:30 UTC
SUMMARY
My project uses subsurfaces attached to the layer-shell overlay (wlr-layer-shell protocol) with an empty input region. When the tablet tool's cursor enters that subsurface, zwp_tablet_tool_v2.proximity_in() is sent with the parent wl_surface (which, in this case, is the overlay with the empty input region). The protocol description for tablet_v2 doesn't mention how focus works with subsurfaces, but since it's a pointer-like device, I expect the same behavior as with wl_pointer

STEPS TO REPRODUCE
1. Create a layer-shell overlay (e.g., wl_surface object ID 21) and attach subsurface (e.g., wl_surface object ID #300).
2. Move the tablet tool's cursor over the subsurface.
3. Check the console output while running with WAYLAND_DEBUG=1 or log the pointer of the received wl_surface.

OBSERVED RESULT
[1869288.535] {Default Queue} zwp_tablet_tool_v2#4278190081.proximity_in(42833, zwp_tablet_v2#4278190080, wl_surface#21)

EXPECTED RESULT
zwp_tablet_tool_v2.proximity_in with wl_surface#300

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
Kernel Version: 6.12.10-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 9 5900HX with Radeon Graphics
Memory: 31.2 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3080 Laptop GPU/PCIe/SSE2


ADDITIONAL INFORMATION
Project that can be used to demonstrate the issue: https://github.com/CluelessCatBurger/wl_shimeji
Comment 1 Nicolas Fella 2025-02-06 14:31:39 UTC
Needs a fix similar to https://invent.kde.org/plasma/kwin/-/merge_requests/2700
Comment 2 Bug Janitor Service 2025-04-26 15:05:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7563
Comment 3 Zamundaaa 2025-05-05 16:34:03 UTC
Git commit e3e6af69c64fc15b3a7a2f3ffa493d2f7315d374 by Xaver Hugl.
Committed on 05/05/2025 at 16:23.
Pushed by zamundaaa into branch 'master'.

input: set the current surface correctly for tablet events

It ignored subsurfaces and always used the root surface of the window.
Related: bug 498386

M  +6    -6    src/input.cpp
M  +4    -21   src/wayland/seat.cpp
M  +11   -6    src/wayland/surface.cpp
M  +2    -0    src/wayland/surface.h

https://invent.kde.org/plasma/kwin/-/commit/e3e6af69c64fc15b3a7a2f3ffa493d2f7315d374
Comment 4 Zamundaaa 2025-05-05 17:27:15 UTC
Git commit cbea602145d18760e70be264d54126a6ef7ee6e1 by Xaver Hugl.
Committed on 05/05/2025 at 17:09.
Pushed by zamundaaa into branch 'Plasma/6.3'.

input: set the current surface correctly for tablet events

It ignored subsurfaces and always used the root surface of the window.
Related: bug 498386
(cherry picked from commit e3e6af69c64fc15b3a7a2f3ffa493d2f7315d374)

M  +6    -6    src/input.cpp
M  +4    -21   src/wayland/seat.cpp
M  +11   -6    src/wayland/surface.cpp
M  +2    -0    src/wayland/surface.h

https://invent.kde.org/plasma/kwin/-/commit/cbea602145d18760e70be264d54126a6ef7ee6e1