tests: Print out the captured event type

The ::captured-event signal on the Stage is not printing out the
event type.
This commit is contained in:
Emmanuele Bassi 2009-10-26 11:42:16 +00:00
parent f0b434918b
commit 00748f6656

View File

@ -4,6 +4,34 @@
gboolean IsFullScreen = FALSE, IsMotion = TRUE; gboolean IsFullScreen = FALSE, IsMotion = TRUE;
static const gchar *
get_event_type_name (const ClutterEvent *event)
{
switch (event->type)
{
case CLUTTER_BUTTON_PRESS:
return "BUTTON PRESS";
case CLUTTER_BUTTON_RELEASE:
return "BUTTON_RELEASE";
case CLUTTER_KEY_PRESS:
return "KEY PRESS";
case CLUTTER_KEY_RELEASE:
return "KEY RELEASE";
case CLUTTER_ENTER:
return "ENTER";
case CLUTTER_LEAVE:
return "LEAVE";
default:
return "EVENT";
}
}
static void static void
stage_state_cb (ClutterStage *stage, stage_state_cb (ClutterStage *stage,
gpointer data) gpointer data)
@ -59,7 +87,8 @@ capture_cb (ClutterActor *actor,
ClutterEvent *event, ClutterEvent *event,
gpointer data) gpointer data)
{ {
g_print ("* captured event for type '%s' *\n", g_print ("* captured event '%s' for type '%s' *\n",
get_event_type_name (event),
G_OBJECT_TYPE_NAME (actor)); G_OBJECT_TYPE_NAME (actor));
return FALSE; return FALSE;