xinput support



Hello!

A couple of weeks ago I involuntarily got involved into developement of
a linux tablet driver (bought a wacom bluetooth tablet and it turned
out that it isn't supported by linux so I sat down and wrote the
driver in a couple of evenings ;-)

Now I have it working in X11, thanks to Ping Cheng's work from the
Wacom Linux project, but there's one problem.

The tablet has two buttons. There's little sense to make them work as
left/right mouse buttons (stylus already has two buttons + pendown
(touch) button), and there's little sense making them buttons 4 & 5 or
even more 6 & 7. The best option would be to make them programmable.

Then I observed in GTK's standard xinput dialog on second page that I
have the option to assign hotkeys to tablet 'keys'. That was exactly
what I want! So I modified the wacom_drv.o driver for X11 to generate
xinput key events on these buttons (instead of mouse button events),
and besides as I discovered that tablet is sensitive to a thin area
along every edge of the active area, I made 24 "virtual buttons" along
active edges (7x2 horizontally and 5x2 vertically). So I have a total
of 26 buttons, very useful for switching GIMP tools, modes etc.

Then I discovered several problems with gtk xinput handling. One small
problem, which I've solved in the attached patch is that the
event.key.string field wasn't set correctly, so programs that rely on
this field of event.key structure don't "see" these keys. The patch is
against gtk+ 2.6.7, thats the version I had handy, I hope it is obvious.

The major problem is that xinput is handled somehow different from
standard X11 events, and this makes these 'key' events window-bound.
E.g. if cursor is outside the window, these key events are lost
somewhere (even if I run the program with GDK_DEBUG=events I don't see
any sign of life when I press tablet keys when mouse cursor is outside
window). The core X11 keyboard works differently, so I wanted to ask:
what's so different in handling these two cases? What I should modify
in x11 driver, or in gtk, in order to make these keys work independent
of window? I could emit core keyboard events with tablet buttons, but
this will lose the ability to assign arbitrary hotkeys to them, and
make button assignments static.

-- 
Greetings,
   Andrew

Attachment: gtk+-2.6.7.diff
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]