[gtk/event-recorder: 3/6] inspector: Details about touchpad events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/event-recorder: 3/6] inspector: Details about touchpad events
- Date: Thu, 16 Dec 2021 02:59:37 +0000 (UTC)
commit 69b160cfe8e9f9307fb746c4ecc3c00d17e0af92
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 15 19:20:00 2021 -0500
inspector: Details about touchpad events
Useful to have for debugging these.
gtk/inspector/recorder.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
---
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index f626e8690a..09114206e4 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -1398,6 +1398,19 @@ axis_name (GdkAxisUse axis)
return name[axis];
}
+static const char *
+gesture_phase_name (GdkTouchpadGesturePhase phase)
+{
+ const char *name[] = {
+ "Begin",
+ "Update",
+ "End",
+ "Cancel"
+ };
+
+ return name[phase];
+}
+
static void
populate_event_properties (GtkListStore *store,
GdkEvent *event)
@@ -1406,6 +1419,7 @@ populate_event_properties (GtkListStore *store,
GdkDevice *device;
GdkDeviceTool *tool;
double x, y;
+ double dx, dy;
char *tmp;
GdkModifierType state;
@@ -1508,6 +1522,25 @@ populate_event_properties (GtkListStore *store,
add_boolean_row (store, "Implicit", gdk_grab_broken_event_get_implicit (event));
break;
+ case GDK_TOUCHPAD_SWIPE:
+ case GDK_TOUCHPAD_PINCH:
+ add_text_row (store, "Phase", gesture_phase_name (gdk_touchpad_event_get_gesture_phase (event)));
+ add_int_row (store, "Fingers", gdk_touchpad_event_get_n_fingers (event));
+ gdk_touchpad_event_get_deltas (event, &dx, &dy);
+ tmp = g_strdup_printf ("%.2f %.f2", dx, dy);
+ add_text_row (store, "Delta", tmp);
+ g_free (tmp);
+ if (type == GDK_TOUCHPAD_PINCH)
+ {
+ tmp = g_strdup_printf ("%.2f", gdk_touchpad_event_get_pinch_angle_delta (event));
+ add_text_row (store, "Angle Delta", tmp);
+ g_free (tmp);
+ tmp = g_strdup_printf ("%.2f", gdk_touchpad_event_get_pinch_scale (event));
+ add_text_row (store, "Scale", tmp);
+ g_free (tmp);
+ }
+ break;
+
default:
/* FIXME */
;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]