Repository navigation
fix: pen buttons on GNOME 48+ and touch scrolls after a pen action - #493
Conversation
GNOME 48 changed the stylus button defaults (gsettings-desktop-schemas f25d3e7c): the lower button became a right click and the upper one a middle click, and mutter rewrites the pen's buttons by them, so a background right click arrived as a middle click. The server now sets both actions for its own pen and resets them with the pen. libinput pairs a tablet with the first touchscreen it sees and drops every touch while the pen is in proximity and for 90 ms after it leaves, so a scroll after a click sent nothing. A scroll now lifts a hovering pen first. The GNOME seat fixture now runs with GNOME 48's stylus defaults, scrolls after a pen click, and repeats the clicks, a drag and a scroll on Chromium under native Wayland and Xwayland.
There was a problem hiding this comment.
This is an auto review done by revuto.
One finding, in the multi-server case this module already guards with process_lock: the stylus button actions are written once per pen but reset by any server whose pen goes away, so a surviving server's pen falls back to the GNOME 48+ defaults and its right and middle clicks swap again. The scroll change (lift a hovering pen, wait 150 ms) reads correctly: it runs under the DEVICES lock, so the reaper cannot race it.
Not verified here: mutter's behaviour itself. This review had no network or mutter sources and ran nothing, so the key-to-button mapping and the settings path rest on the PR's own measurements.
| if self.wrote_output { | ||
| reset_output(Kind::Pen); | ||
| } | ||
| reset_stylus_actions(); |
There was a problem hiding this comment.
This is an auto review done by revuto.
This reset is shared across servers, but the matching write is not repeated, so one server going away re-swaps the buttons for another server's live pen on GNOME 48+.
Every server uses the same vendor and product id, so they all share the one default-6375:7065 path (the ProcessLock comment says as much). set_stylus_actions() runs only inside if devices.pen.is_none() in run_pen, i.e. once per pen. The sequence that breaks:
- Server A makes its pen and writes
middle/right. - Server B makes its pen and writes the same.
- B exits or idles out after 600 s.
Pen::dropresets both keys to the schema defaults. - A's pen is still alive, so A never writes them again. On GNOME 48+ its next
button: "right"click arrives as a middle click, and the call still reportsused: true.
This depends on mutter re-reading the tool's button map on each proximity-in rather than once per tool. That is my reading of mutter (tool-changed → apply_stylus_settings), not something I could check here. If it holds, every click hits it, because hover(.., true) leaves and re-enters proximity.
The output key does not have this problem: covering_area re-checks the mapping before every gesture and rewrites it when it differs. The button actions have no such re-check.
Two ways to fix it:
- Call
set_stylus_actions()on everyrun_pen, under the process lock thatperformalready holds, before the fresh proximity-in. - Drop the reset on
Drop. The path belongs only to this server's own ids, so a leftover value affects no other device (the fixture's'stylus' not in dumpcheck would then need to change).
|
Fresh-context review: PR #493 at 6f64596 I read the diff and the head versions of src/virtual_pen.rs and scripts/virtual_pen_test.py, and checked the upstream claims against current source: mutter main and gnome-46 (meta-input-settings.c, native/meta-input-settings-native.c, native/meta-seat-impl.c, native/meta-input-device-tool-native.c), libinput main (evdev-tablet.c, evdev-fallback.c), gsettings-desktop-schemas f25d3e7c, GTK gdkseat-wayland.c and Chromium wayland_tablet_tool.cc. I did not build, run or send any input. High
Medium (already there before this PR; the PR's own libinput analysis brings it up)
Low
Checked and correct
|
Review findings on the pen follow-up: - Every server's pen shares one stylus settings path, so one server's reset left another's pen on GNOME 48's swapped defaults. The actions are now written before every action, under the process lock. - A hovering pen silences the touchscreen libinput paired it with, which can be the user's own. The pen now leaves proximity after each action instead of hovering 8 s, and a scroll waits out libinput's 90 ms. - A new touchscreen's first pan never reached the window: mutter lists it before mapping it. The first touch now waits 300 ms. The fixture runs with GNOME 48's stylus defaults compiled into the session's schemas, adds a second server whose pen comes and goes, takes the Xwayland display from mutter's log, and checks that the pen leaves proximity after a click.
|
Addressed the fresh-context review in 75ecebe:
New finding while fixing 2: with the hover gone, a fresh touchscreen's first pan never reached the window, because mutter lists the device before mapping it. The hover had hidden this. The first touch now waits 300 ms; the fixture's first scroll covers it. |
There was a problem hiding this comment.
This is an auto review done by revuto.
Revuto completed the review and found no evidence-backed concerns.
logind starts a getty on the active terminal when no session holds it, and one left from the previous run took tty6 back about ten seconds in and hung up GNOME Shell's session: every second back-to-back run failed, on main too. The getty is masked with --runtime for the run and unmasked after. Four back-to-back runs now pass.
There was a problem hiding this comment.
This is an auto review done by revuto.
Revuto completed the review and found no evidence-backed concerns.
|
Fresh-context re-review: delta 6f64596...ccb2de6 I reviewed only the delta (75ecebe and ccb2de6), with the same rules as before. I did not build, run anything or send any input. To check the delta's claims I read mutter gnome-46 The earlier findings
New findingsLow
Nits
No High or Medium findings in the delta. |
- The stylus actions are written right before the pen enters proximity, and only the ones that differ, so an unchanged setting sends no signal. - The idle reaper removes the devices only under the process lock (their reset touches settings every server's pen shares); shutdown waits up to 10 s for it. - A pen action holds the process lock 200 ms past the pen's leave, so no server's scroll starts inside libinput's 90 ms touch arbitration. - The fixture checks the second server's click went through its pen.
|
Re-review findings, addressed in 3a0cd24:
Nits: Fixture: two back-to-back passes on the dev desk; fmt, clippy, tests, MCP safety, plugins and the Pi catalog pass. |
Follow-up to #489 (refs #480).
What changes
button-action(lower button, BTN_STYLUS) becamerightandsecondary-button-action(upper, BTN_STYLUS2)middle. Mutter rewrites a tool's buttons by those actions before a client sees them (meta-seat-impl.c, the tool button map), so on GNOME 48+ the feat: background pointer input on GNOME through a virtual pen #489 mapping (right = upper button) arrived as a middle click. That is why the GNOME Wayland: let Computer Use click without moving my mouse #480 reporter found the lower button gives a right click in Chromium. GNOME 46 and 47 default todefault, which passes the code through. Every client agrees on the bare codes: GTK (gdkseat-wayland.c), Xwayland (xwayland-input.c), Chromium ozone (wayland_tablet_tool.cc) and KWin all map BTN_STYLUS to middle and BTN_STYLUS2 to right. So the server now writes both actions (middle,right) for its own pen's tool, at/org/gnome/desktop/peripherals/stylus/default-6375:7065/(a uinput pen has no serial, so mutter keys it by vendor and product id), before the pen exists, and resets them when the pen goes away. Every GNOME then delivers the code the pen pressed. No per-toolkit mapping is needed.tablet_toggle_touch_device), and for 90 ms after it leaves (evdev-fallback.c, the arbitration timer). The pen hovered 8 s after each action, so a scroll in that time sent nothing although the call reported it sent. feat: background pointer input on GNOME through a virtual pen #489's fixture passed only because its scroll created the touchscreen while the pen already hovered. Worse, the paired touchscreen can be the user's own, which then ignored touch for 8 s after every background click. The pen now leaves proximity at the end of each action, and a scroll waits out the 90 ms (200 ms from the pen's leave).Tests
scripts/virtual_pen_test.py(opt-in seat0 GNOME Shell 46 fixture, dev desk):/tmp/.X11-unix.pointerType: "pen"events with the named button (contextmenufor right,auxclickbutton 1 for middle), adblclick, pen moves between the drag's ends, and the list must scroll. No mouse button event may reach the page.Results on the dev desk, Google Chrome 158, GNOME Shell 46:
auxclickfor right andcontextmenufor middle. The second GTK scroll and both Chromium scrolls never pan, andlibinput debug-eventsshows no touch events after the first scroll.fmt, clippy
-D warnings,cargo test --no-fail-fast,mcp_safety_check.py,check_plugins.shand the Pi catalog--checkpass on the dev desk.KWin support and the hover question follow in a separate PR.