GNOME Bugzilla – Bug 580761
Listen to new pointer devices appearing
Last modified: 2009-05-08 00:26:01 UTC
Patch from Ray Strode.
Created attachment 133571 [details] [review] simples
Hm. If I remember correctly (have to dig at the bugs opened when this feature was added) DeviceAdded was used first, but led to non-ready devices being activated which in turn made gsd crash or something. DeviceAdded was subsequently changed to DeviceEnabled. Shouldn't all devices that get added also be enabled some time thereafter (ie. before actual use)?
The message those send is DeviceAdded/Removed: "there's a device present" DeviceEnabled/Disabled: "this device may send events" DeviceAdded is sent out once per device - when the device is added to the X server (i.e. usually when it's plugged in) DeviceRemoved is the same, but when it's removed. DeviceEnabled is sent when the device is enabled and may send events. You'll get a DeviceEnabled event once after a DeviceAdded, when you come back from VT switch or when a client explicitly enables the device. Likewise with a DeviceDisabled. A disabled device is still present but won't send events.
i forgot to add - you don't have to care about DeviceAdded at all, since the device is useless unless it is enabled too. The only exception is if you control which devices are enabled/disabled as well but that doesn't apply here (applying the settings to a disabled device is pointless).
So, just listening to DeviceEnabled is actually enough. n/m.