How to cancel `row-activated` when child claims gesture event

I’ve got some GTK3 code that I inherited from someone else. It uses GTK ListBoxes with custom ListBoxRows. The ListBoxRows contain a widget that uses gestures to capture click and right-click behaviour so that it works on touch devices (at least that’s my understanding). The app also has the option of setting single-click activation of the row items.

When the inner widget is clicked then I try to “consume” the click event with press_gesture.set_state (Gtk.EventSequenceState.CLAIMED);. However, the row-activated event is still occurring after the gesture completes.

I found this thread about issues consuming right-click gestures in GTK4, but a) that is GTK4 not GTK3 and b) it was patched a year and a half ago.

How can I consume a click even in the GestureMultiPress of a child widget that’s within a ListBox with activate-on-single-click set so that the row-activated event doesn’t fire for the ListBoxRow?

Is this a really strange combination of event handling? Is my app doing something fundamentally wrong? Can I not pair row-activated with GestureMultiPress because they’re different approaches to events? Is it possible to get robust and consistent row-activated behaviour (including the option to activate on single or double click) through a gesture-based approach?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.