Accessing and destruction of events

Data Structures

struct  libinput_event
 The base event type. More...
 
struct  libinput_event_device_notify
 An event notifying the caller of a device being added or removed. More...
 

Functions

void libinput_event_destroy (struct libinput_event *event)
 Destroy the event, freeing all associated resources. More...
 
enum libinput_event_type libinput_event_get_type (struct libinput_event *event)
 Get the type of the event. More...
 
struct libinputlibinput_event_get_context (struct libinput_event *event)
 Get the libinput context from the event. More...
 
struct libinput_devicelibinput_event_get_device (struct libinput_event *event)
 Return the device associated with this event. More...
 
struct libinput_event_pointerlibinput_event_get_pointer_event (struct libinput_event *event)
 Return the pointer event that is this input event. More...
 
struct libinput_event_keyboardlibinput_event_get_keyboard_event (struct libinput_event *event)
 Return the keyboard event that is this input event. More...
 
struct libinput_event_touchlibinput_event_get_touch_event (struct libinput_event *event)
 Return the touch event that is this input event. More...
 
struct libinput_event_gesture * libinput_event_get_gesture_event (struct libinput_event *event)
 Return the gesture event that is this input event. More...
 
struct libinput_event_tablet_toollibinput_event_get_tablet_tool_event (struct libinput_event *event)
 Return the tablet tool event that is this input event. More...
 
struct libinput_event_tablet_padlibinput_event_get_tablet_pad_event (struct libinput_event *event)
 Return the tablet pad event that is this input event. More...
 
struct libinput_event_switchlibinput_event_get_switch_event (struct libinput_event *event)
 Return the switch event that is this input event. More...
 
struct libinput_event_device_notifylibinput_event_get_device_notify_event (struct libinput_event *event)
 Return the device event that is this input event. More...
 
struct libinput_eventlibinput_event_device_notify_get_base_event (struct libinput_event_device_notify *event)
 

Detailed Description

Function Documentation

◆ libinput_event_destroy()

void libinput_event_destroy ( struct libinput_event event)

Destroy the event, freeing all associated resources.

Resources obtained from this event must be considered invalid after this call.

Warning
Unlike other structs events are considered transient and not refcounted. Calling libinput_event_destroy() will destroy the event.
Parameters
eventAn event retrieved by libinput_get_event().

◆ libinput_event_device_notify_get_base_event()

struct libinput_event * libinput_event_device_notify_get_base_event ( struct libinput_event_device_notify event)
Returns
The generic libinput_event of this event

◆ libinput_event_get_context()

struct libinput * libinput_event_get_context ( struct libinput_event event)

Get the libinput context from the event.

Parameters
eventThe libinput event
Returns
The libinput context for this event.

◆ libinput_event_get_device()

struct libinput_device * libinput_event_get_device ( struct libinput_event event)

Return the device associated with this event.

For device added/removed events this is the device added or removed. For all other device events, this is the device that generated the event.

This device is not refcounted and its lifetime is that of the event. Use libinput_device_ref() before using the device outside of this scope.

Returns
The device associated with this event

◆ libinput_event_get_device_notify_event()

struct libinput_event_device_notify * libinput_event_get_device_notify_event ( struct libinput_event event)

Return the device event that is this input event.

If the event type does not match the device event types, this function returns NULL.

The inverse of this function is libinput_event_device_notify_get_base_event().

Returns
A device event, or NULL for other events

◆ libinput_event_get_gesture_event()

struct libinput_event_gesture * libinput_event_get_gesture_event ( struct libinput_event event)

Return the gesture event that is this input event.

If the event type does not match the gesture event types, this function returns NULL.

A gesture's lifetime has three distinct stages: begin, update and end, each with their own event types. Begin is sent when the fingers are first set down or libinput decides that the gesture begins. For LIBINPUT_EVENT_GESTURE_PINCH_BEGIN this sets the initial scale. Any events changing properties of the gesture are sent as update events. On termination of the gesture, an end event is sent.

The inverse of this function is libinput_event_gesture_get_base_event().

Returns
A gesture event, or NULL for other events

◆ libinput_event_get_keyboard_event()

struct libinput_event_keyboard * libinput_event_get_keyboard_event ( struct libinput_event event)

Return the keyboard event that is this input event.

If the event type does not match the keyboard event types, this function returns NULL.

The inverse of this function is libinput_event_keyboard_get_base_event().

Returns
A keyboard event, or NULL for other events

◆ libinput_event_get_pointer_event()

struct libinput_event_pointer * libinput_event_get_pointer_event ( struct libinput_event event)

Return the pointer event that is this input event.

If the event type does not match the pointer event types, this function returns NULL.

The inverse of this function is libinput_event_pointer_get_base_event().

Returns
A pointer event, or NULL for other events

◆ libinput_event_get_switch_event()

struct libinput_event_switch * libinput_event_get_switch_event ( struct libinput_event event)

Return the switch event that is this input event.

If the event type does not match the switch event types, this function returns NULL.

The inverse of this function is libinput_event_switch_get_base_event().

Returns
A switch event, or NULL for other events
Since
1.7

◆ libinput_event_get_tablet_pad_event()

struct libinput_event_tablet_pad * libinput_event_get_tablet_pad_event ( struct libinput_event event)

Return the tablet pad event that is this input event.

If the event type does not match the tablet pad event types, this function returns NULL.

The inverse of this function is libinput_event_tablet_pad_get_base_event().

Returns
A tablet pad event, or NULL for other events

◆ libinput_event_get_tablet_tool_event()

struct libinput_event_tablet_tool * libinput_event_get_tablet_tool_event ( struct libinput_event event)

Return the tablet tool event that is this input event.

If the event type does not match the tablet tool event types, this function returns NULL.

The inverse of this function is libinput_event_tablet_tool_get_base_event().

Returns
A tablet tool event, or NULL for other events
Since
1.2

◆ libinput_event_get_touch_event()

struct libinput_event_touch * libinput_event_get_touch_event ( struct libinput_event event)

Return the touch event that is this input event.

If the event type does not match the touch event types, this function returns NULL.

The inverse of this function is libinput_event_touch_get_base_event().

Returns
A touch event, or NULL for other events

◆ libinput_event_get_type()

enum libinput_event_type libinput_event_get_type ( struct libinput_event event)

Get the type of the event.

Parameters
eventAn event retrieved by libinput_get_event().