diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-01-19 16:23:45 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-01-21 10:25:45 +0000 |
commit | 73cf6bd52c282acc1cdb67724d2b55d3f822f7ef (patch) | |
tree | e628761215e2dfb3891fe72751776a6468037418 /clutter/clutter-event.c | |
parent | 137f7d42a8db40a85ae95b10d9ed0fa895f48b0a (diff) | |
download | clutter-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.c | 9 |
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; |