tests: track touch events in test-events

Enable xinput support in the X11 backend form test-events to
receive touch[begin|update|end] events.

https://bugzilla.gnome.org/show_bug.cgi?id=683869
This commit is contained in:
Emanuele Aina 2012-09-12 14:22:30 +02:00
parent 19de5d2541
commit 8a69210363

View File

@ -33,6 +33,18 @@ get_event_type_name (const ClutterEvent *event)
case CLUTTER_DELETE: case CLUTTER_DELETE:
return "DELETE"; return "DELETE";
case CLUTTER_TOUCH_BEGIN:
return "TOUCH BEGIN";
case CLUTTER_TOUCH_UPDATE:
return "TOUCH UPDATE";
case CLUTTER_TOUCH_END:
return "TOUCH END";
case CLUTTER_TOUCH_CANCEL:
return "TOUCH CANCEL";
default: default:
return "EVENT"; return "EVENT";
} }
@ -229,6 +241,18 @@ input_cb (ClutterActor *actor,
clutter_actor_get_parent (actor) == stage) clutter_actor_get_parent (actor) == stage)
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor); clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor);
break; break;
case CLUTTER_TOUCH_BEGIN:
g_print ("[%s] TOUCH BEGIN",
clutter_actor_get_name (source_actor));
break;
case CLUTTER_TOUCH_UPDATE:
g_print ("[%s] TOUCH UPDATE",
clutter_actor_get_name (source_actor));
break;
case CLUTTER_TOUCH_END:
g_print ("[%s] TOUCH END",
clutter_actor_get_name (source_actor));
break;
case CLUTTER_SCROLL: case CLUTTER_SCROLL:
g_print ("[%s] BUTTON SCROLL (direction:%s)", g_print ("[%s] BUTTON SCROLL (direction:%s)",
clutter_actor_get_name (source_actor), clutter_actor_get_name (source_actor),
@ -265,6 +289,10 @@ test_events_main (int argc, char *argv[])
{ {
ClutterActor *stage, *actor, *focus_box, *group; ClutterActor *stage, *actor, *focus_box, *group;
#ifdef CLUTTER_WINDOWING_X11
clutter_x11_enable_xinput ();
#endif
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;