GNOME Bugzilla – Bug 685944
GdkEventKey should tell me which device created it
Last modified: 2012-10-11 10:24:38 UTC
Currently, only mouse/pointer events structs have a device member (GdkEventButton, GdkEventTouch, GdkEventScroll, GdkEventMotion and GdkEventProximity). It would make sense for applications to be able to behave differently based on the device used (eg. the device could be tagged as a remote and long presses would be different than if the same keycode was hit on a keyboard).
you should use gdk_event_get_device(), not the direct struct access. the GdkDevice is stored in the event private data, and copied into the structure field only for those events that have one.