Monday, November 15, 2010

XKB mouse emulation removed from default keymap

XKB has a feature referred to as "MouseKeys" or in the case of xkeyboard-config "PointerKeys". Once enabled, the keypad controls the pointer movement and can be used to emulate button events. The default keymap hat the PointerKeys toggle on Shift+NumLock.

Like so many other things, it is a low level feature that has virtually zero desktop integration. The only way to find out whether it is on or not is to hit a key and see the mouse cursor move. That of course requires you to already know about the feature.

If you've accidentally enabled it the only thing you may notice is that your keypad stopped working. Worse, with a nasty bug we had in servers 1.7 and later (fixed now), the mouse buttons would get stuck when PointerKeys was used intermixed with physical mouse button presses. I've received a fair number of bug reports and other complaints about this feature that I finally decided to remove it from the default options. Sergey has pushed the patch to the xkeyboard-config repository over the weekend, so expect that in xkeyboard-config 2.1 and later, PointerKeys will need to be explicitly enabled.

You can do so with the XKB option "keypad:pointerkeys", or by ticking the "Toggle PointerKeys with Shift + NumLock" checkbox in your desktop keyboard configuration UI.

Like the changed zapping behaviour and the middle button emulation default (both of which have completely failed to bring the world to an end, despite claims to the contrary), this is only a changed default. The feature is still there and can be re-enabled on-the-fly or permanently if needed.

7 comments:

Anarion said...

By chance, does this have anything related to bug https://bugs.edge.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/636311 in Ubuntu?

id said...

I don't know how people use MouseKeys, but I suspect it's often a last resort solution whenever one get stuck on a badly configured X Server, from LiveCDs and such (it still happens more often than we would all like)-- in this case, unlike zapping, MouseKeys are really an accessibility feature: stuck on a foreign environment without a working pointing device, not having it gives you one less opportunity to use a system: in some extreme cases. you might not even be able to turn it back on (if you don't know the key shortcuts, etc.).

I understand it will now be the responsibility of the various packagers to turn it on at their discretion... Just a suggestion that might ease things up: would there be a way to turn MouseKeys on by default when no core pointer is found?

Peter Hutterer said...

the concept of the core pointer is dead and you'd be hard-pressed to find a configuration that truly has no input devices.

besides, in virtually all cases, if the setup is so broken that you don't have a working pointer device, you also don't have a working keyboard device.

id said...

I clearly don't have your intimate knowledge of X11, so my terminology might be off... Are you saying you have no way of knowing during server initialization if the virtual core pointer has been connected to at least one meaningful, working physical device?

I volunteer to my local linux installfest twice a year. Then, I might setup 5 to 8 laptops on a variety of modern distros. Each time for the last couple of years, I always stumbled upon at least one case where there is a working keyboard under X, but no trackpad.

Peter Hutterer said...

yes, that's pretty much it. run xinput list and look at the list of devices. there are several that aren't input device but look like ones to the X server.

sorry, in my previous comment I was only thinking of keyboard/mouse devices, forgot about trackpads.
trackpads are a different matter, they are usually run by the synaptics driver and thanks to screwy hardware the driver struggles a lot more than evdev does with keyboard and mouse devices.

Cristian Ciupitu said...

If you've accidentally enabled it the only thing you may notice is that your keypad stopped working.

Ha, ha, ha! It has happened to me a couple of times, including yesterday, and I've wondered every time if the numpad is broken. Thanks to your post, now I know what's going on.

Andrew said...

The following command seems to only enable shift-numlock as a toggle:

setxkbmap -option keypad:pointerkeys

It does not actually enable mousekeys. Is there another option to actually turn on mousekeys directly?