[xmonad] XInput support in XMonad?

Ilya Portnov portnov84 at rambler.ru
Fri Aug 31 20:32:06 CEST 2012

31.08.2012 22:48, Brandon Allbery wrote:
> On Fri, Aug 31, 2012 at 12:19 PM, Ilya Portnov<portnov84 at rambler.ru>  wrote:
>> Questions are:
>> * Could such changes in xmonad core events processing be accepted for
>> xmonad-core? Note that they will introduce new system library dependency
>> (-lXi in addition to existing -lX11).
> I'm wondering how much could be done with an extension, and some evil in
> the handleEventHook that acts like a filter.  (Modifier, the base type of
> the modifier mask for both keys and mouse buttons, is a CUInt; we would
> have to be careful of bits taken by Xkb to represent level shifts.)

One problem in handling XInput events using handleEventHook is... that's 
simply impossible with current Graphics.X11.Xlib.Extras.Event datatype 
definition. That type does not include even XGenericEventCookie variant. 
So, XInput events are not supported by X11 package at all (no data 
types, no XInput structures parsing, no FFI bindings...).

It's technically possible to patch X11 package to add all needed XInput 
bindings into it; one point will be introducing new system library 
dependency for X11 package.

Maybe, the best way is to add only data type declarations into 
Graphics.X11.Xlib.Extras (XGenericEvent variant of Event type and a 
bunch of data types for specific XInput events). All other (FFI 
bindings, structures parsing) will go to separate package.

What's current state of X11 package? If anyone of it's developers are 
here: any thoughts on above?

Another problem is XInput-specific. Once you call XISelectEvents (which 
is analogous to standard X11 XSelectInput call), X server will not send 
`normal' X11 event messages (XKeyEvent, XButtonEvent) for 
keyboard/mouse, only XInput-specific events (XGenericCookieEvent) are 
sent for keyboard/mouse. So, if we want to support old configs, we need 
to change xmonad main event processing loop to filter XInput 
mouse/keyboard events and pass them to user-specified handlers (`keys' 
and `mouseBindings' config fields). Otherwise, users will need to 
process all mouse/keyboard events in handleEventHook.

With best regards,
Ilya Portnov.

More information about the xmonad mailing list