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_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

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().
struct libinput_event* libinput_event_device_notify_get_base_event ( struct libinput_event_device_notify event)
Returns
The generic libinput_event of this event
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.
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
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
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.

The inverse of this function is libinput_event_gesture_get_base_event().

Returns
A gesture event, or NULL for other events
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
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
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
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().