Sunday, August 29, 2010

Fixing Wacom Aspect Ratio in Linux

Older Wacom tablets have a 4:3 or 5:4 aspect ratio, while modern monitors have 16:9 or 16:10, this leads to a distortion of the drawing area. One can get used to it, but one can also easily fix it by using xinput, by issuing a command like this:

xinput set-int-prop "Wacom Intuos2 6x8" "Wacom Tablet Area" 32 0 1770 20320 14470

This will change the active area on the tablet to the last four numbers on the line, which are left, top, right and bottom, different tablets will need different numbers, just calculate them from the default ones. The 32 in that line is just there to tell xinput that we are providing a 32bit integer, it is not a configuration parameter for the Wacom device itself.

The name of the tablet varies, to find out the correct one, one uses:

xinput list

There are also plenty of other configuration parameters that one can tweak, a full list is available with:

xinput list-props "Wacom Intuos2 6x8"

This list also includes the current values of all the properties, so if you don't know what the area of your Wacom is, you can use it to look it up.

Note that a Wacom tablet will normally show up as multiple devices, your pen is one, your eraser is another and the mouse is yet another, so you might want to change the active area for all those devices, not just one. Making changes with xinput is not persistent, so after every restart of Xorg, it will be back to its default values.

An alternative way to accomplish this is described in the Ubuntu Documentation, which works by using the KeepShape option in xorg.conf.

Friday, August 13, 2010

XInput Support in Wine

Wine currently lacks XInput support, which means that one can't use gamepads in many modern games. So I did a bit of Wine hacking, temporary results are in this patch and they work with the SimpleController.exe example from the Microsoft SDK.

Some notes about the patch:
  • behaviour on window focus-leave/enter is wrong (disconnects the controller, instead of just disabling events)
  • it only works with xboxdrv, not with xpad (due to the different order of buttons)
  • I so far only implemented the bare minimum to get SimpleController.exe to run, so some parts of the API are still missing and it might not work with a full game
  • it is a quick&dirty patch, proper patch would need some magic to detect the controller dynamically
  • no rumble
Patch is against the Wine git repository.