[clutter/wip/wayland-for-demo: 14/15] close callback
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/wayland-for-demo: 14/15] close callback
- Date: Wed, 5 Mar 2014 15:21:23 +0000 (UTC)
commit 00ecef2b5b426dc7fc94246cddc2784f07b5b930
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sat Mar 1 13:06:25 2014 -0500
close callback
clutter/evdev/clutter-device-manager-evdev.c | 21 ++++++++++++++-------
clutter/evdev/clutter-evdev.h | 7 +++++--
2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index bdca5d4..a639502 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -116,8 +116,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (ClutterDeviceManagerEvdev,
clutter_device_manager_evdev,
CLUTTER_TYPE_DEVICE_MANAGER)
-static ClutterOpenDeviceCallback open_callback;
-static gpointer open_callback_data;
+static ClutterOpenDeviceCallback open_callback;
+static ClutterCloseDeviceCallback close_callback;
+static gpointer open_callback_data;
static const char *device_type_str[] = {
"pointer", /* CLUTTER_POINTER_DEVICE */
@@ -1143,7 +1144,10 @@ static void
close_restricted (int fd,
void *user_data)
{
- close (fd);
+ if (close_callback)
+ close_callback (fd, open_callback_data);
+ else
+ close (fd);
}
static const struct libinput_interface libinput_interface = {
@@ -1456,7 +1460,8 @@ clutter_evdev_reclaim_devices (void)
/**
* clutter_evdev_set_open_callback: (skip)
- * @callback: the user replacement for open()
+ * @open_callback: the user replacement for open()
+ * @close_callback: the user replacement for close()
* @user_data: user data for @callback
*
* Through this function, the application can set a custom callback
@@ -1472,10 +1477,12 @@ clutter_evdev_reclaim_devices (void)
* Stability: unstable
*/
void
-clutter_evdev_set_open_callback (ClutterOpenDeviceCallback callback,
- gpointer user_data)
+clutter_evdev_set_open_callback (ClutterOpenDeviceCallback open_callback_,
+ ClutterCloseDeviceCallback close_callback_,
+ gpointer user_data)
{
- open_callback = callback;
+ open_callback = open_callback_;
+ close_callback = close_callback_;
open_callback_data = user_data;
}
diff --git a/clutter/evdev/clutter-evdev.h b/clutter/evdev/clutter-evdev.h
index 104e3b4..beed9fa 100644
--- a/clutter/evdev/clutter-evdev.h
+++ b/clutter/evdev/clutter-evdev.h
@@ -48,10 +48,13 @@ typedef int (*ClutterOpenDeviceCallback) (const char *path,
int flags,
gpointer user_data,
GError **error);
+typedef void (*ClutterCloseDeviceCallback) (int fd,
+ gpointer user_data);
CLUTTER_AVAILABLE_IN_1_16
-void clutter_evdev_set_open_callback (ClutterOpenDeviceCallback callback,
- gpointer user_data);
+void clutter_evdev_set_open_callback (ClutterOpenDeviceCallback open_callback,
+ ClutterCloseDeviceCallback close_callback,
+ gpointer user_data);
CLUTTER_AVAILABLE_IN_1_10
void clutter_evdev_release_devices (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]