libinput: Accessing and destruction of events

Data Structures | Functions
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 libinput * | libinput_event_get_context (struct libinput_event *event)
| Get the libinput context from the event. More...
struct libinput_device * | libinput_event_get_device (struct libinput_event *event)
| Return the device associated with this event. More...
struct libinput_event_pointer * | libinput_event_get_pointer_event (struct libinput_event *event)
| Return the pointer event that is this input event. More...
struct libinput_event_keyboard * | libinput_event_get_keyboard_event (struct libinput_event *event)
| Return the keyboard event that is this input event. More...
struct libinput_event_touch * | libinput_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_tool * | libinput_event_get_tablet_tool_event (struct libinput_event *event)
| Return the tablet tool event that is this input event. More...
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. More...
struct libinput_event_device_notify * | libinput_event_get_device_notify_event (struct libinput_event *event)
| Return the device event that is this input event. More...
struct libinput_event * | libinput_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

  event | An 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

  event | The 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.

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

## § 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

  event | An event retrieved by libinput_get_event().