Event controllers and gestures

Event controllers are standalone objects that can perform specific actions upon received GdkEvents. These are tied to a GtkWidget, and can be told of the event propagation phase at which they will manage the events.

Gestures are a set of specific controllers that are prepared to handle pointer and/or touch events, each gesture implementation attempts to recognize specific actions out the received events, notifying of the state/progress accordingly to let the widget react to those. On multi-touch gestures, every interacting touch sequence will be tracked independently.

Since gestures are simple units, it is not uncommon to tie several together to perform higher level actions, grouped gestures handle the same event sequences simultaneously, and those sequences share a same state across all grouped gestures. Some examples of grouping may be:

  • A drag and a swipe gestures may want grouping. The former will report events as the dragging happens, the latter will tell the swipe X/Y velocities only after recognition has finished.

  • Grouping a drag gesture with a pan gesture will only effectively allow dragging in the panning orientation, as both gestures share state.

  • If press and long press are wanted simultaneously, those would need grouping.

Shortcuts are handled by GtkShortcutController, which is a complex event handler that can either activate shortcuts itself, or propagate them to another controller, depending on its “scope”.