You are not logged in.

#1 2012-05-25 22:59:38

woah
Member
Registered: 2008-09-16
Posts: 12

[SOLVED] wacom + multi-head setup - X cursor and XInput inconsistency

UPDATE: This is SOLVED.  See bottom of post for solution(s).

Hello,

I just recently got a Wacom Cintiq 12wx working on an archlinux install.  This computer has an ATI Radeon HD 6770 (eyefinity support, using AUR catalyst drivers) and triple head monitor setup (Xinerama--I don't think the catalyst driver supports xrandr).  The Cintiq's LCD is acting as the third screen head in this setup and is 1280x800.  The first and second screen heads are both 1280x1024.

What are probably relevant package versions for this thread:
xorg-server 1.11.4-1 (using the [xorg111] packages due the catalyst 12.4 incompatabilities with later xorg-server versions)
xorg-xinput 1.6.0-1
xinput_calibrator 0.7.5-3
xf86-input-wacom 0.13.0-1 (I've tried the AUR's xf86-input-wacom-git--no difference)
wacom-udev 20120501-1
catalyst 12.4-1
catalyst-utils 12.4-1

The udev rules included in the AUR package 'wacom-udev' resulted in the "wacom" /dev/input/ entries below, but they are symlinks to /dev/input/event7 anyway

woah@5 ~ $ ls -w 1 /dev/input/
by-id/
by-path/
event0
event1
event2
event3
event4
event5
event6
event7
mice
mouse0
mouse1
tablet-cintiq-12wx@
wacom@
wacom-stylus@

woah@5 ~ $ readlink /dev/input/tablet-cintiq-12wx
event7

woah@5 ~ $ readlink /dev/input/wacom
event7

woah@5 ~ $ readlink /dev/input/wacom-stylus
event7


My /etc/X11/xorg.conf is below, but first a few points of info on it:
1) It was originally generated by "aticonfig --initial --heads=3 --signal-block=off," and then tweaked to add the "InputDevice" entries for the wacom stylus, eraser, and pad.  Without adding the "InputDevice" entries, the stylus, eraser, and pad could only be referenced by an automatically generated numerical identifiers (listed by "xsetwacom --list devices").  By having the InputDevice entries I can give them the textual names of "stylus," "eraser," and "cursor".  The actual behavior seems to be identical whether or not I have these entries.
2) Oddly enough, even though /dev/input/wacom and /dev/input/wacom-stylus are symlinks to the same /dev/input/event7, the stylus only works if /dev/input/wacom is used in the InputDevice sections.
3) The "--signal-block=off" solves a deadlocking issue with GoldSrc games run through WINE.  It is unrelated to my wacom setup.

Section "ServerLayout"
	Identifier     "aticonfig Layout"
	Screen      0  "aticonfig-Screen[0]-0" 0 0
	Screen         "aticonfig-Screen[0]-1" RightOf "aticonfig-Screen[0]-0"
	Screen         "aticonfig-Screen[0]-2" RightOf "aticonfig-Screen[0]-1"
	#for wacom
	InputDevice	"cursor" "SendCoreEvents"
	InputDevice	"stylus" "SendCoreEvents"
	InputDevice	"eraser" "SendCoreEvents"
EndSection

Section "Module"
EndSection

Section "ServerFlags"
	Option	    "Xinerama" "on"
EndSection

Section "InputClass"
	Identifier      "evdev pointer catchall"
	Driver          "evdev"
	MatchDevicePath "/dev/input/event*"
	MatchIsPointer  "yes"
EndSection

Section "InputClass"
	Identifier      "evdev keyboard catchall"
	Driver          "evdev"
	MatchDevicePath "/dev/input/event*"
	MatchIsKeyboard "yes"
	Option	    "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Section "InputDevice"
	Identifier	"stylus"
	Driver		"wacom"
	Option		"Type" "stylus"
	Option		"Device" "/dev/input/wacom"
	Option		"USB" "on"
	Option		"Mode" "Absolute"
	Option		"Vendor" "WACOM"
	Option		"Threshold" "1"
EndSection

Section "InputDevice"
	Identifier  	"eraser"
	Driver      	"wacom"
	Option      	"Type" "eraser"
	Option      	"Device" "/dev/input/wacom"
	Option      	"USB" "on"
	Option      	"Mode" "Absolute"
	Option      	"Vendor" "WACOM"
	Option      	"Threshold" "1"
EndSection

Section "InputDevice"
	Identifier  	"cursor"
	Driver      	"wacom"
	Option      	"Type" "pad"
	Option      	"Device" "/dev/input/wacom" 
	Option      	"USB" "on"
	Option      	"Mode" "Absolute"
	Option      	"Vendor" "WACOM"
	Option      	"Threshold" "1"
EndSection

Section "InputDevice"
	Identifier  "cursor"
	Driver      "wacom"
	Option      "Type" "cursor"
	Option      "Device" "/dev/input/wacom" 
	Option      "USB" "on"
	Option      "Mode" "Absolute"
	Option      "Vendor" "WACOM"
EndSection

Section "Monitor"
	Identifier   "aticonfig-Monitor[0]-0"
	Option	    "VendorName" "ATI Proprietary Driver"
	Option	    "ModelName" "Generic Autodetecting Monitor"
	Option	    "DPMS" "true"
EndSection

Section "Monitor"
	Identifier   "aticonfig-Monitor[0]-1"
	Option	    "VendorName" "ATI Proprietary Driver"
	Option	    "ModelName" "Generic Autodetecting Monitor"
	Option	    "DPMS" "true"
EndSection

Section "Monitor"
	Identifier   "aticonfig-Monitor[0]-2"
	Option	    "VendorName" "ATI Proprietary Driver"
	Option	    "ModelName" "Generic Autodetecting Monitor"
	Option	    "DPMS" "true"
EndSection

Section "Device"
	Identifier  "aticonfig-Device[0]-0"
	Driver      "fglrx"
	# this prevents a deadlock when running goldsource engine through wine with cataylst drivers
	Option	    "BlockSignalsOnLock" "off"
	BusID       "PCI:1:0:0"
EndSection

Section "Device"
	Identifier  "aticonfig-Device[0]-1"
	Driver      "fglrx"
	BusID       "PCI:1:0:0"
	Screen      1
EndSection

Section "Device"
	Identifier  "aticonfig-Device[0]-2"
	Driver      "fglrx"
	BusID       "PCI:1:0:0"
	Screen      2
EndSection

Section "Screen"
	Identifier "aticonfig-Screen[0]-0"
	Device     "aticonfig-Device[0]-0"
	Monitor    "aticonfig-Monitor[0]-0"
	DefaultDepth     24
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "Screen"
	Identifier "aticonfig-Screen[0]-1"
	Device     "aticonfig-Device[0]-1"
	Monitor    "aticonfig-Monitor[0]-1"
	DefaultDepth     24
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "Screen"
	Identifier "aticonfig-Screen[0]-2"
	Device     "aticonfig-Device[0]-2"
	Monitor    "aticonfig-Monitor[0]-2"
	DefaultDepth     24
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "DRI"
	Mode         0666
EndSection

A script (~/.xsetwacom.sh) run by /etc/X11/xinit/xinitrc to configure the Cintiq correctly on X startup:

#!/bin/sh

xsetwacom --set stylus Area "400 460 52536 32896"
xsetwacom --set stylus Touch on
xsetwacom --set stylus Threshold 1
xsetwacom --set stylus Suppress "20"
xsetwacom --set stylus PressureCurve "0 25 75 100"

xsetwacom --set eraser Area "400 460 52536 32896"
xsetwacom --set eraser Touch on
xsetwacom --set eraser Threshold 1
xsetwacom --set eraser Suppress "20"
xsetwacom --set eraser PressureCurve "0 25 75 100"

xsetwacom --set cursor Touch on
xsetwacom --set cursor Threshold 1
xsetwacom --set cursor Suppress "20"

xsetwacom --set cursor StripRightDown "KEY -" #zoom out in Gimp
xsetwacom --set cursor StripRightUp "KEY +" #zoom in  in Gimp
xsetwacom --set cursor StripLeftDown "KEY ;"
xsetwacom --set cursor StripLeftUp "KEY :"
xsetwacom --set cursor Button 10 "KEY ="
xsetwacom --set cursor Button 9 "KEY p" # switch to pen tool
xsetwacom --set cursor Button 8 "KEY ,"
xsetwacom --set cursor Button 7 "KEY SHIFT"
xsetwacom --set cursor Button 6 "KEY CONTROL y" #redo
xsetwacom --set cursor Button 5 "KEY CONTROL z" #undo
xsetwacom --set cursor Button 4 "KEY k" # ink tool
xsetwacom --set cursor Button 3 "KEY SHIFT"
xsetwacom --set cursor Button 2 "KEY CONTROL z" #undo
xsetwacom --set cursor Button 1 "KEY CONTROL y" #redo

With the above setup, the cursor in X is shared between my mouse and the Cintiq's stylus.  Any given movement of the Cintiq's stylus over the Cintiq's screen results in a directly proportional movement of X's cursor over whichever head the cursor was originally overtop at the time of the stylus's movement (I say "directly proportional" because my non-Cintiq monitor heads are of a different vertical resolution).  In other words, the effects of a stylus movement on X's cursor are local to the head on which the X's cursor was at the time of the stylus movement (X's cursor does not instantaneously move to the head corresponding to the Cintiq--which is the third head).

However, this is only for the movement of X's cursor.  There seems to be another form of input in an X environment with a tablet--"XInput," and applications may or may not take advantage of it (I'm assuming).  An example of such an application would be GIMP or Xournal (e.g. Xournal has an option "Use XInput").  Using XInput permits usage of the Cintiq's pressure and tilt features, as well as much more smooth and accurate drawing results.

My problem is that XInput behaves in an entirely different way than X's cursor when using the Cintiq's stylus.  As indicated above, X's cursor treats stylus movements as local to the screen head on which the cursor is currently active (scaling things appropriately if the resolution of the active screen head differs from the Cintiq's screen).

On the other hand, with the above settings XInput treats the horizontal "concatenation" of all 3 screen heads as one space, and scales stylus movements over that area (e.g. if X's cursor were moved to an (x,y) position near the right side of the third head, then XInput's (x,y) position would be somewhere around the middle of the third head).  Now, consider the commands below:

UPDATE Do not use these commands if you've patched gtk2 as specified at the bottom of this post.

xsetwacom --set stylus MapToOutput "Head-2" #screen head indices start from 0
xsetwacom --set cursor MapToOutput "Head-2" #screen head indices start from 0
xsetwacom --set eraser MapToOutput "Head-2" #screen head indices start from 0

If I execute these (the behavior above assumes these commands were not executed), XInput behaves correctly on the third screen head (the Cintiq): the space over which XInput responds to (x,y) movements is relegated to the third screen head and is coincident with the stylus.  Unfortunately, now X's cursor movements in response to the stylus are messed up: for each screen head, the X cursor only operates within the third horizontal partition of that screen head from the left (as if each individual screen head is itself 3 separate screen heads).

Here is a screengrab indicating the location of X's cursor and Xinput in GIMP on the third screen head--the wacom tablet's LCD.  This is with the "MapToOutput Head-2" command executed for the stylus, cursor, and eraser.  In this case, the location of the XInput cursor is coincident with the location of the Cintiq's stylus.
XAXvy.jpg


So I've got a few questions about this:
1) (SOLVED - see UPDATE) Is it possible to have both X's cursor and the XInput "cursor" coincident with a Xinerama multihead setup?  (This would be the ideal, but it doesn't seem likely as this appears to be a bug)
2) (not needed - see UPDATE) If (1) is not possible, is it possible to disable the Wacom stylus as a manipulator of X's cursor and solely use it for XInput?  I would still like to use the mouse for X's cursor of course.
3) (not needed - see UPDATE) if (2) is possible, is it possible to create a script up that will toggle between using the stylus as X's cursor and an XInput cursor during an X session?
4) (SOLVED - see UPDATE) Somewhat unrelated, but can there be two independent X cursors for a single X session? (e.g. one X cursor for my mouse, another independent one for the wacom stylus)

If anyone can help me out with this, it would be greatly appreciated.


UPDATE: (4) is SOLVED.  I found out how to have two independent cursors in X.  See here: http://ao2.it/en/blog/2010/01/19/poor-m … -mice-xorg

The main problem is with still (1), (2), and (3).

UPDATE#2: (1) is SOLVED (this also means (2) and (3) need not be solved).  It turns out this is a problem with GTK+ (gtk2) and thus the applications that depend on it (gimp, xournal, etc etc ).  I have found a very simple patch for GTK+ here: https://bugzilla.gnome.org/show_bug.cgi?id=634977 .  This patch still works fine for gtk2 2.24.10-3 .  I'm not exactly sure how to do, but I'll recommend this patch to the official repos as this is a very frustrating issue.


Not sure if this is the correct way to do this, but below are instructions for rebuilding gtk2 with the patch in place (for those that aren't familiar with the process).  You may want to check if the gtk2 package has been updated with the patch since the time of this post
1) create a new directory "gtk2patched"
1) go here http://www.archlinux.org/packages/extra/i686/gtk2/ and click on 'Source Files' on the right.  Download all source files listed into "gtk2patched"
2) Download the "fixtablet.patch" patch file located here https://bugzilla.gnome.org/show_bug.cgi?id=634977 into "gtk2patched"
2) Edit the PKGBUILD as follows:
2-1) add "fixtablet.patch" to the "source" variable (on a new line, like xid-collision-debug.patch)
2-2) in the build() function, add

patch -Np1 -i "$srcdir/fixtablet.patch"

below the existing 'patch' call
3) in the "gtk2patched" directory, issue the command "makepkg --skipinteg".  This will compile the gtk2 sources with the provided patch included, skipping integrity checks (they will fail b/c you've edited the files and added a new one).  After the command finishes, there should be a gtk2-2.24.10-3-i686.pkg.tar.xz in the "gtk2patched" directory
4) Reinstall gtk2 with

sudo pacman -U gtk2-2.24.10-3-i686.pkg.tar.xz

5) You may need to restart X in order to see the effect--I'm not sure.  In any case, this should do it.  If you have any problems with this updated package file, then simply reinstall the gtk2 package in the repos.

Last edited by woah (2012-05-27 18:31:10)

Offline

Board footer

Powered by FluxBB