RFC: Listening for devices being added - udev vs. X11

Matthew Brush mbrush at codebrainz.ca
Tue Apr 22 21:33:59 CEST 2014

On 14-04-21 06:40 AM, Martin Kelly wrote:
> Nick Schermer wrote:
>> Thunar is different in is aspect since it is required to watch for
>> block/usb events, which is not possible through X, so there gudev
>> became optional.
>> Keyboards are a different issue, it is easy to watch those with X and
>> should therefore be the preferred option. Look at the pointers code
>> (instead of IsXExtensionPointer use IsXExtensionKeyboard).
>> Advantage is you have the correct device too, which is probably needed
>> to set some of the properties as well.
>> Nick
> X is more optimal in supporting all platforms and not adding more
> dependencies. However, it's less feature-proof as any X-dependent code
> is eventually throwaway code. I have the gudev part of this working now.
> It sounds like the optimal solution here to balance this needs is to
> #ifdef the code to use gudev if it's present and fall back to X if not.
> My current code already has the #ifdef for gudev, so I just need to add
> an X case.

Technically all code is throw-away code from that perspective (except 
maybe win32 API code), even as an example with GTK4 planned, writing 
GTK3 code is already not future-proof as it will be deprecated closer to 
GTK4 (much of it already is). That being said, I'd wager X(lib) will 
still be available in one form or another for far longer than GTK3, GTK4 
and Udev combined :)

Note: I have no opinion on whether patches should be accepted, other 
than maybe to ask why Gudev over libudev directly since it's quite easy 
and provides a "GLIB-like" API already without an additional (small) 

Matthew Brush

More information about the Xfce4-dev mailing list