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 <lionel.g.landwerlin@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=651718
This commit is contained in:
Lionel Landwerlin 2011-06-17 11:31:34 +01:00 committed by Emmanuele Bassi
parent b38773f458
commit 5705d08b5d

View File

@ -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];