GNOME Bugzilla – Bug 728967
evdev: Add libinput-specific helpers
Last modified: 2014-05-21 12:17:23 UTC
For Mutter, it would be interesting to reach some libinput features that aren't directly available in Clutter, and probably better stay as such. I'm attaching a couple of patches that: 1) Adds a evdev specific input filter, that allows consuming libinput_event structs 2) Adds api to fetch a libinput_device from a ClutterDeviceInput, so configuration/calibration API is made available.
Created attachment 275156 [details] [review] evdev: Add evdev specific event filter function This function can be used to intercept or translate events that are unmanaged by clutter itself.
Created attachment 275157 [details] [review] evdev: Add function to get the libinput_device from a ClutterInputDevice This may be useful for deeper libinput integration that's not in the scope of Clutter.
Review of attachment 275156 [details] [review]: looks reasonably good. I guess I'll have to branch Clutter to get this new API in. ::: clutter/evdev/clutter-device-manager-evdev.c @@ +1691,3 @@ +void +clutter_evdev_add_filter (ClutterEvdevFilterFunc func, + * Adds an event filter function. to avoid issues in the future, you may want to add a GDestroyNotify here. though I guess this API is only ever going to be called at the C level anyway. ::: clutter/evdev/clutter-evdev.h @@ -103,2 +103,3 @@ guint32 interval); +typedef enum { minor nitpick: you could probably use a boolean and CLUTTER_EVENT_STOP and CLUTTER_EVENT_PROPAGATE instead of a new enumeration.
Review of attachment 275157 [details] [review]: looks good. ::: clutter/evdev/clutter-evdev.h @@ +118,3 @@ void clutter_evdev_remove_filter (ClutterEvdevFilterFunc func, gpointer data); +CLUTTER_AVAILABLE_IN_1_18 since it's new API, I'll have to branch Clutter. this will become CLUTTER_AVAILABLE_IN_1_20. ::: clutter/evdev/clutter-input-device-evdev.c @@ +209,3 @@ + * Returns: The libinput_device struct + * + * same as above: this will need to be Since: 1.20.
Attachment 275156 [details] pushed as 91ee1ce - evdev: Add evdev specific event filter function Attachment 275157 [details] pushed as 8857b19 - evdev: Add function to get the libinput_device from a ClutterInputDevice
(In reply to comment #3) > Review of attachment 275156 [details] [review]: > > +clutter_evdev_add_filter (ClutterEvdevFilterFunc func, > + * Adds an event filter function. > > to avoid issues in the future, you may want to add a GDestroyNotify here. > though I guess this API is only ever going to be called at the C level anyway. libinput is quite binding friendly, so I added the GDestroyNotify if the need ever arises, but I've left the functions remain with (skip) on introspection. > > ::: clutter/evdev/clutter-evdev.h > @@ -103,2 +103,3 @@ > guint32 interval); > > +typedef enum { > > minor nitpick: you could probably use a boolean and CLUTTER_EVENT_STOP and > CLUTTER_EVENT_PROPAGATE instead of a new enumeration. Makes sense indeed :), the pushed patch does that. > void clutter_evdev_remove_filter (ClutterEvdevFilterFunc func, > gpointer data); > +CLUTTER_AVAILABLE_IN_1_18 > > since it's new API, I'll have to branch Clutter. this will become > CLUTTER_AVAILABLE_IN_1_20. Changed this and docs to "1.20"