tests: handle smooth scroll events in test-events

Print the precise scroll delta for smooth scroll events and
correctly print the direction for left/right scrolls.

https://bugzilla.gnome.org/show_bug.cgi?id=683870
This commit is contained in:
Emanuele Aina 2012-09-12 14:45:05 +02:00
parent 8a69210363
commit 47347d5f5c

View File

@ -254,11 +254,24 @@ input_cb (ClutterActor *actor,
clutter_actor_get_name (source_actor)); clutter_actor_get_name (source_actor));
break; break;
case CLUTTER_SCROLL: case CLUTTER_SCROLL:
g_print ("[%s] BUTTON SCROLL (direction:%s)", {
clutter_actor_get_name (source_actor), ClutterScrollDirection dir = clutter_event_get_scroll_direction(event);
clutter_event_get_scroll_direction (event) == CLUTTER_SCROLL_UP
? "up" if (dir == CLUTTER_SCROLL_SMOOTH)
: "down"); {
gdouble dx, dy;
clutter_event_get_scroll_delta(event, &dx, &dy);
g_print ("[%s] BUTTON SCROLL (direction:smooth %.02f,%.02f)",
clutter_actor_get_name (source_actor), dx, dy);
}
else
g_print ("[%s] BUTTON SCROLL (direction:%s)",
clutter_actor_get_name (source_actor),
dir == CLUTTER_SCROLL_UP ? "up" :
dir == CLUTTER_SCROLL_DOWN ? "down" :
dir == CLUTTER_SCROLL_LEFT ? "left" :
dir == CLUTTER_SCROLL_RIGHT ? "right" : "?");
}
break; break;
case CLUTTER_STAGE_STATE: case CLUTTER_STAGE_STATE:
g_print ("[%s] STAGE STATE", clutter_actor_get_name (source_actor)); g_print ("[%s] STAGE STATE", clutter_actor_get_name (source_actor));