From 00748f66560f3105ff9c636cd01428d8b5e30e9e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 26 Oct 2009 11:42:16 +0000 Subject: [PATCH] tests: Print out the captured event type The ::captured-event signal on the Stage is not printing out the event type. --- tests/interactive/test-events.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/interactive/test-events.c b/tests/interactive/test-events.c index 7c5523d71..0cd32c62c 100644 --- a/tests/interactive/test-events.c +++ b/tests/interactive/test-events.c @@ -4,6 +4,34 @@ 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 stage_state_cb (ClutterStage *stage, gpointer data) @@ -59,7 +87,8 @@ capture_cb (ClutterActor *actor, ClutterEvent *event, 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)); return FALSE;