From: Lionel Landwerlin Date: Fri, 17 Jun 2011 10:31:34 +0000 (+0100) Subject: evdev: don't even process events without a default stage X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5705d08b5d50901e2f752a505e7daab3e98696ae;p=profile%2Fivi%2Fclutter.git evdev: don't even process events without a default stage The evdev system is a bit different from other input systems in Clutter because it's completly decorrelated from anything graphic. In the case of embedded devices with no proper windowing system, you might want to not implicitly create a default stage when you're receiving the first input event. This patch changes this behavior by not forwarding any event if you don't have a default stage. Signed-off-by: Lionel Landwerlin https://bugzilla.gnome.org/show_bug.cgi?id=651718 --- diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 26079f1..80c0698 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -44,6 +44,7 @@ #include "clutter-input-device-evdev.h" #include "clutter-main.h" #include "clutter-private.h" +#include "clutter-stage-manager.h" #include "clutter-xkb-utils.h" #include "clutter-device-manager-evdev.h" @@ -268,9 +269,14 @@ clutter_event_dispatch (GSource *g_source, ClutterEvent *event; gint len, i, dx = 0, dy = 0; uint32_t _time; + ClutterStageManager *stage_manager; + ClutterStage *default_stage; clutter_threads_enter (); + stage_manager = clutter_stage_manager_get_default (); + default_stage = clutter_stage_manager_get_default_stage (stage_manager); + /* Don't queue more events if we haven't finished handling the previous batch */ if (!clutter_events_pending ()) @@ -303,6 +309,10 @@ clutter_event_dispatch (GSource *g_source, goto out; } + /* Drop events if we don't have any stage to forward them to */ + if (!default_stage) + goto out; + for (i = 0; i < len / sizeof (ev[0]); i++) { struct input_event *e = &ev[i];