From: Voluspa <li...@te...> - 2006-01-21 03:23:40
|
On Thu, 19 Jan 2006 12:38:40 +0100 Michael Kleiber wrote: > I am programming an application that uses the XInput extension to > evaluate pen input. I followed the xidump sample and everything is > working so far. > > I know want to distinguish the different tools of my tablet (stylus, > eraser, mouse, etc) but am not sure how to do it. The > XDeviceMotionEvent has a deviceid member but this does not seem to > change whatever tool I use. > > How can I find out what device the xevent was sent from? You have to set up a XDevice and XDeviceInfo for each tool through the XListInputDevices call, and then register with the X server which events of each tool you are interested in receiving. For a well commented example *cough*cough* see my http://web.telia.com/~u46133770/wacom/ program to filter out the "pad" device of an Intuos3 (the buttons and touch strips). The functions in get_device.c and reg_events.c (called from main_setup.c) are modified and stripped down versions of Frederic Lepied's program xinput-1.2 from 1996 - the functions in xinput.c and test.c files of that package. I'm not juggling different devices there though, so please don't make me think about the problem by further questions ;-) All I do is receive events from the "pad" and optionally tell the "stylus" to toggle mode between Absolute and Relative. The latter function in pen_mode.c is based on setmode.c from Lepied's package. I suggest you bring home his program for perusal, although it contains almost zero comments. I don't have a link, but the tarball is named xinput-1.2.tar.gz Mvh Mats Johannesson -- |