Gimp has built-in XInput support since Version 1.1.x.
Gimp must know which devices it should use and in what mode. You have to open the File/Dialogs/Input Devices - dialog for setting this up. You will find two listbox-controls at the top of that window labeled Device and Mode . Choose the device to set up from the Device control and choose a mode from the Mode -control.
The modes are:
If you see two cursors linked to your device, you have two solutions:
Below the two listbox-controls there is a tab-control with the two register tabs Axes and Keys . Axes assigns an axis a function, it is mostly not necessary to change this. But think about a touch-screen device which is built in a table rotated by 90 degrees, then you might want to swap the x and y axis.
Some tablets have so called macro keys at the top which may hold some often used functions. The Keys tab lets you assign a character to a macro key. For example, you can put Ctrl+Shift+R, to a macro key. If you activate this key, then the rulers are toggled.
The current Wacom driver supports only the macro keys of the ultrapad series, the macro area of the intuos products is not yet usable for that.
Now we should talk about how the devices can be used. Open the File/Dialogs/Device Status -dialog. Open an image.
You set up each device independently from each other in gimp.
If you move the cursor with different devices in the image window you can see the devices change in the Device Status dialog. If you pick a tool, brush, pattern or color with a device, again the changes are reflected in the dialog. You can save the settings in the Status Dialog, so that they will be restored before your next session.
This is a special device that is always present. It generates an event every time a new device becomes the core pointer. It has a pseudo "axis". The "value" of this axis is the id of the core pointer device. I do not know what a user can do with it - this is mainly helpful for internal use.
The buttons of the devices are as different as the devices are:
A pen has at least a tip, but it may have one or two side switches and an eraser. A mouse may have up to 32 buttons (but usually 3). Buttons are numbered from 1 to the number of buttons. With the next two utilities you can change, to what number a button is mapped.
xmodmap will only modify the Core Pointer. As there is only one Core pointer at a time, it makes no difference between the physical devices which may become the Core Pointer. You may set this device manually with xsetpointer device.
For the moment, let us forget the whole XInput stuff and think of a left-hander who just wants to swap the left and right mouse buttons. You would execute xmodmap -pp to look what the current assignment is. You should get the following table back:
Physical Button Button Code 1 1 # ( Left Button ) 2 2 # ( Right Button ) 3 3 # ( Middle Button )
To swap the buttons, you do a xmodmap -e "pointer = 2 1 3" , and to get back, xmodmap -e "pointer = default" . This should work with every device with at least two buttons. Note that the term "pointer = x x x" has to be quoted to prevent it from being changed by the shell.
Back to XInput now. If you use the gimp, you may want to change the button mapping for each device separately (may be you are happy with the mouse but want to swap the two side-switches of the pen). Frederic Lepied has written a utility called xinput for that.
To swap the side-switches, you would do a xinput list to get a list of the devices and their current settings. Swapping is done with xinput set-button-map Pen1 1 3 2 where Pen1 is the Device to change.
Starting with XFree 3.3.2 this works also with devices that are configured AlwaysCore in XF86Config.
With xsetmode you can change the mode of a device between absolute and relative.
xsetmode GraphireMouse ABSOLUTE .
If you have none of your devices configured AlwaysCore and you want a device to become the core-pointer, then xsetpointer must be used.
Do a xsetpointer Devicename . The old core-device (usually the mouse) is not usable anymore and the one you specified should be active. For example I can make the graphire mouse the standard core device from within a running XFree.
xsetpointer -l lists all devices and the modes they are in.
Some devices have macro keys or pads on them, to which a scancode or string may be assigned. This works only for devices in extension mode and is therefore done in the application you want use the keys with.
xinput -l gives information about the number of keys and things like the first scancode.
I own myself 3 tablets of Wacom and use them on my notebook. Whenever no tablets are connected and I start X, I have to wait very long until the driver gives up. If xdm is used, this increases to multiple of that timeouts.
I have written two utilities which should make live easier with that:
The concept behind this is that a XF86Config file is split in at least a XF86Config.bare file, which holds the information common to all configurations, and various snippets, each of them holding the special information for a particular configuration.
The two utilities will then concat the parts back to a working configuration.
You can get this packet from http://www.runkel-it.de/download , it is named xinput_chooser_sr.