From: Matthias Clasen Date: Wed, 15 Dec 2021 04:43:29 +0000 (-0500) Subject: inspector: Show event history in recorder X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~5^2~48^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9648cf226b558bdfdf623b38e1167713aaaa72f5;p=gtk4.git inspector: Show event history in recorder This was instrumental in debugging why scroll compression does not work. --- diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index 395381bc53..9a50567c17 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -1375,6 +1375,7 @@ populate_event_properties (GtkListStore *store, type = gdk_event_get_event_type (event); add_text_row (store, "Type", event_type_name (type)); + add_int_row (store, "Timestamp", gdk_event_get_time (event)); device = gdk_event_get_device (event); if (device) @@ -1448,6 +1449,35 @@ populate_event_properties (GtkListStore *store, /* FIXME */ ; } + + if (type == GDK_MOTION_NOTIFY || type == GDK_SCROLL) + { + GdkTimeCoord *history; + guint n_coords; + + history = gdk_event_get_history (event, &n_coords); + if (history) + { + GString *s; + + s = g_string_new (""); + + for (int i = 0; i < n_coords; i++) + { + if (i > 0) + g_string_append (s, "\n"); + if ((history[i].flags & (GDK_AXIS_FLAG_X|GDK_AXIS_FLAG_Y)) == (GDK_AXIS_FLAG_X|GDK_AXIS_FLAG_Y)) + g_string_append_printf (s, "%d: %.2f %.2f", history[i].time, history[i].axes[GDK_AXIS_X], history[i].axes[GDK_AXIS_Y]); + if ((history[i].flags & (GDK_AXIS_FLAG_DELTA_X|GDK_AXIS_FLAG_DELTA_Y)) == (GDK_AXIS_FLAG_DELTA_X|GDK_AXIS_FLAG_DELTA_Y)) + g_string_append_printf (s, "%d: %.2f %.2f", history[i].time, history[i].axes[GDK_AXIS_DELTA_X], history[i].axes[GDK_AXIS_DELTA_Y]); + } + + add_text_row (store, "History", s->str); + + g_string_free (s, TRUE); + g_free (history); + } + } } static GskRenderNode *