GtkEventController

GtkEventController — Self-contained handler of series of events

Properties

gchar * name Read / Write
GtkPropagationLimit propagation-limit Read / Write
GtkPropagationPhase propagation-phase Read / Write
GtkWidget * widget Read

Object Hierarchy

    GObject
    ╰── GtkEventController
        ├── GtkGesture
        ├── GtkDropTarget
        ├── GtkDropTargetAsync
        ├── GtkEventControllerKey
        ├── GtkEventControllerFocus
        ├── GtkEventControllerLegacy
        ├── GtkEventControllerMotion
        ├── GtkEventControllerScroll
        ├── GtkPadController
        ╰── GtkShortcutController

Includes

#include <gtk/gtk.h>

Description

GtkEventController is a base, low-level implementation for event controllers. Those react to a series of GdkEvents, and possibly trigger actions as a consequence of those.

Functions

gtk_event_controller_get_propagation_phase ()

GtkPropagationPhase
gtk_event_controller_get_propagation_phase
                               (GtkEventController *controller);

Gets the propagation phase at which controller handles events.

Parameters

controller

a GtkEventController

 

Returns

the propagation phase


gtk_event_controller_set_propagation_phase ()

void
gtk_event_controller_set_propagation_phase
                               (GtkEventController *controller,
                                GtkPropagationPhase phase);

Sets the propagation phase at which a controller handles events.

If phase is GTK_PHASE_NONE, no automatic event handling will be performed, but other additional gesture maintenance will. In that phase, the events can be managed by calling gtk_event_controller_handle_event().

Parameters

controller

a GtkEventController

 

phase

a propagation phase

 

gtk_event_controller_get_propagation_limit ()

GtkPropagationLimit
gtk_event_controller_get_propagation_limit
                               (GtkEventController *controller);

Gets the propagation limit of the event controller.

Parameters

controller

a GtkEventController

 

Returns

the propagation limit


gtk_event_controller_set_propagation_limit ()

void
gtk_event_controller_set_propagation_limit
                               (GtkEventController *controller,
                                GtkPropagationLimit limit);

Sets the event propagation limit on the event controller.

If the limit is set to %GTK_LIMIT_SAME_NATIVE , the controller won't handle events that are targeted at widgets on a different surface, such as popovers.

Parameters

controller

a GtkEventController

 

limit

the propagation limit

 

gtk_event_controller_get_widget ()

GtkWidget *
gtk_event_controller_get_widget (GtkEventController *controller);

Returns the GtkWidget this controller relates to.

Parameters

controller

a GtkEventController

 

Returns

a GtkWidget.

[transfer none]


gtk_event_controller_reset ()

void
gtk_event_controller_reset (GtkEventController *controller);

Resets the controller to a clean state. Every interaction the controller did through gtk_event_controller_handle_event() will be dropped at this point.

Parameters

controller

a GtkEventController

 

gtk_event_controller_get_name ()

const char *
gtk_event_controller_get_name (GtkEventController *controller);

Gets the name of controller .

Parameters

controller

a GtkEventController

 

gtk_event_controller_set_name ()

void
gtk_event_controller_set_name (GtkEventController *controller,
                               const char *name);

Sets a name on the controller that can be used for debugging.

Parameters

controller

a GtkEventController

 

name

a name for controller

 

gtk_event_controller_get_current_event ()

GdkEvent *
gtk_event_controller_get_current_event
                               (GtkEventController *controller);

Returns the event that is currently being handled by the controller, and NULL at other times.

Parameters

controller

a GtkEventController

 

Returns

the event is current handled by controller .

[nullable][transfer none]


gtk_event_controller_get_current_event_device ()

GdkDevice *
gtk_event_controller_get_current_event_device
                               (GtkEventController *controller);

Returns the device of the event that is currently being handled by the controller, and NULL otherwise.

Parameters

controller

a GtkEventController

 

Returns

device of the event is current handled by controller .

[nullable][transfer none]


gtk_event_controller_get_current_event_state ()

GdkModifierType
gtk_event_controller_get_current_event_state
                               (GtkEventController *controller);

Returns the modifier state of the event that is currently being handled by the controller, and 0 otherwise.

Parameters

controller

a GtkEventController

 

Returns

modifier state of the event is current handled by controller


gtk_event_controller_get_current_event_time ()

guint32
gtk_event_controller_get_current_event_time
                               (GtkEventController *controller);

Returns the timestamp of the event that is currently being handled by the controller, and 0 otherwise.

Parameters

controller

a GtkEventController

 

Returns

timestamp of the event is current handled by controller

Types and Values

GtkEventController

typedef struct _GtkEventController GtkEventController;

enum GtkPropagationPhase

Describes the stage at which events are fed into a GtkEventController.

Members

GTK_PHASE_NONE

Events are not delivered automatically. Those can be manually fed through gtk_event_controller_handle_event(). This should only be used when full control about when, or whether the controller handles the event is needed.

 

GTK_PHASE_CAPTURE

Events are delivered in the capture phase. The capture phase happens before the bubble phase, runs from the toplevel down to the event widget. This option should only be used on containers that might possibly handle events before their children do.

 

GTK_PHASE_BUBBLE

Events are delivered in the bubble phase. The bubble phase happens after the capture phase, and before the default handlers are run. This phase runs from the event widget, up to the toplevel.

 

GTK_PHASE_TARGET

Events are delivered in the default widget event handlers, note that widget implementations must chain up on button, motion, touch and grab broken handlers for controllers in this phase to be run.

 

enum GtkPropagationLimit

Describes limits of a GtkEventController for handling events targeting other widgets.

Members

GTK_LIMIT_NONE

Events are handled regardless of what their target is.

 

GTK_LIMIT_SAME_NATIVE

Events are only handled if their target is in the same GtkNative as the event controllers widget. Note that some event types have two targets (origin and destination).

 

Property Details

The “name” property

  “name”                     gchar *

Name for this controller.

Owner: GtkEventController

Flags: Read / Write

Default value: NULL


The “propagation-limit” property

  “propagation-limit”        GtkPropagationLimit

The limit for which events this controller will handle.

Owner: GtkEventController

Flags: Read / Write

Default value: GTK_LIMIT_SAME_NATIVE


The “propagation-phase” property

  “propagation-phase”        GtkPropagationPhase

The propagation phase at which this controller will handle events.

Owner: GtkEventController

Flags: Read / Write

Default value: GTK_PHASE_BUBBLE


The “widget” property

  “widget”                   GtkWidget *

The widget receiving the GdkEvents that the controller will handle.

Owner: GtkEventController

Flags: Read

See Also

GtkGesture