summaryrefslogtreecommitdiff
path: root/gdk/gdkdevice.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2010-12-15 02:34:42 +0100
committerCarlos Garnacho <carlosg@gnome.org>2010-12-15 03:17:58 +0100
commit9f41101ccc5d81f748f64752528cc3751f971597 (patch)
treead1c1246805fe1742e978fc1d1acbb74a66bc710 /gdk/gdkdevice.c
parentf5a20ab65a3d03fb90c27b2fa1954d965f8ad768 (diff)
downloadgtk+-9f41101ccc5d81f748f64752528cc3751f971597.tar.gz
Emit GdkDevice::changed when the slave device being used changes
When the slave device changes, the master takes the shape of the new one, modifying its axes, this signal is more useful to catch this situation than the n-axes property
Diffstat (limited to 'gdk/gdkdevice.c')
-rw-r--r--gdk/gdkdevice.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 4e9b3d24e8..dc66f3bddd 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -64,6 +64,14 @@ struct _GdkDevicePrivate
GArray *axes;
};
+enum {
+ CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0 };
+
+
static void gdk_device_dispose (GObject *object);
static void gdk_device_set_property (GObject *object,
guint prop_id,
@@ -238,6 +246,26 @@ gdk_device_class_init (GdkDeviceClass *klass)
0, G_MAXUINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GdkDevice::changed:
+ * @device: the #GdkDevice that changed.
+ *
+ * The ::changed signal is emitted either when the #GdkDevice
+ * has changed the number of either axes or keys. For example
+ * In X this will normally happen when the slave device routing
+ * events through the master device changes (for example, user
+ * switches from the USB mouse to a tablet), in that case the
+ * master device will change to reflect the new slave device
+ * axes and keys.
+ */
+ signals[CHANGED] =
+ g_signal_new (g_intern_static_string ("changed"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ NULL, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
g_type_class_add_private (object_class, sizeof (GdkDevicePrivate));
}