[Xcb] keyboard input handling

Jamey Sharp jamey at minilop.net
Sun Mar 6 17:10:01 PST 2005

Hey all,

One of the most inconvenient things about using XCB right now, in my
opinion, is keyboard input. Xlib hides a lot of complexity in the X
keyboard model.

Key press/release events from the server contain a "keycode", which is a
completely arbitrary number assigned to some particular key on the
keyboard. The server maintains a simple mapping from keycodes/modifier
pairs to "keysyms"; the meaning of a common set of keysyms is specified
by the X protocol. Clients can get this mapping using the
GetKeyboardMapping request. When the mapping changes, the server sends
all clients a MappingNotify event.

Then there's the XKB extension. Google suggests that the only XKB
internals reference that anybody uses is at
though the XKB protocol spec seems really well-written:
For the purposes of this message, XKB works just like the core protocol,
only more complicated.

Finally, there's the problem of input methods. For people whose
keyboards lack keys for languages they want to write in -- my keyboard
doesn't have Japanese on it, for instance, though I know a little of
that language -- some other way is needed to get characters into
applications. The traditional X answer to this problem is XIM, which is
integrated into Xlib. A wide range of alternatives to XIM are under
development, however; two I found with a quick search are SCIM and UIM.

It seems obvious to me that applications want to be able to process a
stream of Unicode characters together with non-Unicode key events, while
being able to identify the relative order of these keyboard events with
other input. I don't know what an XCB-based interface for this purpose
would look like, specifically, but I'd love to have somebody start
trying to figure it out.

I do know something about what it shouldn't look like. Inside Xlib, XIM
works by monitoring a special XIM socket; when data arrives on that
socket, Xlib creates a simulated keypress event. I'm strongly opposed to
providing an XCB equivalent to XPutBackEvent, so an XIM implementation
won't be able to create simulated keypress events. 

I don't suppose this sounds like an interesting problem to anyone?


More information about the xcb mailing list