Skip to content

backends/native: Disable touch-mode with pointer presence

Carlos Garnacho requested to merge wip/carlosg/pointers-and-touch into master

The original implementation of ::touch-mode tested for keyboard presence to know whether the OSK and other touch-only features were enabled.

However that didn't pan out, every webcam, card reader and kitchen sink like to live a second life as EV_KEY devices. This made the detection of actual external keyboards a much harder task than it sounds, and was thus removed in commit f8e2234c.

Try a different approach here, and test for pointer devices, it doesn't matter if internal or external devices, the rationales:

  • It is significantly easier to get this right, there's virtually no devices with abs/rel axes that don't try to be a real input device of some sorts.
  • It's not as good as testing for keyboard presence, but it's the next best thing. These usually come in pairs, except in weird setups.
  • It is better than not having anything for a number of situations:
    • Non-convertible laptops with a touchscreen will get touch-mode disabled due to touchpad presence (plus keyboard). There's been complains about OSK triggering with those.
    • Same for desktop machines with USB touchscreens, the mouse (and presumably keyboard) attached would make touch-mode get in the middle.
    • Convertible laptops with a broken tablet-mode switch get a chance to work on tablet modes that do disable input devices (e.g. detachable keyboards, or via firmware)
    • Kiosk machines, tablets, and other devices that have a touchscreen but will not regularly have a mouse/keyboard will get the touch-mode enabled.

All in all, this seems to cover more situations the way we expect it, there's only one situation that the OSK would show where it might not be desirable, and one that might not show when it better should:

  • Tablets and kiosk machines that get one keyboard plugged, but not a mouse, will still show the OSK, despite being able to type right away.
  • Convertible laptops with broken/unreliable tablet-mode switch (e.g. ignored by the kernel) rely entirely on the device/firmware characteristics to work. If after folding into tablet mode the touchpad remains active, touch-mode will not turn on. Fixing the tablet-mode switch on these devices should be preferred, as that'll also make libinput magically disable the touchpad.

The latter can be worked around with the a11y toggle. The former is merely inconvenient, and nothing prevents the user from plugging a mouse in addition.

Merge request reports