summaryrefslogtreecommitdiff
path: root/clutter/clutter-event.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2011-01-19 16:23:45 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2011-01-21 10:25:45 +0000
commit73cf6bd52c282acc1cdb67724d2b55d3f822f7ef (patch)
treee628761215e2dfb3891fe72751776a6468037418 /clutter/clutter-event.c
parent137f7d42a8db40a85ae95b10d9ed0fa895f48b0a (diff)
downloadclutter-73cf6bd52c282acc1cdb67724d2b55d3f822f7ef.tar.gz
device: Allow enabling/disabling non-master devices
Slave and floating devices should always be disabled, and not deliver events to the scene. It is up to the user to enable non-master devices and handle events coming from them. ClutterInputDevice gets a new :enabled property, defaulting to FALSE; when a device manager creates a new device it has to set it to TRUE if the :device-mode property is set to CLUTTER_INPUT_MODE_MASTER. The main event queue entry point, _clutter_event_push(), will automatically discard events coming from disabled devices.
Diffstat (limited to 'clutter/clutter-event.c')
-rw-r--r--clutter/clutter-event.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c
index a5908a473..47264a773 100644
--- a/clutter/clutter-event.c
+++ b/clutter/clutter-event.c
@@ -832,10 +832,19 @@ _clutter_event_push (const ClutterEvent *event,
gboolean do_copy)
{
ClutterMainContext *context = _clutter_context_get_default ();
+ ClutterInputDevice *device;
/* FIXME: check queue is valid */
g_assert (context != NULL);
+ /* disabled devices don't propagate events */
+ device = clutter_event_get_device (event);
+ if (device != NULL)
+ {
+ if (!clutter_input_device_get_enabled (device))
+ return;
+ }
+
if (do_copy)
{
ClutterEvent *copy;