I have tried to subscribe to touch events as:
g_signal_connect (G_OBJECT(hw), "touch-event", G_CALLBACK (gw_touch_event), pview);
but my gw_touch_event
callback function is never called. Is it only for touch screens?
Question: how to receive touchpad events in GTK3 and in GTK4 ?
More details:
On "two-finger-scroll" gesture GdkEventScroll handler correctly reports GDK_SOURCE_TOUCHPAD:
GdkDevice *device = gdk_event_get_source_device(event);
if(!device) return;
GdkInputSource is = gdk_device_get_source (device);
bool is_touchpad = is == GDK_SOURCE_TOUCHPAD;
But Gtk Inspector application shows zero count of "touch-event" handler invocations.
Also my generic "event" signal handler also shows nothing here:
gboolean gw_event (GtkWidget* self, GdkEvent* event, gpointer user_data) {
GdkEventType et = gdk_event_get_event_type (event);
switch(et) {
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
g_message("TOUCH EVENT: %d",et);
return false;
}
return false;
}