evdev: add a way for applications to tweak how devices are opened

In some cases, applications (or actually, wayland compositors)
don't have the required permissions to access evdev directly, but
can do so with an external helper like weston-launch.

Allow them to do so with a custom callback that replaces the regular
open() path.

https://bugzilla.gnome.org/show_bug.cgi?id=704269
This commit is contained in:
Giovanni Campagna
2013-07-15 18:24:35 +02:00
parent 1afe757109
commit 26b2852601
2 changed files with 62 additions and 4 deletions

View File

@ -30,6 +30,23 @@
G_BEGIN_DECLS
/**
* ClutterOpenDeviceCallback:
* @path: the device path
* @flags: flags to be passed to open
*
* This callback will be called when Clutter needs to access an input
* device. It should return an open file descriptor for the file at @path,
* or -1 if opening failed.
*/
typedef int (*ClutterOpenDeviceCallback) (const char *path,
int flags,
gpointer user_data,
GError **error);
void clutter_evdev_set_open_callback (ClutterOpenDeviceCallback callback,
gpointer user_data);
void clutter_evdev_release_devices (void);
void clutter_evdev_reclaim_devices (void);