From 47347d5f5cc3566f6927ab8a2a27c274159c9056 Mon Sep 17 00:00:00 2001 From: Emanuele Aina Date: Wed, 12 Sep 2012 14:45:05 +0200 Subject: [PATCH] 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 --- tests/interactive/test-events.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/interactive/test-events.c b/tests/interactive/test-events.c index 944eb6fe5..86f1db04d 100644 --- a/tests/interactive/test-events.c +++ b/tests/interactive/test-events.c @@ -254,11 +254,24 @@ input_cb (ClutterActor *actor, clutter_actor_get_name (source_actor)); break; case CLUTTER_SCROLL: - g_print ("[%s] BUTTON SCROLL (direction:%s)", - clutter_actor_get_name (source_actor), - clutter_event_get_scroll_direction (event) == CLUTTER_SCROLL_UP - ? "up" - : "down"); + { + ClutterScrollDirection dir = clutter_event_get_scroll_direction(event); + + if (dir == CLUTTER_SCROLL_SMOOTH) + { + 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; case CLUTTER_STAGE_STATE: g_print ("[%s] STAGE STATE", clutter_actor_get_name (source_actor));