Thursday, July 10, 2008

Input Device Properties

Another big feature was just pushed to git - input device properties.

You may know about window properties, you may know about RandR output properties. Now we have input device properties too, which are little more than a copy of the above two.

IDP allow you to attach properties to a device. These properties can be of arbitrary type and can be changed without the server having to know their details.
So who uses IDP?
- Drivers: the evdev driver now attaches two properties to enable middle mouse button support at runtime, and to change the middle button timeout. When a client changes such a property, the driver is notified and adjusts accordingly.
- The server: Simon Thum has been working on improved mouse pointer acceleration for a while now [1]. With IDP, the server can attach parameters to the device and use them for smoother acceleration.
- Clients: A client may label the device that is controlled by the dominant hand accordingly, and other clients can utilise this for their interaction methods.

And here's the mandatory "screenshots":

Changing the MB timeout from the default to 500ms.

whot@emu:~$ xinput --list-props "USB Optical Mouse"
Device 'USB Optical Mouse':
Middle Button Emulation: 2
valid values: 0 1 2
Middle Button Timeout: 50
whot@emu:~$ xinput --set-int-prop "USB Optical Mouse" "Middle Button Timeout" 16 500
whot@emu:~$ xinput --list-props "USB Optical Mouse"
Device 'USB Optical Mouse':
Middle Button Emulation: 2
valid values: 0 1 2
Middle Button Timeout: 500


Creating a client-defined property

whot@emu:~$ xinput --set-int-prop "USB Optical Mouse" "foobar" 8 2
whot@emu:~$ xinput --list-props "USB Optical Mouse"
Device 'USB Optical Mouse':
Middle Button Emulation: 2
valid values: 0 1 2
Middle Button Timeout: 500
foobar: 2
[client]

Note the [client] marks this property as created by a client, so you know that changing this property probably won't change anything in the driver/server.

Disclaimer: IDP weren't actually my idea, daniels has been talking about them for a while and I've seen them pop up elsewhere. I merely found the time to implement them.

[1] http://bugs.freedesktop.org/show_bug.cgi?id=8583

2 comments:

  1. Could we please have similar properties for setting the scrollwheel emulation?
    It's currently the only thing really holding me back from binning my xorg.conf!

    ReplyDelete
  2. I would love a property to change the button used for pasting from the paste buffer--I don't know where in the source this is set, but it would be awesome to be able to set this to button 6 or 7 on my mice that have such buttons.

    This is great work!

    ReplyDelete

Comments are moderated thanks to spammers