diff --git a/Cargo.toml b/Cargo.toml index 4901b94..5662de7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,13 +30,14 @@ optional = true rustix = { version = "0.38", features = ["event"] } [features] -default = ["udev", "log", "libinput_1_21"] +default = ["udev", "log", "libinput_1_23"] use_bindgen = ["input-sys/use_bindgen"] libinput_1_11 = ["input-sys/libinput_1_11"] libinput_1_14 = ["input-sys/libinput_1_14", "libinput_1_11"] libinput_1_15 = ["input-sys/libinput_1_15", "libinput_1_14"] libinput_1_19 = ["input-sys/libinput_1_19", "libinput_1_15"] libinput_1_21 = ["input-sys/libinput_1_21", "libinput_1_19"] +libinput_1_23 = ["input-sys/libinput_1_23", "libinput_1_21"] [workspace] members = [ diff --git a/input-sys/Cargo.toml b/input-sys/Cargo.toml index c549add..1b58290 100644 --- a/input-sys/Cargo.toml +++ b/input-sys/Cargo.toml @@ -29,7 +29,7 @@ version = "1.10" optional = true [features] -default = ["libinput_1_21"] +default = ["libinput_1_23"] use_bindgen = ["bindgen", "proc-macro2", "regex"] update_bindings = ["use_bindgen"] libinput_1_11 = [] @@ -37,3 +37,4 @@ libinput_1_14 = [] libinput_1_15 = [] libinput_1_19 = [] libinput_1_21 = [] +libinput_1_23 = [] diff --git a/input-sys/build.rs b/input-sys/build.rs index ec56c77..30534c8 100644 --- a/input-sys/build.rs +++ b/input-sys/build.rs @@ -4,6 +4,7 @@ extern crate bindgen; use std::{env, path::Path}; const LIB_VERSIONS: &[(u8, u8, u8)] = &[ + (1, 23, 0), (1, 21, 0), (1, 19, 0), (1, 15, 0), diff --git a/input-sys/include/libinput.1.23.0.h b/input-sys/include/libinput.1.23.0.h new file mode 100644 index 0000000..7c0a9a7 --- /dev/null +++ b/input-sys/include/libinput.1.23.0.h @@ -0,0 +1,6404 @@ +/* + * Copyright © 2013 Jonas Ådahl + * Copyright © 2013-2015 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIBINPUT_H +#define LIBINPUT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#define LIBINPUT_ATTRIBUTE_PRINTF(_format, _args) \ + __attribute__ ((format (printf, _format, _args))) +#define LIBINPUT_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) + +/** + * @ingroup base + * @struct libinput + * + * A handle for accessing libinput. This struct is refcounted, use + * libinput_ref() and libinput_unref(). + */ +struct libinput; + +/** + * @ingroup device + * @struct libinput_device + * + * A base handle for accessing libinput devices. This struct is + * refcounted, use libinput_device_ref() and libinput_device_unref(). + */ +struct libinput_device; + +/** + * @ingroup device + * @struct libinput_device_group + * + * A base handle for accessing libinput device groups. This struct is + * refcounted, use libinput_device_group_ref() and + * libinput_device_group_unref(). + */ +struct libinput_device_group; + +/** + * @ingroup seat + * @struct libinput_seat + * + * The base handle for accessing libinput seats. This struct is + * refcounted, use libinput_seat_ref() and libinput_seat_unref(). + */ +struct libinput_seat; + +/** + * @ingroup device + * @struct libinput_tablet_tool + * + * An object representing a tool being used by a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. + * + * Tablet events generated by such a device are bound to a specific tool + * rather than coming from the device directly. Depending on the hardware it + * is possible to track the same physical tool across multiple + * struct libinput_device devices. + * See libinput_tablet_tool_get_serial() for more details. + * + * This struct is refcounted, use libinput_tablet_tool_ref() and + * libinput_tablet_tool_unref(). + * + * @since 1.2 + */ +struct libinput_tablet_tool; + +/** + * @ingroup event + * @struct libinput_event + * + * The base event type. Use libinput_event_get_pointer_event() or similar to + * get the actual event type. + * + * @warning Unlike other structs events are considered transient and + * not refcounted. + */ +struct libinput_event; + +/** + * @ingroup event + * @struct libinput_event_device_notify + * + * An event notifying the caller of a device being added or removed. + */ +struct libinput_event_device_notify; + +/** + * @ingroup event_keyboard + * @struct libinput_event_keyboard + * + * A keyboard event representing a key press/release. + */ +struct libinput_event_keyboard; + +/** + * @ingroup event_pointer + * @struct libinput_event_pointer + * + * A pointer event representing relative or absolute pointer movement, + * a button press/release or scroll axis events. + */ +struct libinput_event_pointer; + +/** + * @ingroup event_touch + * @struct libinput_event_touch + * + * Touch event representing a touch down, move or up, as well as a touch + * cancel and touch frame events. Valid event types for this event are @ref + * LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref + * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref + * LIBINPUT_EVENT_TOUCH_FRAME. + */ +struct libinput_event_touch; + +/** + * @ingroup event_tablet + * @struct libinput_event_tablet_tool + * + * Tablet tool event representing an axis update, button press, or tool + * update. Valid event types for this event are @ref + * LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY and @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @since 1.2 + */ +struct libinput_event_tablet_tool; + +/** + * @ingroup event_tablet_pad + * @struct libinput_event_tablet_pad + * + * Tablet pad event representing a button press, or ring/strip update on + * the tablet pad itself. Valid event types for this event are @ref + * LIBINPUT_EVENT_TABLET_PAD_BUTTON, @ref LIBINPUT_EVENT_TABLET_PAD_RING and + * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. + * + * @since 1.3 + */ +struct libinput_event_tablet_pad; + +/** + * @ingroup base + * + * Log priority for internal logging messages. + */ +enum libinput_log_priority { + LIBINPUT_LOG_PRIORITY_DEBUG = 10, + LIBINPUT_LOG_PRIORITY_INFO = 20, + LIBINPUT_LOG_PRIORITY_ERROR = 30, +}; + +/** + * @ingroup device + * + * Capabilities on a device. A device may have one or more capabilities + * at a time, capabilities remain static for the lifetime of the device. + */ +enum libinput_device_capability { + LIBINPUT_DEVICE_CAP_KEYBOARD = 0, + LIBINPUT_DEVICE_CAP_POINTER = 1, + LIBINPUT_DEVICE_CAP_TOUCH = 2, + LIBINPUT_DEVICE_CAP_TABLET_TOOL = 3, + LIBINPUT_DEVICE_CAP_TABLET_PAD = 4, + LIBINPUT_DEVICE_CAP_GESTURE = 5, + LIBINPUT_DEVICE_CAP_SWITCH = 6, +}; + +/** + * @ingroup device + * + * Logical state of a key. Note that the logical state may not represent + * the physical state of the key. + */ +enum libinput_key_state { + LIBINPUT_KEY_STATE_RELEASED = 0, + LIBINPUT_KEY_STATE_PRESSED = 1 +}; + +/** + * @ingroup device + * + * Mask reflecting LEDs on a device. + */ +enum libinput_led { + LIBINPUT_LED_NUM_LOCK = (1 << 0), + LIBINPUT_LED_CAPS_LOCK = (1 << 1), + LIBINPUT_LED_SCROLL_LOCK = (1 << 2) +}; + +/** + * @ingroup device + * + * Logical state of a physical button. Note that the logical state may not + * represent the physical state of the button. + */ +enum libinput_button_state { + LIBINPUT_BUTTON_STATE_RELEASED = 0, + LIBINPUT_BUTTON_STATE_PRESSED = 1 +}; + +/** + * @ingroup device + * + * Axes on a device with the capability @ref LIBINPUT_DEVICE_CAP_POINTER + * that are not x or y coordinates. + * + * The two scroll axes @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and + * @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL are engaged separately, + * depending on the device. libinput provides some scroll direction locking + * but it is up to the caller to determine which axis is needed and + * appropriate in the current interaction + */ +enum libinput_pointer_axis { + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL = 0, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL = 1, +}; + +/** + * @ingroup device + * + * The source for a libinput_pointer_axis event. See + * libinput_event_pointer_get_axis_source() for details. + * + * @note Pointer axis sources are deprecated, the source is now encoded in + * the event types + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. + */ +enum libinput_pointer_axis_source { + /** + * The event is caused by the rotation of a wheel. + */ + LIBINPUT_POINTER_AXIS_SOURCE_WHEEL = 1, + /** + * The event is caused by the movement of one or more fingers on a + * device. + */ + LIBINPUT_POINTER_AXIS_SOURCE_FINGER, + /** + * The event is caused by the motion of some device. + */ + LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, + /** + * The event is caused by the tilting of a mouse wheel rather than + * its rotation. This method is commonly used on mice without + * separate horizontal scroll wheels. + * + * @deprecated This axis source is deprecated as of libinput 1.16. + * It was never used by any device before libinput 1.16. All wheel + * tilt devices use @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL instead. + */ + LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, +}; + +/** + * @ingroup event_tablet_pad + * + * The source for a @ref LIBINPUT_EVENT_TABLET_PAD_RING event. See + * libinput_event_tablet_pad_get_ring_source() for details. + * + * @since 1.3 + */ +enum libinput_tablet_pad_ring_axis_source { + LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN = 1, + /** + * The event is caused by the movement of one or more fingers on + * the ring. + */ + LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, +}; + +/** + * @ingroup event_tablet_pad + * + * The source for a @ref LIBINPUT_EVENT_TABLET_PAD_STRIP event. See + * libinput_event_tablet_pad_get_strip_source() for details. + * + * @since 1.3 + */ +enum libinput_tablet_pad_strip_axis_source { + LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN = 1, + /** + * The event is caused by the movement of one or more fingers on + * the strip. + */ + LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, +}; + +/** + * @ingroup device + * + * Available tool types for a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. The tool type defines the default + * usage of the tool as advertised by the manufacturer. Multiple different + * physical tools may share the same tool type, e.g. a Wacom Classic Pen, + * Wacom Pro Pen and a Wacom Grip Pen are all of type @ref + * LIBINPUT_TABLET_TOOL_TYPE_PEN. + * Use libinput_tablet_tool_get_tool_id() to get a specific model where applicable. + * + * Note that on some device, the eraser tool is on the tail end of a pen + * device. On other devices, e.g. MS Surface 3, the eraser is the pen tip + * while a button is held down. + * + * @note The @ref libinput_tablet_tool_type can only describe the default physical + * type of the device. For devices with adjustable physical properties + * the tool type remains the same, i.e. putting a Wacom stroke nib into a + * classic pen leaves the tool type as @ref LIBINPUT_TABLET_TOOL_TYPE_PEN. + * + * @since 1.2 + */ +enum libinput_tablet_tool_type { + LIBINPUT_TABLET_TOOL_TYPE_PEN = 1, /**< A generic pen */ + LIBINPUT_TABLET_TOOL_TYPE_ERASER, /**< Eraser */ + LIBINPUT_TABLET_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */ + LIBINPUT_TABLET_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g. + Wacom Inking Pen */ + LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */ + LIBINPUT_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */ + LIBINPUT_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */ + LIBINPUT_TABLET_TOOL_TYPE_TOTEM, /**< A rotary device with + positional and rotation + data */ +}; + +/** + * @ingroup device + * + * The state of proximity for a tool on a device. The device must have the @ref + * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. + * + * The proximity of a tool is a binary state signalling whether the tool is + * within a detectable distance of the tablet device. A tool that is out of + * proximity cannot generate events. + * + * On some hardware a tool goes out of proximity when it ceases to touch the + * surface. On other hardware, the tool is still detectable within a short + * distance (a few cm) off the surface. + * + * @since 1.2 + */ +enum libinput_tablet_tool_proximity_state { + LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT = 0, + LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN = 1, +}; + +/** + * @ingroup device + * + * The tip contact state for a tool on a device. The device must have + * the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. + * + * The tip contact state of a tool is a binary state signalling whether the tool is + * touching the surface of the tablet device. + * + * @since 1.2 + */ +enum libinput_tablet_tool_tip_state { + LIBINPUT_TABLET_TOOL_TIP_UP = 0, + LIBINPUT_TABLET_TOOL_TIP_DOWN = 1, +}; + +/** + * @defgroup tablet_pad_modes Tablet pad modes + * + * Handling the virtual mode groups of buttons, strips and rings on tablet + * pad devices. See the libinput documentation for more details. + */ + +/** + * @ingroup tablet_pad_modes + * @struct libinput_tablet_pad_mode_group + * + * A mode on a tablet pad is a virtual grouping of functionality, usually + * based on some visual feedback like LEDs on the pad. The set of buttons, + * rings and strips that share the same mode are a "mode group". Whenever + * the mode changes, all buttons, rings and strips within this mode group + * are affected. + * + * Most tablets only have a single mode group, some tablets provide multiple + * mode groups through independent banks of LEDs (e.g. the Wacom Cintiq + * 24HD). libinput guarantees that at least one mode group is always + * available. + * + * This struct is refcounted, use libinput_tablet_pad_mode_group_ref() and + * libinput_tablet_pad_mode_group_unref(). + * + * @since 1.4 + */ +struct libinput_tablet_pad_mode_group; + +/** + * @ingroup tablet_pad_modes + * + * Most devices only provide a single mode group, however devices such as + * the Wacom Cintiq 22HD provide two mode groups. If multiple mode groups + * are available, a caller should use + * libinput_tablet_pad_mode_group_has_button(), + * libinput_tablet_pad_mode_group_has_ring() and + * libinput_tablet_pad_mode_group_has_strip() to associate each button, + * ring and strip with the correct mode group. + * + * @return the number of mode groups available on this device + * + * @since 1.4 + */ +int +libinput_device_tablet_pad_get_num_mode_groups(struct libinput_device *device); + +/** + * @ingroup tablet_pad_modes + * + * The returned mode group is not refcounted and may become invalid after + * the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and + * libinput_tablet_pad_mode_group_unref() to continue using the handle + * outside of the immediate scope. + * + * While at least one reference is kept by the caller, the returned mode + * group will be identical for each subsequent call of this function with + * the same index and that same struct is returned from + * libinput_event_tablet_pad_get_mode_group(), provided the event was + * generated by this mode group. + * + * @param device A device with the @ref LIBINPUT_DEVICE_CAP_TABLET_PAD + * capability + * @param index A mode group index + * @return the mode group with the given index or NULL if an invalid index + * is given. + * + * @since 1.4 + */ +struct libinput_tablet_pad_mode_group* +libinput_device_tablet_pad_get_mode_group(struct libinput_device *device, + unsigned int index); + +/** + * @ingroup tablet_pad_modes + * + * The returned number is the same index as passed to + * libinput_device_tablet_pad_get_mode_group(). For tablets with only one + * mode this number is always 0. + * + * @param group A previously obtained mode group + * @return the numeric index this mode group represents, starting at 0 + * + * @since 1.4 + */ +unsigned int +libinput_tablet_pad_mode_group_get_index(struct libinput_tablet_pad_mode_group *group); + +/** + * @ingroup tablet_pad_modes + * + * Query the mode group for the number of available modes. The number of + * modes is usually decided by the number of physical LEDs available on the + * device. Different mode groups may have a different number of modes. Use + * libinput_tablet_pad_mode_group_get_mode() to get the currently active + * mode. + * + * libinput guarantees that at least one mode is available. A device without + * mode switching capability has a single mode group and a single mode. + * + * @param group A previously obtained mode group + * @return the number of modes available in this mode group + * + * @since 1.4 + */ +unsigned int +libinput_tablet_pad_mode_group_get_num_modes(struct libinput_tablet_pad_mode_group *group); + +/** + * @ingroup tablet_pad_modes + * + * Return the current mode this mode group is in. Note that the returned + * mode is the mode valid as of completing the last libinput_dispatch(). + * The returned mode may thus be different than the mode returned by + * libinput_event_tablet_pad_get_mode(). + * + * For example, if the mode was toggled three times between the call to + * libinput_dispatch(), this function returns the third mode but the events + * in the event queue will return the modes 1, 2 and 3, respectively. + * + * @param group A previously obtained mode group + * @return the numeric index of the current mode in this group, starting at 0 + * + * @see libinput_event_tablet_pad_get_mode + * + * @since 1.4 + */ +unsigned int +libinput_tablet_pad_mode_group_get_mode(struct libinput_tablet_pad_mode_group *group); + +/** + * @ingroup tablet_pad_modes + * + * Devices without mode switching capabilities return true for every button. + * + * @param group A previously obtained mode group + * @param button A button index, starting at 0 + * @return true if the given button index is part of this mode group or + * false otherwise + * + * @since 1.4 + */ +int +libinput_tablet_pad_mode_group_has_button(struct libinput_tablet_pad_mode_group *group, + unsigned int button); + +/** + * @ingroup tablet_pad_modes + * + * Devices without mode switching capabilities return true for every ring. + * + * @param group A previously obtained mode group + * @param ring A ring index, starting at 0 + * @return true if the given ring index is part of this mode group or + * false otherwise + * + * @since 1.4 + */ +int +libinput_tablet_pad_mode_group_has_ring(struct libinput_tablet_pad_mode_group *group, + unsigned int ring); + +/** + * @ingroup tablet_pad_modes + * + * Devices without mode switching capabilities return true for every strip. + * + * @param group A previously obtained mode group + * @param strip A strip index, starting at 0 + * @return true if the given strip index is part of this mode group or + * false otherwise + * + * @since 1.4 + */ +int +libinput_tablet_pad_mode_group_has_strip(struct libinput_tablet_pad_mode_group *group, + unsigned int strip); + +/** + * @ingroup tablet_pad_modes + * + * The toggle button in a mode group is the button assigned to cycle to or + * directly assign a new mode when pressed. Not all devices have a toggle + * button and some devices may have more than one toggle button. For + * example, the Wacom Cintiq 24HD has six toggle buttons in two groups, each + * directly selecting one of the three modes per group. + * + * Devices without mode switching capabilities return false for every button. + * + * @param group A previously obtained mode group + * @param button A button index, starting at 0 + * @retval non-zero if the button is a mode toggle button for this group, or + * zero otherwise + * + * @since 1.4 + */ +int +libinput_tablet_pad_mode_group_button_is_toggle(struct libinput_tablet_pad_mode_group *group, + unsigned int button); + +/** + * @ingroup tablet_pad_modes + * + * Increase the refcount of the mode group. A mode group will be + * freed whenever the refcount reaches 0. + * + * @param group A previously obtained mode group + * @return The passed mode group + * + * @since 1.4 + */ +struct libinput_tablet_pad_mode_group * +libinput_tablet_pad_mode_group_ref( + struct libinput_tablet_pad_mode_group *group); + +/** + * @ingroup tablet_pad_modes + * + * Decrease the refcount of the mode group. A mode group will be + * freed whenever the refcount reaches 0. + * + * @param group A previously obtained mode group + * @return NULL if the group was destroyed, otherwise the passed mode group + * + * @since 1.4 + */ +struct libinput_tablet_pad_mode_group * +libinput_tablet_pad_mode_group_unref( + struct libinput_tablet_pad_mode_group *group); + +/** + * @ingroup tablet_pad_modes + * + * Set caller-specific data associated with this mode group. libinput does + * not manage, look at, or modify this data. The caller must ensure the + * data is valid. + * + * @param group A previously obtained mode group + * @param user_data Caller-specific data pointer + * @see libinput_tablet_pad_mode_group_get_user_data + * + * @since 1.4 + */ +void +libinput_tablet_pad_mode_group_set_user_data( + struct libinput_tablet_pad_mode_group *group, + void *user_data); + +/** + * @ingroup tablet_pad_modes + * + * Get the caller-specific data associated with this mode group, if any. + * + * @param group A previously obtained mode group + * @return Caller-specific data pointer or NULL if none was set + * @see libinput_tablet_pad_mode_group_set_user_data + * + * @since 1.4 + */ +void * +libinput_tablet_pad_mode_group_get_user_data( + struct libinput_tablet_pad_mode_group *group); + +/** + * @ingroup device + * + * The state of a switch. The default state of a switch is @ref + * LIBINPUT_SWITCH_STATE_OFF and no event is sent to confirm a switch in the + * off position. If a switch is logically on during initialization, libinput + * sends an event of type @ref LIBINPUT_EVENT_SWITCH_TOGGLE with a state + * @ref LIBINPUT_SWITCH_STATE_ON. + * + * @since 1.7 + */ +enum libinput_switch_state { + LIBINPUT_SWITCH_STATE_OFF = 0, + LIBINPUT_SWITCH_STATE_ON = 1, +}; + +/** + * @ingroup device + * + * The type of a switch. + * + * @since 1.7 + */ +enum libinput_switch { + /** + * The laptop lid was closed when the switch state is @ref + * LIBINPUT_SWITCH_STATE_ON, or was opened when it is @ref + * LIBINPUT_SWITCH_STATE_OFF. + */ + LIBINPUT_SWITCH_LID = 1, + + /** + * This switch indicates whether the device is in normal laptop mode + * or behaves like a tablet-like device where the primary + * interaction is usually a touch screen. When in tablet mode, the + * keyboard and touchpad are usually inaccessible. + * + * If the switch is in state @ref LIBINPUT_SWITCH_STATE_OFF, the + * device is in laptop mode. If the switch is in state @ref + * LIBINPUT_SWITCH_STATE_ON, the device is in tablet mode and the + * keyboard or touchpad may not be accessible. + * + * It is up to the caller to identify which devices are inaccessible + * in tablet mode. + */ + LIBINPUT_SWITCH_TABLET_MODE, +}; + +/** + * @ingroup event_switch + * @struct libinput_event_switch + * + * A switch event representing a changed state in a switch. + * + * @since 1.7 + */ +struct libinput_event_switch; + +/** + * @ingroup base + * + * Event type for events returned by libinput_get_event(). + */ +enum libinput_event_type { + /** + * This is not a real event type, and is only used to tell the user that + * no new event is available in the queue. See + * libinput_next_event_type(). + */ + LIBINPUT_EVENT_NONE = 0, + + /** + * Signals that a device has been added to the context. The device will + * not be read until the next time the user calls libinput_dispatch() + * and data is available. + * + * This allows setting up initial device configuration before any events + * are created. + */ + LIBINPUT_EVENT_DEVICE_ADDED, + + /** + * Signals that a device has been removed. No more events from the + * associated device will be in the queue or be queued after this event. + */ + LIBINPUT_EVENT_DEVICE_REMOVED, + + LIBINPUT_EVENT_KEYBOARD_KEY = 300, + + LIBINPUT_EVENT_POINTER_MOTION = 400, + LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, + LIBINPUT_EVENT_POINTER_BUTTON, + /** + * A scroll event from various sources. + * + * This event is deprecated as of libinput 1.19. Use + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS instead. + * + * Use libinput_event_pointer_get_axis_source() to determine the + * source of a scroll event. For libinput versions 1.19 and later, + * the source is encoded in the event type. + * + * This event is sent **in addition** to events of type + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. + * Do not mix and match, either use the old event or the new events. + * libinput makes no guarantee about the relation between + * @ref LIBINPUT_EVENT_POINTER_AXIS and the new event types + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. You may receive + * multiple zero, one or more new events per legacy event. + * + * @warning Ignore this event if you are processing + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. + */ + LIBINPUT_EVENT_POINTER_AXIS, + + /** + * A scroll event from a wheel. This event is sent is sent **in + * addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS + * event for all events with a + * libinput_event_pointer_get_axis_source() of @ref + * LIBINPUT_POINTER_AXIS_SOURCE_WHEEL. Ignore @ref + * LIBINPUT_EVENT_POINTER_AXIS if you are processing this event. + * + * See the libinput documentation for details. + * + * @since 1.19 + */ + LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + + /** + * A scroll event caused by the movement of one or more fingers on a + * device. This event is sent is sent **in addition** to the @ref + * LIBINPUT_EVENT_POINTER_AXIS event for all events with a + * libinput_event_pointer_get_axis_source() of @ref + * LIBINPUT_POINTER_AXIS_SOURCE_FINGER. Ignore @ref + * LIBINPUT_EVENT_POINTER_AXIS if you are processing this event. + * + * See the libinput documentation for details. + * + * @since 1.19 + */ + LIBINPUT_EVENT_POINTER_SCROLL_FINGER, + + /** + * A scroll event from a continuous scroll source, e.g. button + * scrolling. This event is sent is sent **in + * addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS + * event for all events with a + * libinput_event_pointer_get_axis_source() of @ref + * LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref + * LIBINPUT_EVENT_POINTER_AXIS if you are processing this event. + * + * See the libinput documentation for details. + * + * @since 1.19 + */ + LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS, + + LIBINPUT_EVENT_TOUCH_DOWN = 500, + LIBINPUT_EVENT_TOUCH_UP, + LIBINPUT_EVENT_TOUCH_MOTION, + LIBINPUT_EVENT_TOUCH_CANCEL, + /** + * Signals the end of a set of touchpoints at one device sample + * time. This event has no coordinate information attached. + */ + LIBINPUT_EVENT_TOUCH_FRAME, + + /** + * One or more axes have changed state on a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. This event is only sent + * when the tool is in proximity, see @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for details. + * + * The proximity event contains the initial state of the axis as the + * tool comes into proximity. An event of type @ref + * LIBINPUT_EVENT_TABLET_TOOL_AXIS is only sent when an axis value + * changes from this initial state. It is possible for a tool to + * enter and leave proximity without sending an event of type @ref + * LIBINPUT_EVENT_TABLET_TOOL_AXIS. + * + * An event of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS is sent + * when the tip state does not change. See the documentation for + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP for more details. + * + * @since 1.2 + */ + LIBINPUT_EVENT_TABLET_TOOL_AXIS = 600, + /** + * Signals that a tool has come in or out of proximity of a device with + * the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. + * + * Proximity events contain each of the current values for each axis, + * and these values may be extracted from them in the same way they are + * with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events. + * + * Some tools may always be in proximity. For these tools, events of + * type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN are sent only once after @ref + * LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref + * LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT are sent only once before @ref + * LIBINPUT_EVENT_DEVICE_REMOVED. + * + * If the tool that comes into proximity supports x/y coordinates, + * libinput guarantees that both x and y are set in the proximity + * event. + * + * When a tool goes out of proximity, the value of every axis should be + * assumed to have an undefined state and any buttons that are currently held + * down on the stylus are marked as released. Button release events for + * each button that was held down on the stylus are sent before the + * proximity out event. + * + * @since 1.2 + */ + LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, + /** + * Signals that a tool has come in contact with the surface of a + * device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. + * + * On devices without distance proximity detection, the @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP is sent immediately after @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for the tip down event, and + * immediately before for the tip up event. + * + * The decision when a tip touches the surface is device-dependent + * and may be derived from pressure data or other means. If the tip + * state is changed by axes changing state, the + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP event includes the changed + * axes and no additional axis event is sent for this state change. + * In other words, a caller must look at both @ref + * LIBINPUT_EVENT_TABLET_TOOL_AXIS and @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP events to know the current state + * of the axes. + * + * If a button state change occurs at the same time as a tip state + * change, the order of events is device-dependent. + * + * @since 1.2 + */ + LIBINPUT_EVENT_TABLET_TOOL_TIP, + /** + * Signals that a tool has changed a logical button state on a + * device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. + * + * Button state changes occur on their own and do not include axis + * state changes. If button and axis state changes occur within the + * same logical hardware event, the order of the @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON and @ref + * LIBINPUT_EVENT_TABLET_TOOL_AXIS event is device-specific. + * + * This event is not to be confused with the button events emitted + * by the tablet pad. See @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. + * + * @see LIBINPUT_EVENT_TABLET_PAD_BUTTON + * + * @since 1.2 + */ + LIBINPUT_EVENT_TABLET_TOOL_BUTTON, + + /** + * A button pressed on a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. + * + * A button differs from @ref LIBINPUT_EVENT_TABLET_PAD_KEY in that + * buttons are sequentially indexed from 0 and do not carry any + * other information. Keys have a specific functionality assigned + * to them. The key code thus carries a semantic meaning, a button + * number does not. + * + * This event is not to be confused with the button events emitted + * by tools on a tablet (@ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON). + * + * @since 1.3 + */ + LIBINPUT_EVENT_TABLET_PAD_BUTTON = 700, + /** + * A status change on a tablet ring with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. + * + * @since 1.3 + */ + LIBINPUT_EVENT_TABLET_PAD_RING, + + /** + * A status change on a strip on a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. + * + * @since 1.3 + */ + LIBINPUT_EVENT_TABLET_PAD_STRIP, + + /** + * A key pressed on a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. + * + * A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that + * keys have a specific functionality assigned to them (buttons are + * sequentially ordered). The key code thus carries a semantic + * meaning, a button number does not. + * + * @since 1.15 + */ + LIBINPUT_EVENT_TABLET_PAD_KEY, + + LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN = 800, + LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, + LIBINPUT_EVENT_GESTURE_SWIPE_END, + LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, + LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, + LIBINPUT_EVENT_GESTURE_PINCH_END, + /** + * @since 1.19 + */ + LIBINPUT_EVENT_GESTURE_HOLD_BEGIN, + LIBINPUT_EVENT_GESTURE_HOLD_END, + + /** + * @since 1.7 + */ + LIBINPUT_EVENT_SWITCH_TOGGLE = 900, +}; + +/** + * @defgroup event Accessing and destruction of events + */ + +/** + * @ingroup 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. + * + * @param event An event retrieved by libinput_get_event(). + */ +void +libinput_event_destroy(struct libinput_event *event); + +/** + * @ingroup event + * + * Get the type of the event. + * + * @param event An event retrieved by libinput_get_event(). + */ +enum libinput_event_type +libinput_event_get_type(struct libinput_event *event); + +/** + * @ingroup event + * + * Get the libinput context from the event. + * + * @param event The libinput event + * @return The libinput context for this event. + */ +struct libinput * +libinput_event_get_context(struct libinput_event *event); + +/** + * @ingroup 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. + * + * @return The device associated with this event + */ + +struct libinput_device * +libinput_event_get_device(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A pointer event, or NULL for other events + */ +struct libinput_event_pointer * +libinput_event_get_pointer_event(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A keyboard event, or NULL for other events + */ +struct libinput_event_keyboard * +libinput_event_get_keyboard_event(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A touch event, or NULL for other events + */ +struct libinput_event_touch * +libinput_event_get_touch_event(struct libinput_event *event); + +/** + * @ingroup 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 @ref + * 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(). + * + * @return A gesture event, or NULL for other events + */ +struct libinput_event_gesture * +libinput_event_get_gesture_event(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A tablet tool event, or NULL for other events + * + * @since 1.2 + */ +struct libinput_event_tablet_tool * +libinput_event_get_tablet_tool_event(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A tablet pad event, or NULL for other events + */ +struct libinput_event_tablet_pad * +libinput_event_get_tablet_pad_event(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A switch event, or NULL for other events + * + * @since 1.7 + */ +struct libinput_event_switch * +libinput_event_get_switch_event(struct libinput_event *event); + +/** + * @ingroup 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(). + * + * @return A device event, or NULL for other events + */ +struct libinput_event_device_notify * +libinput_event_get_device_notify_event(struct libinput_event *event); + +/** + * @ingroup event + * + * @return The generic libinput_event of this event + */ +struct libinput_event * +libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event); + +/** + * @defgroup event_keyboard Keyboard events + * + * Key events are generated when a key changes its logical state, usually by + * being pressed or released. + */ + +/** + * @ingroup event_keyboard + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event + */ +uint32_t +libinput_event_keyboard_get_time(struct libinput_event_keyboard *event); + +/** + * @ingroup event_keyboard + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event in microseconds + */ +uint64_t +libinput_event_keyboard_get_time_usec(struct libinput_event_keyboard *event); + +/** + * @ingroup event_keyboard + * + * @return The keycode that triggered this key event + */ +uint32_t +libinput_event_keyboard_get_key(struct libinput_event_keyboard *event); + +/** + * @ingroup event_keyboard + * + * @return The state change of the key + */ +enum libinput_key_state +libinput_event_keyboard_get_key_state(struct libinput_event_keyboard *event); + +/** + * @ingroup event_keyboard + * + * @return The generic libinput_event of this event + */ +struct libinput_event * +libinput_event_keyboard_get_base_event(struct libinput_event_keyboard *event); + +/** + * @ingroup event_keyboard + * + * For the key of a @ref LIBINPUT_EVENT_KEYBOARD_KEY event, return the total number + * of keys pressed on all devices on the associated seat after the event was + * triggered. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_KEYBOARD_KEY. For other events, this function returns 0. + * + * @return The seat wide pressed key count for the key of this event + */ +uint32_t +libinput_event_keyboard_get_seat_key_count( + struct libinput_event_keyboard *event); + +/** + * @defgroup event_pointer Pointer events + * + * Pointer events reflect motion, button and scroll events, as well as + * events from other axes. + */ + +/** + * @ingroup event_pointer + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event + */ +uint32_t +libinput_event_pointer_get_time(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event in microseconds + */ +uint64_t +libinput_event_pointer_get_time_usec(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the delta between the last event and the current event. For pointer + * events that are not of type @ref LIBINPUT_EVENT_POINTER_MOTION, this + * function returns 0. + * + * If a device employs pointer acceleration, the delta returned by this + * function is the accelerated delta. + * + * Relative motion deltas are to be interpreted as pixel movement of a + * standardized mouse. See the libinput documentation for more details. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION. + * + * @return The relative x movement since the last event + */ +double +libinput_event_pointer_get_dx(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the delta between the last event and the current event. For pointer + * events that are not of type @ref LIBINPUT_EVENT_POINTER_MOTION, this + * function returns 0. + * + * If a device employs pointer acceleration, the delta returned by this + * function is the accelerated delta. + * + * Relative motion deltas are to be interpreted as pixel movement of a + * standardized mouse. See the libinput documentation for more details. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION. + * + * @return The relative y movement since the last event + */ +double +libinput_event_pointer_get_dy(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the relative delta of the unaccelerated motion vector of the + * current event. For pointer events that are not of type @ref + * LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. + * + * Relative unaccelerated motion deltas are raw device coordinates. + * Note that these coordinates are subject to the device's native + * resolution. Touchpad coordinates represent raw device coordinates in the + * X resolution of the touchpad. See the libinput documentation for more + * details. + * + * Any rotation applied to the device also applies to unaccelerated motion + * (see libinput_device_config_rotation_set_angle()). + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION. + * + * @return The unaccelerated relative x movement since the last event + */ +double +libinput_event_pointer_get_dx_unaccelerated( + struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the relative delta of the unaccelerated motion vector of the + * current event. For pointer events that are not of type @ref + * LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. + * + * Relative unaccelerated motion deltas are raw device coordinates. + * Note that these coordinates are subject to the device's native + * resolution. Touchpad coordinates represent raw device coordinates in the + * X resolution of the touchpad. See the libinput documentation for more + * details. + * + * Any rotation applied to the device also applies to unaccelerated motion + * (see libinput_device_config_rotation_set_angle()). + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION. + * + * @return The unaccelerated relative y movement since the last event + */ +double +libinput_event_pointer_get_dy_unaccelerated( + struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the current absolute x coordinate of the pointer event, in mm from + * the top left corner of the device. To get the corresponding output screen + * coordinate, use libinput_event_pointer_get_absolute_x_transformed(). + * + * For pointer events that are not of type + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE. + * + * @return The current absolute x coordinate + */ +double +libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the current absolute y coordinate of the pointer event, in mm from + * the top left corner of the device. To get the corresponding output screen + * coordinate, use libinput_event_pointer_get_absolute_y_transformed(). + * + * For pointer events that are not of type + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE. + * + * @return The current absolute y coordinate + */ +double +libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the current absolute x coordinate of the pointer event, transformed to + * screen coordinates. + * + * For pointer events that are not of type + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this + * function is undefined. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE. + * + * @param event The libinput pointer event + * @param width The current output screen width + * @return The current absolute x coordinate transformed to a screen coordinate + */ +double +libinput_event_pointer_get_absolute_x_transformed( + struct libinput_event_pointer *event, + uint32_t width); + +/** + * @ingroup event_pointer + * + * Return the current absolute y coordinate of the pointer event, transformed to + * screen coordinates. + * + * For pointer events that are not of type + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this function is + * undefined. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE. + * + * @param event The libinput pointer event + * @param height The current output screen height + * @return The current absolute y coordinate transformed to a screen coordinate + */ +double +libinput_event_pointer_get_absolute_y_transformed( + struct libinput_event_pointer *event, + uint32_t height); + +/** + * @ingroup event_pointer + * + * Return the button that triggered this event. + * For pointer events that are not of type @ref + * LIBINPUT_EVENT_POINTER_BUTTON, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_BUTTON. + * + * @return The button triggering this event + */ +uint32_t +libinput_event_pointer_get_button(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the button state that triggered this event. + * For pointer events that are not of type @ref + * LIBINPUT_EVENT_POINTER_BUTTON, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_BUTTON. + * + * @return The button state triggering this event + */ +enum libinput_button_state +libinput_event_pointer_get_button_state(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * For the button of a @ref LIBINPUT_EVENT_POINTER_BUTTON event, return the + * total number of buttons pressed on all devices on the associated seat + * after the event was triggered. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_BUTTON. For other events, this function + * returns 0. + * + * @return The seat wide pressed button count for the key of this event + */ +uint32_t +libinput_event_pointer_get_seat_button_count( + struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Check if the event has a valid value for the given axis. + * + * If this function returns non-zero for an axis and + * libinput_event_pointer_get_axis_value() returns a value of 0, the event + * is a scroll stop event. + * + * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, @ref + * LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or @ref + * LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_AXIS, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. + * + * @return Non-zero if this event contains a value for this axis + */ +int +libinput_event_pointer_has_axis(struct libinput_event_pointer *event, + enum libinput_pointer_axis axis); + +/** + * @ingroup event_pointer + * + * Return the axis value of the given axis. The interpretation of the value + * depends on the axis. For the two scrolling axes + * @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and + * @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in + * relative scroll units, with the positive direction being down or right, + * respectively. For the interpretation of the value, see + * libinput_event_pointer_get_axis_source(). + * + * If libinput_event_pointer_has_axis() returns 0 for an axis, this function + * returns 0 for that axis. + * + * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS, + * this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_AXIS. + * + * @return The axis value of this event + * + * @see libinput_event_pointer_get_axis_value_discrete + */ +double +libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event, + enum libinput_pointer_axis axis); + +/** + * @ingroup event_pointer + * + * Return the source for a given axis event. Axis events (scroll events) can + * be caused by a hardware item such as a scroll wheel or emulated from + * other input sources, such as two-finger or edge scrolling on a + * touchpad. + * + * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_FINGER, libinput + * guarantees that a scroll sequence is terminated with a scroll value of 0. + * A caller may use this information to decide on whether kinetic scrolling + * should be triggered on this scroll sequence. + * The coordinate system is identical to the cursor movement, i.e. a + * scroll value of 1 represents the equivalent relative motion of 1. + * + * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, no terminating + * event is guaranteed (though it may happen). + * Scrolling is in discrete steps, the value is the angle the wheel moved + * in degrees. The default is 15 degrees per wheel click, but some mice may + * have differently grained wheels. It is up to the caller how to interpret + * such different step sizes. Callers should use + * libinput_event_pointer_get_scroll_value_v120() for a simpler API of + * handling scroll wheel events of different step sizes. + * + * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, libinput + * guarantees that a scroll sequence is terminated with a scroll value of 0. + * The coordinate system is identical to the cursor movement, i.e. a + * scroll value of 1 represents the equivalent relative motion of 1. + * + * @deprecated The source @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT is + * deprecated as of libinput 1.16. No device has ever sent this source. + * + * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS, + * this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_AXIS. + * + * @note This function is superfluous as of libinput 1.19. The event + * codes for @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, @ref + * LIBINPUT_EVENT_POINTER_SCROLL_FINGER and @ref + * LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS have the axis source encoded in + * the event type. + * + * @return The source for this axis event + */ +enum libinput_pointer_axis_source +libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event); + +/** + * @ingroup event_pointer + * + * Return the axis value in discrete steps for a given axis event. How a + * value translates into a discrete step depends on the source. + * + * @note This function does not support high-resolution mouse wheels and + * should be considered deprecated as of libinput 1.19. Callers should use + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL and + * libinput_event_pointer_get_scroll_value_v120() instead. + * + * If the event is not of type @ref LIBINPUT_EVENT_POINTER_AXIS, this + * function returns 0. + * + * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, the discrete + * value correspond to the number of physical mouse wheel clicks. + * + * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS or @ref + * LIBINPUT_POINTER_AXIS_SOURCE_FINGER, the discrete value is always 0. + * + * @return The discrete value for the given event. + * + * @see libinput_event_pointer_get_axis_value + * @see libinput_event_pointer_get_scroll_value_v120 + */ +double +libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *event, + enum libinput_pointer_axis axis); + +/** + * @ingroup event_pointer + * + * Return the axis value of the given axis. The interpretation of the value + * depends on the axis. For the two scrolling axes + * @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and + * @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in + * relative scroll units, with the positive direction being down or right, + * respectively. If libinput_event_pointer_has_axis() returns 0 for an axis, + * this function returns 0 for that axis. + * + * If the event is @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, libinput + * guarantees that a scroll sequence is terminated with a scroll value of 0. + * A caller may use this information to decide on whether kinetic scrolling + * should be triggered on this scroll sequence. + * The coordinate system is identical to the cursor movement, i.e. a + * scroll value of 1 represents the equivalent relative motion of 1. + * + * If the event is @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, no terminating + * event is guaranteed (though it may happen). + * Scrolling is in discrete steps, the value is the angle the wheel moved + * in degrees. The default is 15 degrees per wheel click, but some mice may + * have differently grained wheels. It is up to the caller how to interpret + * such different step sizes. Callers should use + * libinput_event_pointer_get_scroll_value_v120() for a simpler API of + * handling scroll wheel events of different step sizes. + * + * If the event is @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS, libinput + * guarantees that a scroll sequence is terminated with a scroll value of 0. + * The coordinate system is identical to the cursor movement, i.e. a + * scroll value of 1 represents the equivalent relative motion of 1. + * + * For pointer events that are not of type + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS, this function returns zero. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, + * @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or + * @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. + * + * @return The axis value of this event + * + * @see libinput_event_pointer_get_scroll_value_v120 + * + * @since 1.19 + */ +double +libinput_event_pointer_get_scroll_value(struct libinput_event_pointer *event, + enum libinput_pointer_axis axis); + +/** + * @ingroup event_pointer + * + * For events of type @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL + * the v120-normalized value represents the movement in logical mouse wheel + * clicks, normalized to the -120..+120 range. + * + * A value that is a fraction of ±120 indicates a wheel movement less than + * one logical click, a caller should either scroll by the respective + * fraction of the normal scroll distance or accumulate that value until a + * multiple of 120 is reached. + * + * For most callers, this is the preferred way of handling high-resolution + * scroll events. + * + * The normalized v120 value does not take device-specific physical angles + * or distances into account, i.e. a wheel with a click angle of 20 degrees + * produces only 18 logical clicks per 360 degree rotation, a wheel with a + * click angle of 15 degrees produces 24 logical clicks per 360 degree + * rotation. Where the physical angle matters, use + * libinput_event_pointer_get_axis_value() instead. + * + * The magic number 120 originates from the + * Windows Vista Mouse Wheel design document. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL. + * + * @return A value normalized to the 0-±120 range + * + * @see libinput_event_pointer_get_axis_value + * @see libinput_event_pointer_get_axis_value_discrete + * + * @since 1.19 + */ +double +libinput_event_pointer_get_scroll_value_v120(struct libinput_event_pointer *event, + enum libinput_pointer_axis axis); + +/** + * @ingroup event_pointer + * + * @return The generic libinput_event of this event + */ +struct libinput_event * +libinput_event_pointer_get_base_event(struct libinput_event_pointer *event); + +/** + * @defgroup event_touch Touch events + * + * Events from absolute touch devices. + */ + +/** + * @ingroup event_touch + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event + */ +uint32_t +libinput_event_touch_get_time(struct libinput_event_touch *event); + +/** + * @ingroup event_touch + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event in microseconds + */ +uint64_t +libinput_event_touch_get_time_usec(struct libinput_event_touch *event); + +/** + * @ingroup event_touch + * + * Get the slot of this touch event. See the kernel's multitouch + * protocol B documentation for more information. + * + * If the touch event has no assigned slot, for example if it is from a + * single touch device, this function returns -1. + * + * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref + * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref + * LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0. + * + * @note It is an application bug to call this function for events of type + * other than @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP, + * @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref LIBINPUT_EVENT_TOUCH_CANCEL. + * + * @return The slot of this touch event + */ +int32_t +libinput_event_touch_get_slot(struct libinput_event_touch *event); + +/** + * @ingroup event_touch + * + * Get the seat slot of the touch event. A seat slot is a non-negative seat + * wide unique identifier of an active touch point. + * + * Events from single touch devices will be represented as one individual + * touch point per device. + * + * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref + * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref + * LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0. + * + * @note It is an application bug to call this function for events of type + * other than @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP, + * @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref LIBINPUT_EVENT_TOUCH_CANCEL. + * + * @return The seat slot of the touch event + */ +int32_t +libinput_event_touch_get_seat_slot(struct libinput_event_touch *event); + +/** + * @ingroup event_touch + * + * Return the current absolute x coordinate of the touch event, in mm from + * the top left corner of the device. To get the corresponding output screen + * coordinate, use libinput_event_touch_get_x_transformed(). + * + * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref + * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. + * + * @note It is an application bug to call this function for events of type + * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref + * LIBINPUT_EVENT_TOUCH_MOTION. + * + * @param event The libinput touch event + * @return The current absolute x coordinate + */ +double +libinput_event_touch_get_x(struct libinput_event_touch *event); + +/** + * @ingroup event_touch + * + * Return the current absolute y coordinate of the touch event, in mm from + * the top left corner of the device. To get the corresponding output screen + * coordinate, use libinput_event_touch_get_y_transformed(). + * + * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref + * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. + * + * @note It is an application bug to call this function for events of type + * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref + * LIBINPUT_EVENT_TOUCH_MOTION. + * + * @param event The libinput touch event + * @return The current absolute y coordinate + */ +double +libinput_event_touch_get_y(struct libinput_event_touch *event); + +/** + * @ingroup event_touch + * + * Return the current absolute x coordinate of the touch event, transformed to + * screen coordinates. + * + * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref + * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. + * + * @note It is an application bug to call this function for events of type + * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref + * LIBINPUT_EVENT_TOUCH_MOTION. + * + * @param event The libinput touch event + * @param width The current output screen width + * @return The current absolute x coordinate transformed to a screen coordinate + */ +double +libinput_event_touch_get_x_transformed(struct libinput_event_touch *event, + uint32_t width); + +/** + * @ingroup event_touch + * + * Return the current absolute y coordinate of the touch event, transformed to + * screen coordinates. + * + * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref + * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. + * + * @note It is an application bug to call this function for events of type + * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref + * LIBINPUT_EVENT_TOUCH_MOTION. + * + * @param event The libinput touch event + * @param height The current output screen height + * @return The current absolute y coordinate transformed to a screen coordinate + */ +double +libinput_event_touch_get_y_transformed(struct libinput_event_touch *event, + uint32_t height); + +/** + * @ingroup event_touch + * + * @return The generic libinput_event of this event + */ +struct libinput_event * +libinput_event_touch_get_base_event(struct libinput_event_touch *event); + +/** + * @defgroup event_gesture Gesture events + * + * Gesture events are generated when a gesture is recognized on a touchpad. + * + * Gesture sequences always start with a LIBINPUT_EVENT_GESTURE_FOO_START + * event. All following gesture events will be of the + * LIBINPUT_EVENT_GESTURE_FOO_UPDATE type until a + * LIBINPUT_EVENT_GESTURE_FOO_END is generated which signals the end of the + * gesture. + * + * See the libinput documentation for details on gesture handling. + */ + +/** + * @ingroup event_gesture + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event + */ +uint32_t +libinput_event_gesture_get_time(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @return The event time for this event in microseconds + */ +uint64_t +libinput_event_gesture_get_time_usec(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * @return The generic libinput_event of this event + */ +struct libinput_event * +libinput_event_gesture_get_base_event(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the number of fingers used for a gesture. This can be used e.g. + * to differentiate between 3 or 4 finger swipes. + * + * This function can be called on all gesture events and the returned finger + * count value remains the same for the lifetime of a gesture. Thus, if a + * user puts down a fourth finger during a three-finger swipe gesture, + * libinput will end the three-finger gesture and, if applicable, start a + * four-finger swipe gesture. A caller may decide that those gestures are + * semantically identical and continue the two gestures as one single gesture. + * + * @return the number of fingers used for a gesture + */ +int +libinput_event_gesture_get_finger_count(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return if the gesture ended normally, or if it was cancelled. + * For gesture events that are not of type + * @ref LIBINPUT_EVENT_GESTURE_SWIPE_END or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_GESTURE_SWIPE_END or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_END. + * + * @return 0 or 1, with 1 indicating that the gesture was cancelled. + */ +int +libinput_event_gesture_get_cancelled(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the delta between the last event and the current event. For gesture + * events that are not of type @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0. + * + * If a device employs pointer acceleration, the delta returned by this + * function is the accelerated delta. + * + * Relative motion deltas are normalized to represent those of a device with + * 1000dpi resolution. See the libinput documentation for more details. + * + * @return the relative x movement since the last event + */ +double +libinput_event_gesture_get_dx(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the delta between the last event and the current event. For gesture + * events that are not of type @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0. + * + * If a device employs pointer acceleration, the delta returned by this + * function is the accelerated delta. + * + * Relative motion deltas are normalized to represent those of a device with + * 1000dpi resolution. See the libinput documentation for more details. + * + * @return the relative y movement since the last event + */ +double +libinput_event_gesture_get_dy(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the relative delta of the unaccelerated motion vector of the + * current event. For gesture events that are not of type + * @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0. + * + * Relative unaccelerated motion deltas are normalized to represent those of a + * device with 1000dpi resolution. See the libinput documentation for more + * details. Note that unaccelerated events are not equivalent to 'raw' events + * as read from the device. + * + * Any rotation applied to the device also applies to gesture motion + * (see libinput_device_config_rotation_set_angle()). + * + * @return the unaccelerated relative x movement since the last event + */ +double +libinput_event_gesture_get_dx_unaccelerated( + struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the relative delta of the unaccelerated motion vector of the + * current event. For gesture events that are not of type + * @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0. + * + * Relative unaccelerated motion deltas are normalized to represent those of a + * device with 1000dpi resolution. See the libinput documentation for more + * details. Note that unaccelerated events are not equivalent to 'raw' events + * as read from the device. + * + * Any rotation applied to the device also applies to gesture motion + * (see libinput_device_config_rotation_set_angle()). + * + * @return the unaccelerated relative y movement since the last event + */ +double +libinput_event_gesture_get_dy_unaccelerated( + struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the absolute scale of a pinch gesture, the scale is the division + * of the current distance between the fingers and the distance at the start + * of the gesture. The scale begins at 1.0, and if e.g. the fingers moved + * together by 50% then the scale will become 0.5, if they move twice as far + * apart as initially the scale becomes 2.0, etc. + * + * For gesture events that are of type @ref + * LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, this function returns 1.0. + * + * For gesture events that are of type @ref + * LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns the scale value + * of the most recent @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event (if + * any) or 1.0 otherwise. + * + * For all other events this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, @ref + * LIBINPUT_EVENT_GESTURE_PINCH_END or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE. + * + * @return the absolute scale of a pinch gesture + */ +double +libinput_event_gesture_get_scale(struct libinput_event_gesture *event); + +/** + * @ingroup event_gesture + * + * Return the angle delta in degrees between the last and the current @ref + * LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event. For gesture events that + * are not of type @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this + * function returns 0. + * + * The angle delta is defined as the change in angle of the line formed by + * the 2 fingers of a pinch gesture. Clockwise rotation is represented + * by a positive delta, counter-clockwise by a negative delta. If e.g. the + * fingers are on the 12 and 6 location of a clock face plate and they move + * to the 1 resp. 7 location in a single event then the angle delta is + * 30 degrees. + * + * If more than two fingers are present, the angle represents the rotation + * around the center of gravity. The calculation of the center of gravity is + * implementation-dependent. + * + * @return the angle delta since the last event + */ +double +libinput_event_gesture_get_angle_delta(struct libinput_event_gesture *event); + +/** + * @defgroup event_tablet Tablet events + * + * Events that come from tools on tablet devices. For events from the pad, + * see @ref event_tablet_pad. + * + * Events from tablet devices are exposed by two interfaces, tools and pads. + * Tool events originate (usually) from a stylus-like device, pad events + * reflect any events originating from the physical tablet itself. + * + * Note that many tablets support touch events. These are exposed through + * the @ref LIBINPUT_DEVICE_CAP_POINTER interface (for external touchpad-like + * devices such as the Wacom Intuos series) or @ref + * LIBINPUT_DEVICE_CAP_TOUCH interface (for built-in touchscreen-like + * devices such as the Wacom Cintiq series). + */ + +/** + * @ingroup event_tablet + * + * @return The generic libinput_event of this event + * + * @since 1.2 + */ +struct libinput_event * +libinput_event_tablet_tool_get_base_event(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the x axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_x_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the y axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_y_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the pressure axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_pressure_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the distance axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * For tablet tool events of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, + * this function always returns 1. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_distance_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the tilt x axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_tilt_x_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the tilt y axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_tilt_y_has_changed( + struct libinput_event_tablet_tool *event); +/** + * @ingroup event_tablet + * + * Check if the z-rotation axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_rotation_has_changed( + struct libinput_event_tablet_tool *event); +/** + * @ingroup event_tablet + * + * Check if the slider axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_slider_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the size major axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + */ +int +libinput_event_tablet_tool_size_major_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the size minor axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + */ +int +libinput_event_tablet_tool_size_minor_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Check if the wheel axis was updated in this event. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, + * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or + * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. + * + * @note It is an application bug to call this function for events other + * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref + * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return 1 if the axis was updated or 0 otherwise + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_wheel_has_changed( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the X coordinate of the tablet tool, in mm from the top left + * corner of the tablet in its current logical orientation. Use + * libinput_event_tablet_tool_get_x_transformed() for transforming the axis + * value into a different coordinate space. + * + * @note On some devices, returned value may be negative or larger than the + * width of the device. See the libinput documentation for more details. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_x(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the Y coordinate of the tablet tool, in mm from the top left + * corner of the tablet in its current logical orientation. Use + * libinput_event_tablet_tool_get_y_transformed() for transforming the axis + * value into a different coordinate space. + * + * @note On some devices, returned value may be negative or larger than the + * width of the device. See the libinput documentation for more details. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_y(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the delta between the last event and the current event. + * If the tool employs pointer acceleration, the delta returned by this + * function is the accelerated delta. + * + * This value is in screen coordinate space, the delta is to be interpreted + * like the return value of libinput_event_pointer_get_dx(). + * See the libinput documentation for more details. + * + * @param event The libinput tablet event + * @return The relative x movement since the last event + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_dx(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the delta between the last event and the current event. + * If the tool employs pointer acceleration, the delta returned by this + * function is the accelerated delta. + * + * This value is in screen coordinate space, the delta is to be interpreted + * like the return value of libinput_event_pointer_get_dx(). + * See the libinput documentation for more details. + * + * @param event The libinput tablet event + * @return The relative y movement since the last event + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_dy(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current pressure being applied on the tool in use, normalized + * to the range [0, 1]. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_pressure(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current distance from the tablet's sensor, normalized to the + * range [0, 1]. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_distance(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current tilt along the X axis of the tablet's current logical + * orientation, in degrees off the tablet's z axis. That is, if the tool is + * perfectly orthogonal to the tablet, the tilt angle is 0. When the top + * tilts towards the logical top/left of the tablet, the x/y tilt angles are + * negative, if the top tilts towards the logical bottom/right of the + * tablet, the x/y tilt angles are positive. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the axis in degrees + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_tilt_x(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current tilt along the Y axis of the tablet's current logical + * orientation, in degrees off the tablet's z axis. That is, if the tool is + * perfectly orthogonal to the tablet, the tilt angle is 0. When the top + * tilts towards the logical top/left of the tablet, the x/y tilt angles are + * negative, if the top tilts towards the logical bottom/right of the + * tablet, the x/y tilt angles are positive. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis in degrees + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_tilt_y(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current z rotation of the tool in degrees, clockwise from the + * tool's logical neutral position. + * + * For tools of type @ref LIBINPUT_TABLET_TOOL_TYPE_MOUSE and @ref + * LIBINPUT_TABLET_TOOL_TYPE_LENS the logical neutral position is + * pointing to the current logical north of the tablet. For tools of type @ref + * LIBINPUT_TABLET_TOOL_TYPE_BRUSH, the logical neutral position is with the + * buttons pointing up. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_rotation(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current position of the slider on the tool, normalized to the + * range [-1, 1]. The logical zero is the neutral position of the slider, or + * the logical center of the axis. This axis is available on e.g. the Wacom + * Airbrush. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the the axis + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_slider_position(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current size in mm along the major axis of the touching + * ellipse. This axis is not necessarily aligned with either x or y, the + * rotation must be taken into account. + * + * Where no rotation is available on a tool, or where rotation is zero, the + * major axis aligns with the y axis and the minor axis with the x axis. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the axis major in mm + */ +double +libinput_event_tablet_tool_get_size_major(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the current size in mm along the minor axis of the touching + * ellipse. This axis is not necessarily aligned with either x or y, the + * rotation must be taken into account. + * + * Where no rotation is available on a tool, or where rotation is zero, the + * minor axis aligns with the y axis and the minor axis with the x axis. + * + * If this axis does not exist on the current tool, this function returns 0. + * + * @param event The libinput tablet tool event + * @return The current value of the axis minor in mm + */ +double +libinput_event_tablet_tool_get_size_minor(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the delta for the wheel in degrees. + * + * @param event The libinput tablet tool event + * @return The delta of the wheel, in degrees, compared to the last event + * + * @see libinput_event_tablet_tool_get_wheel_delta_discrete + */ +double +libinput_event_tablet_tool_get_wheel_delta( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the delta for the wheel in discrete steps (e.g. wheel clicks). + + * @param event The libinput tablet tool event + * @return The delta of the wheel, in discrete steps, compared to the last event + * + * @see libinput_event_tablet_tool_get_wheel_delta_discrete + * + * @since 1.2 + */ +int +libinput_event_tablet_tool_get_wheel_delta_discrete( + struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the current absolute x coordinate of the tablet tool event, + * transformed to screen coordinates. + * + * @note This function may be called for a specific axis even if + * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis. + * libinput always includes all device axes in the event. + * + * @note On some devices, returned value may be negative or larger than the + * width of the device. See the libinput documentation for more details. + * + * @param event The libinput tablet tool event + * @param width The current output screen width + * @return the current absolute x coordinate transformed to a screen coordinate + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *event, + uint32_t width); + +/** + * @ingroup event_tablet + * + * Return the current absolute y coordinate of the tablet tool event, + * transformed to screen coordinates. + * + * @note This function may be called for a specific axis even if + * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis. + * libinput always includes all device axes in the event. + * + * @note On some devices, returned value may be negative or larger than the + * width of the device. See the libinput documentation for more details. + * + * @param event The libinput tablet tool event + * @param height The current output screen height + * @return the current absolute y coordinate transformed to a screen coordinate + * + * @since 1.2 + */ +double +libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool *event, + uint32_t height); + +/** + * @ingroup event_tablet + * + * Returns the tool that was in use during this event. + * + * The returned tablet tool is not refcounted and may become invalid after + * the next call to libinput. Use libinput_tablet_tool_ref() and + * libinput_tablet_tool_unref() to continue using the handle outside of the + * immediate scope. + * + * If the caller holds at least one reference, this struct is used + * whenever the tools enters proximity again. + * + * @note Physical tool tracking requires hardware support. If unavailable, + * libinput creates one tool per type per tablet. See + * libinput_tablet_tool_get_serial() for more details. + * + * @param event The libinput tablet tool event + * @return The new tool triggering this event + * + * @since 1.2 + */ +struct libinput_tablet_tool * +libinput_event_tablet_tool_get_tool(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the new proximity state of a tool from a proximity event. + * Used to check whether or not a tool came in or out of proximity during an + * event of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY. + * + * The proximity state represents the logical proximity state which does not + * necessarily match when a tool comes into sensor range or leaves the + * sensor range. On some tools this range does not represent the physical + * range but a reduced tool-specific logical range. If the range is reduced, + * this is done transparent to the caller. + * + * For example, the Wacom mouse and lens cursor tools are usually + * used in relative mode, lying flat on the tablet. Movement typically follows + * the interaction normal mouse movements have, i.e. slightly lift the tool and + * place it in a separate location. The proximity detection on Wacom + * tablets however extends further than the user may lift the mouse, i.e. the + * tool may not be lifted out of physical proximity. For such tools, libinput + * provides software-emulated proximity. + * + * @param event The libinput tablet tool event + * @return The new proximity state of the tool from the event. + * + * @since 1.2 + */ +enum libinput_tablet_tool_proximity_state +libinput_event_tablet_tool_get_proximity_state(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Returns the new tip state of a tool from a tip event. + * Used to check whether or not a tool came in contact with the tablet + * surface or left contact with the tablet surface during an + * event of type @ref LIBINPUT_EVENT_TABLET_TOOL_TIP. + * + * @param event The libinput tablet tool event + * @return The new tip state of the tool from the event. + * + * @since 1.2 + */ +enum libinput_tablet_tool_tip_state +libinput_event_tablet_tool_get_tip_state(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the button that triggered this event. For events that are not of + * type @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return the button triggering this event + * + * @since 1.2 + */ +uint32_t +libinput_event_tablet_tool_get_button(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the button state of the event. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. + * + * @param event The libinput tablet tool event + * @return the button state triggering this event + * + * @since 1.2 + */ +enum libinput_button_state +libinput_event_tablet_tool_get_button_state(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * For the button of a @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON event, return the total + * number of buttons pressed on all devices on the associated seat after the + * the event was triggered. + * + " @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. For other events, this function returns 0. + * + * @param event The libinput tablet tool event + * @return the seat wide pressed button count for the key of this event + * + * @since 1.2 + */ +uint32_t +libinput_event_tablet_tool_get_seat_button_count(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @param event The libinput tablet tool event + * @return The event time for this event + * + * @since 1.2 + */ +uint32_t +libinput_event_tablet_tool_get_time(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @param event The libinput tablet tool event + * @return The event time for this event in microseconds + * + * @since 1.2 + */ +uint64_t +libinput_event_tablet_tool_get_time_usec(struct libinput_event_tablet_tool *event); + +/** + * @ingroup event_tablet + * + * Return the high-level tool type for a tool object. + * + * The high level tool describes general interaction expected with the tool. + * For example, a user would expect a tool of type @ref + * LIBINPUT_TABLET_TOOL_TYPE_PEN to interact with a graphics application + * taking pressure and tilt into account. The default virtual tool assigned + * should be a drawing tool, e.g. a virtual pen or brush. + * A tool of type @ref LIBINPUT_TABLET_TOOL_TYPE_ERASER would normally be + * mapped to an eraser-like virtual tool. + * + * If supported by the hardware, a more specific tool id is always + * available, see libinput_tablet_tool_get_tool_id(). + * + * @param tool The libinput tool + * @return The tool type for this tool object + * + * @see libinput_tablet_tool_get_tool_id + * + * @since 1.2 + */ +enum libinput_tablet_tool_type +libinput_tablet_tool_get_type(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return the tool ID for a tool object. If nonzero, this number identifies + * the specific type of the tool with more precision than the type returned in + * libinput_tablet_tool_get_type(). Not all tablets support a tool ID. + * + * Tablets known to support tool IDs include the Wacom Intuos 3, 4, 5, Wacom + * Cintiq and Wacom Intuos Pro series. The tool ID can be used to + * distinguish between e.g. a Wacom Classic Pen or a Wacom Pro Pen. It is + * the caller's responsibility to interpret the tool ID. + * + * @param tool The libinput tool + * @return The tool ID for this tool object or 0 if none is provided + * + * @see libinput_tablet_tool_get_type + * + * @since 1.2 + */ +uint64_t +libinput_tablet_tool_get_tool_id(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Increment the reference count of the tool by one. A tool is destroyed + * whenever the reference count reaches 0. See libinput_tablet_tool_unref(). + * + * @param tool The tool to increment the ref count of + * @return The passed tool + * + * @see libinput_tablet_tool_unref + * + * @since 1.2 + */ +struct libinput_tablet_tool * +libinput_tablet_tool_ref(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Decrement the reference count of the tool by one. When the reference + * count of the tool reaches 0, the memory allocated for the tool will be + * freed. + * + * @param tool The tool to decrement the ref count of + * @return NULL if the tool was destroyed otherwise the passed tool + * + * @see libinput_tablet_tool_ref + * + * @since 1.2 + */ +struct libinput_tablet_tool * +libinput_tablet_tool_unref(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool supports pressure. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_pressure(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool supports distance. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_distance(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool supports tilt. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_tilt(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool supports z-rotation. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_rotation(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool has a slider axis. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_slider(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool has a ellipsis major and minor. + * Where the underlying hardware only supports one of either major or minor, + * libinput emulates the other axis as a circular contact, i.e. major == + * minor for all values of major. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + */ +int +libinput_tablet_tool_has_size(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return whether the tablet tool has a relative wheel. + * + * @param tool The tool to check the axis capabilities of + * @return Nonzero if the axis is available, zero otherwise. + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_wheel(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Check if a tablet tool has a button with the + * passed-in code (see linux/input.h). + * + * @param tool A tablet tool + * @param code button code to check for + * + * @return 1 if the tool supports this button code, 0 if it does not + * + * @since 1.2 + */ +int +libinput_tablet_tool_has_button(struct libinput_tablet_tool *tool, + uint32_t code); + +/** + * @ingroup event_tablet + * + * Return nonzero if the physical tool can be uniquely identified by + * libinput, or nonzero otherwise. If a tool can be uniquely identified, + * keeping a reference to the tool allows tracking the tool across + * proximity out sequences and across compatible tablets. + * See libinput_tablet_tool_get_serial() for more details. + * + * @param tool A tablet tool + * @return 1 if the tool can be uniquely identified, 0 otherwise. + * + * @see libinput_tablet_tool_get_serial + * + * @since 1.2 + */ +int +libinput_tablet_tool_is_unique(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return the serial number of a tool. If the tool does not report a serial + * number, this function returns zero. + * + * Some tools provide hardware information that enables libinput to uniquely + * identify the physical device. For example, tools compatible with the + * Wacom Intuos 4, Intuos 5, Intuos Pro and Cintiq series are uniquely + * identifiable through a serial number. libinput does not specify how a + * tool can be identified uniquely, a caller should use + * libinput_tablet_tool_is_unique() to check if the tool is unique. + * + * libinput creates a struct @ref libinput_tablet_tool on the first + * proximity in of this tool. By default, this struct is destroyed on + * proximity out and re-initialized on the next proximity in. If a caller + * keeps a reference to the tool by using libinput_tablet_tool_ref() + * libinput re-uses this struct whenever that same physical tool comes into + * proximity on any tablet + * recognized by libinput. It is possible to attach tool-specific virtual + * state to the tool. For example, a graphics program such as the GIMP may + * assign a specific color to each tool, allowing the artist to use the + * tools like physical pens of different color. In multi-tablet setups it is + * also possible to track the tool across devices. + * + * If the tool does not have a unique identifier, libinput creates a single + * struct @ref libinput_tablet_tool per tool type on each tablet the tool is + * used on. + * + * @param tool The libinput tool + * @return The tool serial number + * + * @see libinput_tablet_tool_is_unique + * + * @since 1.2 + */ +uint64_t +libinput_tablet_tool_get_serial(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Return the user data associated with a tool object. libinput does + * not manage, look at, or modify this data. The caller must ensure the + * data is valid. + * + * @param tool The libinput tool + * @return The user data associated with the tool object + * + * @since 1.2 + */ +void * +libinput_tablet_tool_get_user_data(struct libinput_tablet_tool *tool); + +/** + * @ingroup event_tablet + * + * Set the user data associated with a tool object, if any. + * + * @param tool The libinput tool + * @param user_data The user data to associate with the tool object + * + * @since 1.2 + */ +void +libinput_tablet_tool_set_user_data(struct libinput_tablet_tool *tool, + void *user_data); + +/** + * @defgroup event_tablet_pad Tablet pad events + * + * Events that come from the pad of tablet devices. For events from the + * tablet tools, see @ref event_tablet. + * + * @since 1.3 + */ + +/** + * @ingroup event_tablet_pad + * + * @return The generic libinput_event of this event + * + * @since 1.3 + */ +struct libinput_event * +libinput_event_tablet_pad_get_base_event(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the current position of the ring, in degrees counterclockwise + * from the northern-most point of the ring in the tablet's current logical + * orientation. + * + * If the source is @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, + * libinput sends a terminating event with a ring value of -1 when the + * finger is lifted from the ring. A caller may use this information to e.g. + * determine if kinetic scrolling should be triggered. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return The current value of the the axis + * @retval -1 The finger was lifted + * + * @since 1.3 + */ +double +libinput_event_tablet_pad_get_ring_position(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the number of the ring that has changed state, with 0 being the + * first ring. On tablets with only one ring, this function always returns + * 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return The index of the ring that changed state + * + * @since 1.3 + */ +unsigned int +libinput_event_tablet_pad_get_ring_number(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the source of the interaction with the ring. If the source is + * @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, libinput sends a ring + * position value of -1 to terminate the current interaction. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return The source of the ring interaction + * + * @since 1.3 + */ +enum libinput_tablet_pad_ring_axis_source +libinput_event_tablet_pad_get_ring_source(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the current position of the strip, normalized to the range + * [0, 1], with 0 being the top/left-most point in the tablet's current + * logical orientation. + * + * If the source is @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, + * libinput sends a terminating event with a ring value of -1 when the + * finger is lifted from the ring. A caller may use this information to e.g. + * determine if kinetic scrolling should be triggered. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return The current value of the the axis + * @retval -1 The finger was lifted + * + * @since 1.3 + */ +double +libinput_event_tablet_pad_get_strip_position(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the number of the strip that has changed state, with 0 being the + * first strip. On tablets with only one strip, this function always returns + * 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return The index of the strip that changed state + * + * @since 1.3 + */ +unsigned int +libinput_event_tablet_pad_get_strip_number(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the source of the interaction with the strip. If the source is + * @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, libinput sends a strip + * position value of -1 to terminate the current interaction. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return The source of the strip interaction + * + * @since 1.3 + */ +enum libinput_tablet_pad_strip_axis_source +libinput_event_tablet_pad_get_strip_source(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Return the button number that triggered this event, starting at 0. + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON, + * this function returns 0. + * + * Note that the number returned is a generic sequential button number and + * not a semantic button code as defined in linux/input.h. + * See the libinput documentation for more details. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return the button triggering this event + * + * @since 1.3 + */ +uint32_t +libinput_event_tablet_pad_get_button_number(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Return the button state of the event. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return the button state triggering this event + * + * @since 1.3 + */ +enum libinput_button_state +libinput_event_tablet_pad_get_button_state(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Return the key code that triggered this event, e.g. KEY_CONTROLPANEL. The + * list of key codes is defined in linux/input-event-codes.h. + * + * For events that are not of type @ref LIBINPUT_EVENT_TABLET_PAD_KEY, + * this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_KEY. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return the key code triggering this event + * + * @since 1.15 + */ +uint32_t +libinput_event_tablet_pad_get_key(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Return the key state of the event. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_TABLET_PAD_KEY. For other events, this function + * returns 0. + * + * @param event The libinput tablet pad event + * @return the key state triggering this event + * + * @since 1.15 + */ +enum libinput_key_state +libinput_event_tablet_pad_get_key_state(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the mode the button, ring, or strip that triggered this event is + * in, at the time of the event. + * + * The mode is a virtual grouping of functionality, usually based on some + * visual feedback like LEDs on the pad. Mode indices start at 0, a device + * that does not support modes always returns 0. + * + * @note Pad keys are not part of a mode group. It is an application bug to + * call this function for @ref LIBINPUT_EVENT_TABLET_PAD_KEY. + * + * Mode switching is controlled by libinput and more than one mode may exist + * on the tablet. This function returns the mode that this event's button, + * ring or strip is logically in. If the button is a mode toggle button + * and the button event caused a new mode to be toggled, the mode returned + * is the new mode the button is in. + * + * Note that the returned mode is the mode valid as of the time of the + * event. The returned mode may thus be different to the mode returned by + * libinput_tablet_pad_mode_group_get_mode(). See + * libinput_tablet_pad_mode_group_get_mode() for details. + * + * @param event The libinput tablet pad event + * @return the 0-indexed mode of this button, ring or strip at the time of + * the event + * + * @see libinput_tablet_pad_mode_group_get_mode + * + * @since 1.4 + */ +unsigned int +libinput_event_tablet_pad_get_mode(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * Returns the mode group that the button, ring, or strip that triggered + * this event is considered in. The mode is a virtual grouping of + * functionality, usually based on some visual feedback like LEDs on the + * pad. + * + * @note Pad keys are not part of a mode group. It is an application bug to + * call this function for @ref LIBINPUT_EVENT_TABLET_PAD_KEY. + * + * The returned mode group is not refcounted and may become invalid after + * the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and + * libinput_tablet_pad_mode_group_unref() to continue using the handle + * outside of the immediate scope. + * + * @param event The libinput tablet pad event + * @return the mode group of the button, ring or strip that caused this event + * + * @see libinput_device_tablet_pad_get_mode_group + * + * @since 1.4 + */ +struct libinput_tablet_pad_mode_group * +libinput_event_tablet_pad_get_mode_group(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @param event The libinput tablet pad event + * @return The event time for this event + * + * @since 1.3 + */ +uint32_t +libinput_event_tablet_pad_get_time(struct libinput_event_tablet_pad *event); + +/** + * @ingroup event_tablet_pad + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @param event The libinput tablet pad event + * @return The event time for this event in microseconds + * + * @since 1.3 + */ +uint64_t +libinput_event_tablet_pad_get_time_usec(struct libinput_event_tablet_pad *event); + +/** + * @defgroup event_switch Switch events + * + * Events that come from switch devices. + */ + +/** + * @ingroup event_switch + * + * Return the switch that triggered this event. + * For pointer events that are not of type @ref + * LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_SWITCH_TOGGLE. + * + * @param event The libinput switch event + * @return The switch triggering this event + * + * @since 1.7 + */ +enum libinput_switch +libinput_event_switch_get_switch(struct libinput_event_switch *event); + +/** + * @ingroup event_switch + * + * Return the switch state that triggered this event. + * For switch events that are not of type @ref + * LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0. + * + * @note It is an application bug to call this function for events other than + * @ref LIBINPUT_EVENT_SWITCH_TOGGLE. + * + * @param event The libinput switch event + * @return The switch state triggering this event + * + * @since 1.7 + */ +enum libinput_switch_state +libinput_event_switch_get_switch_state(struct libinput_event_switch *event); + +/** + * @ingroup event_switch + * + * @return The generic libinput_event of this event + * + * @since 1.7 + */ +struct libinput_event * +libinput_event_switch_get_base_event(struct libinput_event_switch *event); + +/** + * @ingroup event_switch + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @param event The libinput switch event + * @return The event time for this event + * + * @since 1.7 + */ +uint32_t +libinput_event_switch_get_time(struct libinput_event_switch *event); + +/** + * @ingroup event_switch + * + * @note Timestamps may not always increase. See the libinput documentation + * for more details. + * + * @param event The libinput switch event + * @return The event time for this event in microseconds + * + * @since 1.7 + */ +uint64_t +libinput_event_switch_get_time_usec(struct libinput_event_switch *event); + +/** + * @defgroup base Initialization and manipulation of libinput contexts + */ + +/** + * @ingroup base + * @struct libinput_interface + * + * libinput does not open file descriptors to devices directly, instead + * open_restricted() and close_restricted() are called for each path that + * must be opened. + * + * @see libinput_udev_create_context + * @see libinput_path_create_context + */ +struct libinput_interface { + /** + * Open the device at the given path with the flags provided and + * return the fd. + * + * @param path The device path to open + * @param flags Flags as defined by open(2) + * @param user_data The user_data provided in + * libinput_udev_create_context() + * + * @return The file descriptor, or a negative errno on failure. + */ + int (*open_restricted)(const char *path, int flags, void *user_data); + /** + * Close the file descriptor. + * + * @param fd The file descriptor to close + * @param user_data The user_data provided in + * libinput_udev_create_context() + */ + void (*close_restricted)(int fd, void *user_data); +}; + +/** + * @ingroup base + * + * Create a new libinput context from udev. This context is inactive until + * assigned a seat ID with libinput_udev_assign_seat(). + * + * @param interface The callback interface + * @param user_data Caller-specific data passed to the various callback + * interfaces. + * @param udev An already initialized udev context + * + * @return An initialized, but inactive libinput context or NULL on error + */ +struct libinput * +libinput_udev_create_context(const struct libinput_interface *interface, + void *user_data, + struct udev *udev); + +/** + * @ingroup base + * + * Assign a seat to this libinput context. New devices or the removal of + * existing devices will appear as events during libinput_dispatch(). + * + * libinput_udev_assign_seat() succeeds even if no input devices are currently + * available on this seat, or if devices are available but fail to open in + * @ref libinput_interface::open_restricted. Devices that do not have the + * minimum capabilities to be recognized as pointer, keyboard or touch + * device are ignored. Such devices and those that failed to open + * ignored until the next call to libinput_resume(). + * + * This function may only be called once per context. + * + * @param libinput A libinput context initialized with + * libinput_udev_create_context() + * @param seat_id A seat identifier. This string must not be NULL. + * + * @return 0 on success or -1 on failure. + */ +int +libinput_udev_assign_seat(struct libinput *libinput, + const char *seat_id); + +/** + * @ingroup base + * + * Create a new libinput context that requires the caller to manually add or + * remove devices with libinput_path_add_device() and + * libinput_path_remove_device(). + * + * The context is fully initialized but will not generate events until at + * least one device has been added. + * + * The reference count of the context is initialized to 1. See @ref + * libinput_unref. + * + * @param interface The callback interface + * @param user_data Caller-specific data passed to the various callback + * interfaces. + * + * @return An initialized, empty libinput context. + */ +struct libinput * +libinput_path_create_context(const struct libinput_interface *interface, + void *user_data); + +/** + * @ingroup base + * + * Add a device to a libinput context initialized with + * libinput_path_create_context(). If successful, the device will be + * added to the internal list and re-opened on libinput_resume(). The device + * can be removed with libinput_path_remove_device(). + * + * If the device was successfully initialized, it is returned in the device + * argument. The lifetime of the returned device pointer is limited until + * the next libinput_dispatch(), use libinput_device_ref() to keep a permanent + * reference. + * + * @param libinput A previously initialized libinput context + * @param path Path to an input device + * @return The newly initiated device on success, or NULL on failure. + * + * @note It is an application bug to call this function on a libinput + * context initialized with libinput_udev_create_context(). + */ +struct libinput_device * +libinput_path_add_device(struct libinput *libinput, + const char *path); + +/** + * @ingroup base + * + * Remove a device from a libinput context initialized with + * libinput_path_create_context() or added to such a context with + * libinput_path_add_device(). + * + * Events already processed from this input device are kept in the queue, + * the @ref LIBINPUT_EVENT_DEVICE_REMOVED event marks the end of events for + * this device. + * + * If no matching device exists, this function does nothing. + * + * @param device A libinput device + * + * @note It is an application bug to call this function on a libinput + * context initialized with libinput_udev_create_context(). + */ +void +libinput_path_remove_device(struct libinput_device *device); + +/** + * @ingroup base + * + * libinput keeps a single file descriptor for all events. Call into + * libinput_dispatch() if any events become available on this fd. + * + * @return The file descriptor used to notify of pending events. + */ +int +libinput_get_fd(struct libinput *libinput); + +/** + * @ingroup base + * + * Main event dispatchment function. Reads events of the file descriptors + * and processes them internally. Use libinput_get_event() to retrieve the + * events. + * + * Dispatching does not necessarily queue libinput events. This function + * should be called immediately once data is available on the file + * descriptor returned by libinput_get_fd(). libinput has a number of + * timing-sensitive features (e.g. tap-to-click), any delay in calling + * libinput_dispatch() may prevent these features from working correctly. + * + * @param libinput A previously initialized libinput context + * + * @return 0 on success, or a negative errno on failure + */ +int +libinput_dispatch(struct libinput *libinput); + +/** + * @ingroup base + * + * Retrieve the next event from libinput's internal event queue. + * + * After handling the retrieved event, the caller must destroy it using + * libinput_event_destroy(). + * + * @param libinput A previously initialized libinput context + * @return The next available event, or NULL if no event is available. + */ +struct libinput_event * +libinput_get_event(struct libinput *libinput); + +/** + * @ingroup base + * + * Return the type of the next event in the internal queue. This function + * does not pop the event off the queue and the next call to + * libinput_get_event() returns that event. + * + * @param libinput A previously initialized libinput context + * @return The event type of the next available event or @ref + * LIBINPUT_EVENT_NONE if no event is available. + */ +enum libinput_event_type +libinput_next_event_type(struct libinput *libinput); + +/** + * @ingroup base + * + * Set caller-specific data associated with this context. libinput does + * not manage, look at, or modify this data. The caller must ensure the + * data is valid. + * + * @param libinput A previously initialized libinput context + * @param user_data Caller-specific data passed to the various callback + * interfaces. + */ +void +libinput_set_user_data(struct libinput *libinput, + void *user_data); + +/** + * @ingroup base + * + * Get the caller-specific data associated with this context, if any. + * + * @param libinput A previously initialized libinput context + * @return The caller-specific data previously assigned in + * libinput_set_user_data(), libinput_path_create_context() or + * libinput_udev_create_context(). + */ +void * +libinput_get_user_data(struct libinput *libinput); + +/** + * @ingroup base + * + * Resume a suspended libinput context. This re-enables device + * monitoring and adds existing devices. + * + * @param libinput A previously initialized libinput context + * @see libinput_suspend + * + * @return 0 on success or -1 on failure + */ +int +libinput_resume(struct libinput *libinput); + +/** + * @ingroup base + * + * Suspend monitoring for new devices and close existing devices. + * This all but terminates libinput but does keep the context + * valid to be resumed with libinput_resume(). + * + * @param libinput A previously initialized libinput context + */ +void +libinput_suspend(struct libinput *libinput); + +/** + * @ingroup base + * + * Add a reference to the context. A context is destroyed whenever the + * reference count reaches 0. See @ref libinput_unref. + * + * @param libinput A previously initialized valid libinput context + * @return The passed libinput context + */ +struct libinput * +libinput_ref(struct libinput *libinput); + +/** + * @ingroup base + * + * Dereference the libinput context. After this, the context may have been + * destroyed, if the last reference was dereferenced. If so, the context is + * invalid and may not be interacted with. + * + * @bug When the refcount reaches zero, libinput_unref() releases resources + * even if a caller still holds refcounted references to related resources + * (e.g. a libinput_device). When libinput_unref() returns + * NULL, the caller must consider any resources related to that context + * invalid. See https://bugs.freedesktop.org/show_bug.cgi?id=91872. + * + * Example code: + * @code + * li = libinput_path_create_context(&interface, NULL); + * device = libinput_path_add_device(li, "/dev/input/event0"); + * // get extra reference to device + * libinput_device_ref(device); + * + * // refcount reaches 0, so *all* resources are cleaned up, + * // including device + * libinput_unref(li); + * + * // INCORRECT: device has been cleaned up and must not be used + * // li = libinput_device_get_context(device); + * @endcode + * + * @param libinput A previously initialized libinput context + * @return NULL if context was destroyed otherwise the passed context + */ +struct libinput * +libinput_unref(struct libinput *libinput); + +/** + * @ingroup base + * + * Set the log priority for the libinput context. Messages with priorities + * equal to or higher than the argument will be printed to the context's + * log handler. + * + * The default log priority is @ref LIBINPUT_LOG_PRIORITY_ERROR. + * + * @param libinput A previously initialized libinput context + * @param priority The minimum priority of log messages to print. + * + * @see libinput_log_set_handler + * @see libinput_log_get_priority + */ +void +libinput_log_set_priority(struct libinput *libinput, + enum libinput_log_priority priority); + +/** + * @ingroup base + * + * Get the context's log priority. Messages with priorities equal to or + * higher than the argument will be printed to the current log handler. + * + * The default log priority is @ref LIBINPUT_LOG_PRIORITY_ERROR. + * + * @param libinput A previously initialized libinput context + * @return The minimum priority of log messages to print. + * + * @see libinput_log_set_handler + * @see libinput_log_set_priority + */ +enum libinput_log_priority +libinput_log_get_priority(const struct libinput *libinput); + +/** + * @ingroup base + * + * Log handler type for custom logging. + * + * @param libinput The libinput context + * @param priority The priority of the current message + * @param format Message format in printf-style + * @param args Message arguments + * + * @see libinput_log_set_priority + * @see libinput_log_get_priority + * @see libinput_log_set_handler + */ +typedef void (*libinput_log_handler)(struct libinput *libinput, + enum libinput_log_priority priority, + const char *format, va_list args) + LIBINPUT_ATTRIBUTE_PRINTF(3, 0); + +/** + * @ingroup base + * + * Set the context's log handler. Messages with priorities equal to or + * higher than the context's log priority will be passed to the given + * log handler. + * + * The default log handler prints to stderr. + * + * @param libinput A previously initialized libinput context + * @param log_handler The log handler for library messages. + * + * @see libinput_log_set_priority + * @see libinput_log_get_priority + */ +void +libinput_log_set_handler(struct libinput *libinput, + libinput_log_handler log_handler); + +/** + * @defgroup seat Initialization and manipulation of seats + * + * A seat has two identifiers, the physical name and the logical name. A + * device is always assigned to exactly one seat. It may change to a + * different logical seat but it cannot change physical seats. + * + * See the libinput documentation for more information on seats. + */ + +/** + * @ingroup seat + * + * Increase the refcount of the seat. A seat will be freed whenever the + * refcount reaches 0. This may happen during libinput_dispatch() if the + * seat was removed from the system. A caller must ensure to reference + * the seat correctly to avoid dangling pointers. + * + * @param seat A previously obtained seat + * @return The passed seat + */ +struct libinput_seat * +libinput_seat_ref(struct libinput_seat *seat); + +/** + * @ingroup seat + * + * Decrease the refcount of the seat. A seat will be freed whenever the + * refcount reaches 0. This may happen during libinput_dispatch() if the + * seat was removed from the system. A caller must ensure to reference + * the seat correctly to avoid dangling pointers. + * + * @param seat A previously obtained seat + * @return NULL if seat was destroyed, otherwise the passed seat + */ +struct libinput_seat * +libinput_seat_unref(struct libinput_seat *seat); + +/** + * @ingroup seat + * + * Set caller-specific data associated with this seat. libinput does + * not manage, look at, or modify this data. The caller must ensure the + * data is valid. + * + * @param seat A previously obtained seat + * @param user_data Caller-specific data pointer + * @see libinput_seat_get_user_data + */ +void +libinput_seat_set_user_data(struct libinput_seat *seat, void *user_data); + +/** + * @ingroup seat + * + * Get the caller-specific data associated with this seat, if any. + * + * @param seat A previously obtained seat + * @return Caller-specific data pointer or NULL if none was set + * @see libinput_seat_set_user_data + */ +void * +libinput_seat_get_user_data(struct libinput_seat *seat); + +/** + * @ingroup seat + * + * Get the libinput context from the seat. + * + * @param seat A previously obtained seat + * @return The libinput context for this seat. + */ +struct libinput * +libinput_seat_get_context(struct libinput_seat *seat); + +/** + * @ingroup seat + * + * Return the physical name of the seat. For libinput contexts created from + * udev, this is always the same value as passed into + * libinput_udev_assign_seat() and all seats from that context will have + * the same physical name. + * + * The physical name of the seat is one that is usually set by the system or + * lower levels of the stack. In most cases, this is the base filter for + * devices - devices assigned to seats outside the current seat will not + * be available to the caller. + * + * @param seat A previously obtained seat + * @return The physical name of this seat + */ +const char * +libinput_seat_get_physical_name(struct libinput_seat *seat); + +/** + * @ingroup seat + * + * Return the logical name of the seat. This is an identifier to group sets + * of devices within the compositor. + * + * @param seat A previously obtained seat + * @return The logical name of this seat + */ +const char * +libinput_seat_get_logical_name(struct libinput_seat *seat); + +/** + * @defgroup device Initialization and manipulation of input devices + */ + +/** + * @ingroup device + * + * Increase the refcount of the input device. An input device will be freed + * whenever the refcount reaches 0. This may happen during + * libinput_dispatch() if the device was removed from the system. A caller + * must ensure to reference the device correctly to avoid dangling pointers. + * + * @param device A previously obtained device + * @return The passed device + */ +struct libinput_device * +libinput_device_ref(struct libinput_device *device); + +/** + * @ingroup device + * + * Decrease the refcount of the input device. An input device will be freed + * whenever the refcount reaches 0. This may happen during libinput_dispatch + * if the device was removed from the system. A caller must ensure to + * reference the device correctly to avoid dangling pointers. + * + * @param device A previously obtained device + * @return NULL if the device was destroyed, otherwise the passed device + */ +struct libinput_device * +libinput_device_unref(struct libinput_device *device); + +/** + * @ingroup device + * + * Set caller-specific data associated with this input device. libinput does + * not manage, look at, or modify this data. The caller must ensure the + * data is valid. + * + * @param device A previously obtained device + * @param user_data Caller-specific data pointer + * @see libinput_device_get_user_data + */ +void +libinput_device_set_user_data(struct libinput_device *device, void *user_data); + +/** + * @ingroup device + * + * Get the caller-specific data associated with this input device, if any. + * + * @param device A previously obtained device + * @return Caller-specific data pointer or NULL if none was set + * @see libinput_device_set_user_data + */ +void * +libinput_device_get_user_data(struct libinput_device *device); + +/** + * @ingroup device + * + * Get the libinput context from the device. + * + * @param device A previously obtained device + * @return The libinput context for this device. + */ +struct libinput * +libinput_device_get_context(struct libinput_device *device); + +/** + * @ingroup device + * + * Get the device group this device is assigned to. Some physical + * devices like graphics tablets are represented by multiple kernel + * devices and thus by multiple struct @ref libinput_device. + * + * libinput assigns these devices to the same @ref libinput_device_group + * allowing the caller to identify such devices and adjust configuration + * settings accordingly. For example, setting a tablet to left-handed often + * means turning it upside down. A touch device on the same tablet would + * need to be turned upside down too to work correctly. + * + * All devices are part of a device group though for most devices the group + * will be a singleton. A device is assigned to a device group on @ref + * LIBINPUT_EVENT_DEVICE_ADDED and removed from that group on @ref + * LIBINPUT_EVENT_DEVICE_REMOVED. It is up to the caller to track how many + * devices are in each device group. + * + * @dot + * digraph groups_libinput { + * rankdir="TB"; + * node [ + * shape="box"; + * ] + * + * mouse [ label="mouse"; URL="\ref libinput_device"]; + * kbd [ label="keyboard"; URL="\ref libinput_device"]; + * + * pen [ label="tablet pen"; URL="\ref libinput_device"]; + * touch [ label="tablet touch"; URL="\ref libinput_device"]; + * pad [ label="tablet pad"; URL="\ref libinput_device"]; + * + * group1 [ label="group 1"; URL="\ref libinput_device_group"]; + * group2 [ label="group 2"; URL="\ref libinput_device_group"]; + * group3 [ label="group 3"; URL="\ref libinput_device_group"]; + * + * mouse -> group1 + * kbd -> group2 + * + * pen -> group3; + * touch -> group3; + * pad -> group3; + * } + * @enddot + * + * Device groups do not get re-used once the last device in the group was + * removed, i.e. unplugging and re-plugging a physical device with grouped + * devices will return a different device group after every unplug. + * + * The returned device group is not refcounted and may become invalid after + * the next call to libinput. Use libinput_device_group_ref() and + * libinput_device_group_unref() to continue using the handle outside of the + * immediate scope. + * + * Device groups are assigned based on the LIBINPUT_DEVICE_GROUP udev + * property, see the libinput documentation for more details. + * + * @return The device group this device belongs to + */ +struct libinput_device_group * +libinput_device_get_device_group(struct libinput_device *device); + +/** + * @ingroup device + * + * Get the system name of the device. + * + * To get the descriptive device name, use libinput_device_get_name(). + * + * @param device A previously obtained device + * @return System name of the device + * + */ +const char * +libinput_device_get_sysname(struct libinput_device *device); + +/** + * @ingroup device + * + * The descriptive device name as advertised by the kernel and/or the + * hardware itself. To get the sysname for this device, use + * libinput_device_get_sysname(). + * + * The lifetime of the returned string is tied to the struct + * libinput_device. The string may be the empty string but is never NULL. + * + * @param device A previously obtained device + * @return The device name + */ +const char * +libinput_device_get_name(struct libinput_device *device); + +/** + * @ingroup device + * + * Get the product ID for this device. + * + * @param device A previously obtained device + * @return The product ID of this device + */ +unsigned int +libinput_device_get_id_product(struct libinput_device *device); + +/** + * @ingroup device + * + * Get the vendor ID for this device. + * + * @param device A previously obtained device + * @return The vendor ID of this device + */ +unsigned int +libinput_device_get_id_vendor(struct libinput_device *device); + +/** + * @ingroup device + * + * A device may be mapped to a single output, or all available outputs. If a + * device is mapped to a single output only, a relative device may not move + * beyond the boundaries of this output. An absolute device has its input + * coordinates mapped to the extents of this output. + * + * @note Use of this function is discouraged. Its return value is not + * precisely defined and may not be understood by the caller or may be + * insufficient to map the device. Instead, the system configuration could + * set a udev property the caller understands and interprets correctly. The + * caller could then obtain device with libinput_device_get_udev_device() + * and query it for this property. For more complex cases, the caller + * must implement monitor-to-device association heuristics. + * + * @return The name of the output this device is mapped to, or NULL if no + * output is set + */ +const char * +libinput_device_get_output_name(struct libinput_device *device); + +/** + * @ingroup device + * + * Get the seat associated with this input device. + * + * A seat can be uniquely identified by the physical and logical seat name. + * There will ever be only one seat instance with a given physical and logical + * seat name pair at any given time, but if no external reference is kept, it + * may be destroyed if no device belonging to it is left. + * + * The returned seat is not refcounted and may become invalid after + * the next call to libinput. Use libinput_seat_ref() and + * libinput_seat_unref() to continue using the handle outside of the + * immediate scope. + * + * See the libinput documentation for more information on seats. + * + * @param device A previously obtained device + * @return The seat this input device belongs to + */ +struct libinput_seat * +libinput_device_get_seat(struct libinput_device *device); + +/** + * @ingroup device + * + * Change the logical seat associated with this device by removing the + * device and adding it to the new seat. + * + * This command is identical to physically unplugging the device, then + * re-plugging it as a member of the new seat. libinput will generate a + * @ref LIBINPUT_EVENT_DEVICE_REMOVED event and this @ref libinput_device is + * considered removed from the context; it will not generate further events + * and will be freed when the refcount reaches zero. + * A @ref LIBINPUT_EVENT_DEVICE_ADDED event is generated with a new @ref + * libinput_device handle. It is the caller's responsibility to update + * references to the new device accordingly. + * + * If the logical seat name already exists in the device's physical seat, + * the device is added to this seat. Otherwise, a new seat is created. + * + * @note This change applies to this device until removal or @ref + * libinput_suspend(), whichever happens earlier. + * + * @param device A previously obtained device + * @param name The new logical seat name + * @return 0 on success, non-zero on error + */ +int +libinput_device_set_seat_logical_name(struct libinput_device *device, + const char *name); + +/** + * @ingroup device + * + * Return a udev handle to the device that is this libinput device, if any. + * The returned handle has a refcount of at least 1, the caller must call + * udev_device_unref() once to release the associated resources. + * See the [libudev documentation] + * (http://www.freedesktop.org/software/systemd/libudev/) for details. + * + * Some devices may not have a udev device, or the udev device may be + * unobtainable. This function returns NULL if no udev device was available. + * + * Calling this function multiple times for the same device may not + * return the same udev handle each time. + * + * @param device A previously obtained device + * @return A udev handle to the device with a refcount of >= 1 or NULL. + * @retval NULL This device is not represented by a udev device + */ +struct udev_device * +libinput_device_get_udev_device(struct libinput_device *device); + +/** + * @ingroup device + * + * Update the LEDs on the device, if any. If the device does not have + * LEDs, or does not have one or more of the LEDs given in the mask, this + * function does nothing. + * + * @param device A previously obtained device + * @param leds A mask of the LEDs to set, or unset. + */ +void +libinput_device_led_update(struct libinput_device *device, + enum libinput_led leds); + +/** + * @ingroup device + * + * Check if the given device has the specified capability + * + * @return Non-zero if the given device has the capability or zero otherwise + */ +int +libinput_device_has_capability(struct libinput_device *device, + enum libinput_device_capability capability); + +/** + * @ingroup device + * + * Get the physical size of a device in mm, where meaningful. This function + * only succeeds on devices with the required data, i.e. tablets, touchpads + * and touchscreens. + * + * If this function returns nonzero, width and height are unmodified. + * + * @param device The device + * @param width Set to the width of the device + * @param height Set to the height of the device + * @return 0 on success, or nonzero otherwise + */ +int +libinput_device_get_size(struct libinput_device *device, + double *width, + double *height); + +/** + * @ingroup device + * + * Check if a @ref LIBINPUT_DEVICE_CAP_POINTER device has a button with the + * given code (see linux/input-event-codes.h). + * + * @param device A current input device + * @param code Button code to check for, e.g. BTN_LEFT + * + * @return 1 if the device supports this button code, 0 if it does not, -1 + * on error. + */ +int +libinput_device_pointer_has_button(struct libinput_device *device, uint32_t code); + +/** + * @ingroup device + * + * Check if a @ref LIBINPUT_DEVICE_CAP_KEYBOARD device has a key with the + * given code (see linux/input-event-codes.h). + * + * @param device A current input device + * @param code Key code to check for, e.g. KEY_ESC + * + * @return 1 if the device supports this key code, 0 if it does not, -1 + * on error. + */ +int +libinput_device_keyboard_has_key(struct libinput_device *device, + uint32_t code); + +/** + * @ingroup device + * + * Check how many touches a @ref LIBINPUT_DEVICE_CAP_TOUCH device supports + * simultaneously. + * + * @param device A current input device + * + * @return The number of simultaneous touches or 0 if unknown, -1 + * on error. + * + * @since 1.11 + */ +int +libinput_device_touch_get_touch_count(struct libinput_device *device); + +/** + * @ingroup device + * + * Check if a @ref LIBINPUT_DEVICE_CAP_SWITCH device has a switch of the + * given type. + * + * @param device A current input device + * @param sw Switch to check for + * + * @return 1 if the device supports this switch, 0 if it does not, -1 + * on error. + * + * @since 1.9 + */ +int +libinput_device_switch_has_switch(struct libinput_device *device, + enum libinput_switch sw); + +/** + * @ingroup device + * + * Return the number of buttons on a device with the + * @ref LIBINPUT_DEVICE_CAP_TABLET_PAD capability. + * Buttons on a pad device are numbered sequentially, see the + * libinput documentation for details. + * + * @param device A current input device + * + * @return The number of buttons supported by the device. + * + * @since 1.3 + */ +int +libinput_device_tablet_pad_get_num_buttons(struct libinput_device *device); + +/** + * @ingroup device + * + * Return the number of rings a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides. + * + * @param device A current input device + * + * @return The number of rings or 0 if the device has no rings. + * + * @see libinput_event_tablet_pad_get_ring_number + * + * @since 1.3 + */ +int +libinput_device_tablet_pad_get_num_rings(struct libinput_device *device); + +/** + * @ingroup device + * + * Return the number of strips a device with the @ref + * LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides. + * + * @param device A current input device + * + * @return The number of strips or 0 if the device has no strips. + * + * @see libinput_event_tablet_pad_get_strip_number + * + * @since 1.3 + */ +int +libinput_device_tablet_pad_get_num_strips(struct libinput_device *device); + +/** + * @ingroup device + * + * Check if a @ref LIBINPUT_DEVICE_CAP_TABLET_PAD device has a key with the + * given code (see linux/input-event-codes.h). + * + * @param device A current input device + * @param code Key code to check for, e.g. KEY_ESC + * + * @return 1 if the device supports this key code, 0 if it does not, -1 + * on error. + * + * @since 1.15 + */ +int +libinput_device_tablet_pad_has_key(struct libinput_device *device, + uint32_t code); + +/** + * @ingroup device + * + * Increase the refcount of the device group. A device group will be freed + * whenever the refcount reaches 0. This may happen during + * libinput_dispatch() if all devices of this group were removed from the + * system. A caller must ensure to reference the device group correctly to + * avoid dangling pointers. + * + * @param group A previously obtained device group + * @return The passed device group + */ +struct libinput_device_group * +libinput_device_group_ref(struct libinput_device_group *group); + +/** + * @ingroup device + * + * Decrease the refcount of the device group. A device group will be freed + * whenever the refcount reaches 0. This may happen during + * libinput_dispatch() if all devices of this group were removed from the + * system. A caller must ensure to reference the device group correctly to + * avoid dangling pointers. + * + * @param group A previously obtained device group + * @return NULL if the device group was destroyed, otherwise the passed + * device group + */ +struct libinput_device_group * +libinput_device_group_unref(struct libinput_device_group *group); + +/** + * @ingroup device + * + * Set caller-specific data associated with this device group. libinput does + * not manage, look at, or modify this data. The caller must ensure the + * data is valid. + * + * @param group A previously obtained device group + * @param user_data Caller-specific data pointer + * @see libinput_device_group_get_user_data + */ +void +libinput_device_group_set_user_data(struct libinput_device_group *group, + void *user_data); + +/** + * @ingroup device + * + * Get the caller-specific data associated with this input device group, if + * any. + * + * @param group A previously obtained group + * @return Caller-specific data pointer or NULL if none was set + * @see libinput_device_group_set_user_data + */ +void * +libinput_device_group_get_user_data(struct libinput_device_group *group); + +/** + * @defgroup config Device configuration + * + * Enable, disable, change and/or check for device-specific features. For + * all features, libinput assigns a default based on the hardware + * configuration. This default can be obtained with the respective + * get_default call. + * + * Configuration options are device dependent and not all options are + * supported on all devices. For all configuration options, libinput + * provides a call to check if a configuration option is available on a + * device (e.g. libinput_device_config_calibration_has_matrix()) + * + * Some configuration option may be dependent on or mutually exclusive with + * with other options. The behavior in those cases is + * implementation-dependent, the caller must ensure that the options are set + * in the right order. + * + * Below is a general grouping of configuration options according to device + * type. Note that this is a guide only and not indicative of any specific + * device. + * - Touchpad: + * - libinput_device_config_tap_set_enabled() + * - libinput_device_config_tap_set_drag_enabled() + * - libinput_device_config_tap_set_drag_lock_enabled() + * - libinput_device_config_click_set_method() + * - libinput_device_config_scroll_set_method() + * - libinput_device_config_dwt_set_enabled() + * - Touchscreens: + * - libinput_device_config_calibration_set_matrix() + * - Pointer devices (mice, trackballs, touchpads): + * - libinput_device_config_accel_set_speed() + * - libinput_device_config_accel_set_profile() + * - libinput_device_config_scroll_set_natural_scroll_enabled() + * - libinput_device_config_left_handed_set() + * - libinput_device_config_middle_emulation_set_enabled() + * - libinput_device_config_rotation_set_angle() + * - All devices: + * - libinput_device_config_send_events_set_mode() + */ + +/** + * @ingroup config + * + * Status codes returned when applying configuration settings. + */ +enum libinput_config_status { + LIBINPUT_CONFIG_STATUS_SUCCESS = 0, /**< Config applied successfully */ + LIBINPUT_CONFIG_STATUS_UNSUPPORTED, /**< Configuration not available on + this device */ + LIBINPUT_CONFIG_STATUS_INVALID, /**< Invalid parameter range */ +}; + +/** + * @ingroup config + * + * Return a string describing the error. + * + * @param status The status to translate to a string + * @return A human-readable string representing the error or NULL for an + * invalid status. + */ +const char * +libinput_config_status_to_str(enum libinput_config_status status); + +/** + * @ingroup config + */ +enum libinput_config_tap_state { + LIBINPUT_CONFIG_TAP_DISABLED, /**< Tapping is to be disabled, or is + currently disabled */ + LIBINPUT_CONFIG_TAP_ENABLED, /**< Tapping is to be enabled, or is + currently enabled */ +}; + +/** + * @ingroup config + * + * Check if the device supports tap-to-click and how many fingers can be + * used for tapping. See + * libinput_device_config_tap_set_enabled() for more information. + * + * @param device The device to configure + * @return The number of fingers that can generate a tap event, or 0 if the + * device does not support tapping. + * + * @see libinput_device_config_tap_set_enabled + * @see libinput_device_config_tap_get_enabled + * @see libinput_device_config_tap_get_default_enabled + */ +int +libinput_device_config_tap_get_finger_count(struct libinput_device *device); + +/** + * @ingroup config + * + * Enable or disable tap-to-click on this device, with a default mapping of + * 1, 2, 3 finger tap mapping to left, right, middle click, respectively. + * Tapping is limited by the number of simultaneous touches + * supported by the device, see + * libinput_device_config_tap_get_finger_count(). + * + * @param device The device to configure + * @param enable @ref LIBINPUT_CONFIG_TAP_ENABLED to enable tapping or @ref + * LIBINPUT_CONFIG_TAP_DISABLED to disable tapping + * + * @return A config status code. Disabling tapping on a device that does not + * support tapping always succeeds. + * + * @see libinput_device_config_tap_get_finger_count + * @see libinput_device_config_tap_get_enabled + * @see libinput_device_config_tap_get_default_enabled + */ +enum libinput_config_status +libinput_device_config_tap_set_enabled(struct libinput_device *device, + enum libinput_config_tap_state enable); + +/** + * @ingroup config + * + * Check if tap-to-click is enabled on this device. If the device does not + * support tapping, this function always returns @ref + * LIBINPUT_CONFIG_TAP_DISABLED. + * + * @param device The device to configure + * + * @retval LIBINPUT_CONFIG_TAP_ENABLED If tapping is currently enabled + * @retval LIBINPUT_CONFIG_TAP_DISABLED If tapping is currently disabled + * + * @see libinput_device_config_tap_get_finger_count + * @see libinput_device_config_tap_set_enabled + * @see libinput_device_config_tap_get_default_enabled + */ +enum libinput_config_tap_state +libinput_device_config_tap_get_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Return the default setting for whether tap-to-click is enabled on this + * device. + * + * @param device The device to configure + * @retval LIBINPUT_CONFIG_TAP_ENABLED If tapping is enabled by default + * @retval LIBINPUT_CONFIG_TAP_DISABLED If tapping Is disabled by default + * + * @see libinput_device_config_tap_get_finger_count + * @see libinput_device_config_tap_set_enabled + * @see libinput_device_config_tap_get_enabled + */ +enum libinput_config_tap_state +libinput_device_config_tap_get_default_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * @since 1.5 + */ +enum libinput_config_tap_button_map { + /** 1/2/3 finger tap maps to left/right/middle */ + LIBINPUT_CONFIG_TAP_MAP_LRM, + /** 1/2/3 finger tap maps to left/middle/right*/ + LIBINPUT_CONFIG_TAP_MAP_LMR, +}; + +/** + * @ingroup config + * + * Set the finger number to button number mapping for tap-to-click. The + * default mapping on most devices is to have a 1, 2 and 3 finger tap to map + * to the left, right and middle button, respectively. + * A device may permit changing the button mapping but disallow specific + * maps. In this case @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED is returned, + * the caller is expected to handle this case correctly. + * + * Changing the button mapping may not take effect immediately, + * the device may wait until it is in a neutral state before applying any + * changes. + * + * The mapping may be changed when tap-to-click is disabled. The new mapping + * takes effect when tap-to-click is enabled in the future. + * + * @note It is an application bug to call this function for devices where + * libinput_device_config_tap_get_finger_count() returns 0. + * + * @param device The device to configure + * @param map The new finger-to-button number mapping + * @return A config status code. Changing the order on a device that does not + * support tapping always fails with @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED. + * + * @see libinput_device_config_tap_get_button_map + * @see libinput_device_config_tap_get_default_button_map + * + * @since 1.5 + */ +enum libinput_config_status +libinput_device_config_tap_set_button_map(struct libinput_device *device, + enum libinput_config_tap_button_map map); + +/** + * @ingroup config + * + * Get the finger number to button number mapping for tap-to-click. + * + * The return value for a device that does not support tapping is always + * @ref LIBINPUT_CONFIG_TAP_MAP_LRM. + * + * @note It is an application bug to call this function for devices where + * libinput_device_config_tap_get_finger_count() returns 0. + * + * @param device The device to configure + * @return The current finger-to-button number mapping + * + * @see libinput_device_config_tap_set_button_map + * @see libinput_device_config_tap_get_default_button_map + * + * @since 1.5 + */ +enum libinput_config_tap_button_map +libinput_device_config_tap_get_button_map(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default finger number to button number mapping for tap-to-click. + * + * The return value for a device that does not support tapping is always + * @ref LIBINPUT_CONFIG_TAP_MAP_LRM. + * + * @note It is an application bug to call this function for devices where + * libinput_device_config_tap_get_finger_count() returns 0. + * + * @param device The device to configure + * @return The current finger-to-button number mapping + * + * @see libinput_device_config_tap_set_button_map + * @see libinput_device_config_tap_get_default_button_map + * + * @since 1.5 + */ +enum libinput_config_tap_button_map +libinput_device_config_tap_get_default_button_map(struct libinput_device *device); + +/** + * @ingroup config + * + * A config status to distinguish or set dragging on a device. Currently + * implemented for tap-and-drag only, see + * libinput_device_config_tap_set_drag_enabled() + * + * @since 1.2 + */ +enum libinput_config_drag_state { + /** + * Drag is to be disabled, or is + * currently disabled. + */ + LIBINPUT_CONFIG_DRAG_DISABLED, + /** + * Drag is to be enabled, or is + * currently enabled + */ + LIBINPUT_CONFIG_DRAG_ENABLED, +}; + +/** + * @ingroup config + * + * Enable or disable tap-and-drag on this device. When enabled, a + * tap immediately followed by a finger down results in a button down event, + * subsequent finger motion thus triggers a drag. The button is released + * on finger up. See the libinput documentation for more details. + * + * @param device The device to configure + * @param enable @ref LIBINPUT_CONFIG_DRAG_ENABLED to enable, @ref + * LIBINPUT_CONFIG_DRAG_DISABLED to disable tap-and-drag + * + * @see libinput_device_config_tap_drag_get_enabled + * @see libinput_device_config_tap_drag_get_default_enabled + * + * @since 1.2 + */ +enum libinput_config_status +libinput_device_config_tap_set_drag_enabled(struct libinput_device *device, + enum libinput_config_drag_state enable); + +/** + * @ingroup config + * + * Return whether tap-and-drag is enabled or disabled on this device. + * + * @param device The device to check + * @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled + * @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is + * disabled + * + * @see libinput_device_config_tap_drag_set_enabled + * @see libinput_device_config_tap_drag_get_default_enabled + * + * @since 1.2 + */ +enum libinput_config_drag_state +libinput_device_config_tap_get_drag_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Return whether tap-and-drag is enabled or disabled by default on this + * device. + * + * @param device The device to check + * @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled by + * default + * @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is + * disabled by default + * + * @see libinput_device_config_tap_drag_set_enabled + * @see libinput_device_config_tap_drag_get_enabled + * + * @since 1.2 + */ +enum libinput_config_drag_state +libinput_device_config_tap_get_default_drag_enabled(struct libinput_device *device); + +/** + * @ingroup config + */ +enum libinput_config_drag_lock_state { + /** Drag lock is to be disabled, or is currently disabled */ + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED, + /** Drag lock is to be enabled, or is currently disabled */ + LIBINPUT_CONFIG_DRAG_LOCK_ENABLED, +}; + +/** + * @ingroup config + * + * Enable or disable drag-lock during tapping on this device. When enabled, + * a finger may be lifted and put back on the touchpad within a timeout and + * the drag process continues. When disabled, lifting the finger during a + * tap-and-drag will immediately stop the drag. See the libinput + * documentation for more details. + * + * Enabling drag lock on a device that has tapping disabled is permitted, + * but has no effect until tapping is enabled. + * + * @param device The device to configure + * @param enable @ref LIBINPUT_CONFIG_DRAG_LOCK_ENABLED to enable drag lock + * or @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED to disable drag lock + * + * @return A config status code. Disabling drag lock on a device that does not + * support tapping always succeeds. + * + * @see libinput_device_config_tap_get_drag_lock_enabled + * @see libinput_device_config_tap_get_default_drag_lock_enabled + */ +enum libinput_config_status +libinput_device_config_tap_set_drag_lock_enabled(struct libinput_device *device, + enum libinput_config_drag_lock_state enable); + +/** + * @ingroup config + * + * Check if drag-lock during tapping is enabled on this device. If the + * device does not support tapping, this function always returns + * @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED. + * + * Drag lock may be enabled even when tapping is disabled. + * + * @param device The device to configure + * + * @retval LIBINPUT_CONFIG_DRAG_LOCK_ENABLED If drag lock is currently enabled + * @retval LIBINPUT_CONFIG_DRAG_LOCK_DISABLED If drag lock is currently disabled + * + * @see libinput_device_config_tap_set_drag_lock_enabled + * @see libinput_device_config_tap_get_default_drag_lock_enabled + */ +enum libinput_config_drag_lock_state +libinput_device_config_tap_get_drag_lock_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Check if drag-lock during tapping is enabled by default on this device. + * If the device does not support tapping, this function always returns + * @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED. + * + * Drag lock may be enabled by default even when tapping is disabled by + * default. + * + * @param device The device to configure + * + * @retval LIBINPUT_CONFIG_DRAG_LOCK_ENABLED If drag lock is enabled by + * default + * @retval LIBINPUT_CONFIG_DRAG_LOCK_DISABLED If drag lock is disabled by + * default + * + * @see libinput_device_config_tap_set_drag_lock_enabled + * @see libinput_device_config_tap_get_drag_lock_enabled + */ +enum libinput_config_drag_lock_state +libinput_device_config_tap_get_default_drag_lock_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Check if the device can be calibrated via a calibration matrix. + * + * @param device The device to check + * @return Non-zero if the device can be calibrated, zero otherwise. + * + * @see libinput_device_config_calibration_set_matrix + * @see libinput_device_config_calibration_get_matrix + * @see libinput_device_config_calibration_get_default_matrix + */ +int +libinput_device_config_calibration_has_matrix(struct libinput_device *device); + +/** + * @ingroup config + * + * Apply the 3x3 transformation matrix to absolute device coordinates. This + * matrix has no effect on relative events. + * + * Given a 6-element array [a, b, c, d, e, f], the matrix is applied as + * @code + * [ a b c ] [ x ] + * [ d e f ] * [ y ] + * [ 0 0 1 ] [ 1 ] + * @endcode + * + * The translation component (c, f) is expected to be normalized to the + * device coordinate range. For example, the matrix + * @code + * [ 1 0 1 ] + * [ 0 1 -1 ] + * [ 0 0 1 ] + * @endcode + * moves all coordinates by 1 device-width to the right and 1 device-height + * up. + * + * The rotation matrix for rotation around the origin is defined as + * @code + * [ cos(a) -sin(a) 0 ] + * [ sin(a) cos(a) 0 ] + * [ 0 0 1 ] + * @endcode + * Note that any rotation requires an additional translation component to + * translate the rotated coordinates back into the original device space. + * The rotation matrixes for 90, 180 and 270 degrees clockwise are: + * @code + * 90 deg cw: 180 deg cw: 270 deg cw: + * [ 0 -1 1] [ -1 0 1] [ 0 1 0 ] + * [ 1 0 0] [ 0 -1 1] [ -1 0 1 ] + * [ 0 0 1] [ 0 0 1] [ 0 0 1 ] + * @endcode + * + * @param device The device to configure + * @param matrix An array representing the first two rows of a 3x3 matrix as + * described above. + * + * @return A config status code. + * + * @see libinput_device_config_calibration_has_matrix + * @see libinput_device_config_calibration_get_matrix + * @see libinput_device_config_calibration_get_default_matrix + */ +enum libinput_config_status +libinput_device_config_calibration_set_matrix(struct libinput_device *device, + const float matrix[6]); + +/** + * @ingroup config + * + * Return the current calibration matrix for this device. + * + * @param device The device to configure + * @param matrix Set to the array representing the first two rows of a 3x3 matrix as + * described in libinput_device_config_calibration_set_matrix(). + * + * @return 0 if no calibration is set and the returned matrix is the + * identity matrix, 1 otherwise + * + * @see libinput_device_config_calibration_has_matrix + * @see libinput_device_config_calibration_set_matrix + * @see libinput_device_config_calibration_get_default_matrix + */ +int +libinput_device_config_calibration_get_matrix(struct libinput_device *device, + float matrix[6]); + +/** + * @ingroup config + * + * Return the default calibration matrix for this device. On most devices, + * this is the identity matrix. If the udev property + * LIBINPUT_CALIBRATION_MATRIX is set on the respective udev device, + * that property's value becomes the default matrix, see the libinput + * documentation for more details. + * + * @param device The device to configure + * @param matrix Set to the array representing the first two rows of a 3x3 matrix as + * described in libinput_device_config_calibration_set_matrix(). + * + * @return 0 if no calibration is set and the returned matrix is the + * identity matrix, 1 otherwise + * + * @see libinput_device_config_calibration_has_matrix + * @see libinput_device_config_calibration_set_matrix + * @see libinput_device_config_calibration_get_matrix + */ +int +libinput_device_config_calibration_get_default_matrix(struct libinput_device *device, + float matrix[6]); + +/** + * @ingroup config + * + * The send-event mode of a device defines when a device may generate events + * and pass those events to the caller. + */ +enum libinput_config_send_events_mode { + /** + * Send events from this device normally. This is a placeholder + * mode only, any device detected by libinput can be enabled. Do not + * test for this value as bitmask. + */ + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED = 0, + /** + * Do not send events through this device. Depending on the device, + * this may close all file descriptors on the device or it may leave + * the file descriptors open and route events through a different + * device. + * + * If this bit field is set, other disable modes may be + * ignored. For example, if both @ref + * LIBINPUT_CONFIG_SEND_EVENTS_DISABLED and @ref + * LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE are set, + * the device remains disabled when all external pointer devices are + * unplugged. + */ + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED = (1 << 0), + /** + * If an external pointer device is plugged in, do not send events + * from this device. This option may be available on built-in + * touchpads. + */ + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE = (1 << 1), +}; + +/** + * @ingroup config + * + * Return the possible send-event modes for this device. These modes define + * when a device may process and send events. + * + * @param device The device to configure + * + * @return A bitmask of possible modes. + * + * @see libinput_device_config_send_events_set_mode + * @see libinput_device_config_send_events_get_mode + * @see libinput_device_config_send_events_get_default_mode + */ +uint32_t +libinput_device_config_send_events_get_modes(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the send-event mode for this device. The mode defines when the device + * processes and sends events to the caller. + * + * The selected mode may not take effect immediately. Events already + * received and processed from this device are unaffected and will be passed + * to the caller on the next call to libinput_get_event(). + * + * If the mode is a bitmask of @ref libinput_config_send_events_mode, + * the device may wait for or generate events until it is in a neutral + * state. For example, this may include waiting for or generating button + * release events. + * + * If the device is already suspended, this function does nothing and + * returns success. Changing the send-event mode on a device that has been + * removed is permitted. + * + * @param device The device to configure + * @param mode A bitmask of send-events modes + * + * @return A config status code. + * + * @see libinput_device_config_send_events_get_modes + * @see libinput_device_config_send_events_get_mode + * @see libinput_device_config_send_events_get_default_mode + */ +enum libinput_config_status +libinput_device_config_send_events_set_mode(struct libinput_device *device, + uint32_t mode); + +/** + * @ingroup config + * + * Get the send-event mode for this device. The mode defines when the device + * processes and sends events to the caller. + * + * If a caller enables the bits for multiple modes, some of which are + * subsets of another mode libinput may drop the bits that are subsets. In + * other words, don't expect libinput_device_config_send_events_get_mode() + * to always return exactly the same bitmask as passed into + * libinput_device_config_send_events_set_mode(). + * + * @param device The device to configure + * @return The current bitmask of the send-event mode for this device. + * + * @see libinput_device_config_send_events_get_modes + * @see libinput_device_config_send_events_set_mode + * @see libinput_device_config_send_events_get_default_mode + */ +uint32_t +libinput_device_config_send_events_get_mode(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default send-event mode for this device. The mode defines when + * the device processes and sends events to the caller. + * + * @param device The device to configure + * @return The bitmask of the send-event mode for this device. + * + * @see libinput_device_config_send_events_get_modes + * @see libinput_device_config_send_events_set_mode + * @see libinput_device_config_send_events_get_mode + */ +uint32_t +libinput_device_config_send_events_get_default_mode(struct libinput_device *device); + +/** + * @ingroup config + * + * Check if a device uses libinput-internal pointer-acceleration. + * + * @param device The device to configure + * + * @return 0 if the device is not accelerated, nonzero if it is accelerated + * + * @see libinput_device_config_accel_set_speed + * @see libinput_device_config_accel_get_speed + * @see libinput_device_config_accel_get_default_speed + */ +int +libinput_device_config_accel_is_available(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the pointer acceleration speed of this pointer device within a range + * of [-1, 1], where 0 is the default acceleration for this device, -1 is + * the slowest acceleration and 1 is the maximum acceleration available on + * this device. The actual pointer acceleration mechanism is + * implementation-dependent, as is the number of steps available within the + * range. libinput picks the semantically closest acceleration step if the + * requested value does not match a discrete setting. + * + * @param device The device to configure + * @param speed The normalized speed, in a range of [-1, 1] + * + * @return A config status code + * + * @see libinput_device_config_accel_is_available + * @see libinput_device_config_accel_get_speed + * @see libinput_device_config_accel_get_default_speed + */ +enum libinput_config_status +libinput_device_config_accel_set_speed(struct libinput_device *device, + double speed); + +/** + * @ingroup config + * + * Get the current pointer acceleration setting for this pointer device. The + * returned value is normalized to a range of [-1, 1]. + * See libinput_device_config_accel_set_speed() for details. + * + * If the current acceleration profile is @ref + * LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM, the behavior of the + * device will not change but future calls to + * libinput_device_config_accel_get_speed() will reflect the updated speed + * setting. + * + * @param device The device to configure + * + * @return The current speed, range -1 to 1 + * + * @see libinput_device_config_accel_is_available + * @see libinput_device_config_accel_set_speed + * @see libinput_device_config_accel_get_default_speed + */ +double +libinput_device_config_accel_get_speed(struct libinput_device *device); + +/** + * @ingroup config + * + * Return the default speed setting for this device, normalized to a range + * of [-1, 1]. + * See libinput_device_config_accel_set_speed() for details. + * + * @param device The device to configure + * @return The default speed setting for this device. + * + * @see libinput_device_config_accel_is_available + * @see libinput_device_config_accel_set_speed + * @see libinput_device_config_accel_get_speed + */ +double +libinput_device_config_accel_get_default_speed(struct libinput_device *device); + +/** + * @ingroup config + * + * @since 1.1 + */ +enum libinput_config_accel_profile { + /** + * Placeholder for devices that don't have a configurable pointer + * acceleration profile. + */ + LIBINPUT_CONFIG_ACCEL_PROFILE_NONE = 0, + /** + * A flat acceleration profile. Pointer motion is accelerated by a + * constant (device-specific) factor, depending on the current + * speed. + * + * @see libinput_device_config_accel_set_speed + */ + LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT = (1 << 0), + + /** + * An adaptive acceleration profile. Pointer acceleration depends + * on the input speed. This is the default profile for most devices. + */ + LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE = (1 << 1), + + /** + * A custom acceleration profile. Device movement acceleration depends + * on user defined custom acceleration functions for each movement + * type. + * + * @see libinput_device_config_accel_set_points + */ + LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM = (1 << 2), +}; + +/** + * @ingroup config + * + * A handle for configuration pointer acceleration. + * + * @warning Unlike other structs pointer acceleration configuration is + * considered transient and not refcounted. Calling + * libinput_config_accel_destroy() will destroy the configuration. + * + * To configure pointer acceleration, first create a config of a desired + * acceleration profile with libinput_config_accel_create(), then + * configure the profile-specific acceleration properties. + * + * In this version of libinput, this pointer acceleration configuration + * only provides configuration for @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM. + * + * For @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM use + * @ref libinput_config_accel_set_points. + * + * Once set up, apply the configuration to a device using + * libinput_device_config_accel_apply(). Once applied, + * destroy it with libinput_config_accel_destroy(). + * + * @since 1.23 + */ +struct libinput_config_accel; + +/** + * @ingroup config + * + * Create an acceleration configuration of a given profile. + * + * Note that in this version of libinput, only the + * @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM profile provides configuration + * options. All other acceleration profiles, when applied, will merely switch + * the profile and reset any profile-specific options to the default values. + * + * @param profile The profile of the newly created acceleration configuration. + * + * @return The newly created acceleration configuration or NULL on error. + * + * @warning Unlike other structs pointer acceleration configuration is + * considered transient and not refcounted. Calling + * libinput_config_accel_destroy() will destroy the configuration. + * + * @see libinput_config_accel + * @since 1.23 + */ +struct libinput_config_accel * +libinput_config_accel_create(enum libinput_config_accel_profile profile); + +/** + * @ingroup config + * + * Destroy an acceleration configuration. + * + * @warning Unlike other structs pointer acceleration configuration is + * considered transient and not refcounted. Calling + * libinput_config_accel_destroy() will destroy the configuration. + * + * @param accel_config The acceleration configuration to destroy. + * + * @see libinput_config_accel + * @since 1.23 + */ +void +libinput_config_accel_destroy(struct libinput_config_accel *accel_config); + +/** + * @ingroup config + * + * Apply this pointer acceleration configuration to the device. This changes the + * device's pointer acceleration method to the method given in + * libinput_config_accel_create() and applies all other configuration settings. + * + * Once applied, call libinput_config_accel_destroy() to destroy the + * configuration struct. + * + * @param device The device to configure. + * @param accel_config The acceleration configuration. + * + * @return A config status code. + * + * @see libinput_config_accel + * @since 1.23 + */ +enum libinput_config_status +libinput_device_config_accel_apply(struct libinput_device *device, + struct libinput_config_accel *accel_config); + +/** + * @ingroup config + * + * Acceleration types are categories of movement by a device that may have + * specific acceleration functions applied. A device always supports the + * @ref LIBINPUT_ACCEL_TYPE_MOTION type (for regular pointer motion). Other + * types (e.g. scrolling) may be added in the future. + * + * The special type @ref LIBINPUT_ACCEL_TYPE_FALLBACK specifies the acceleration + * function to be moved for any movement produced by the device that does not + * have a specific acceleration type defined. + * + * Use to specify the acceleration function type in + * @ref libinput_config_accel_set_points + * + * Each device implements a subset of those types, see a list of supported + * devices for each movement type definition. + * + * @see LIBINPUT_ACCEL_ARG_TYPE + * @since 1.23 + */ +enum libinput_config_accel_type { + /** + * The default acceleration type used as a fallback when other + * acceleration types are not provided. + */ + LIBINPUT_ACCEL_TYPE_FALLBACK = 0, + /** + * Acceleration type for regular pointer movement. This + * type is always supported. + */ + LIBINPUT_ACCEL_TYPE_MOTION, + /** + * Acceleration type for scroll movement. + * This type is supported by mouse and touchpad. + */ + LIBINPUT_ACCEL_TYPE_SCROLL, +}; + +/** + * @ingroup config + * + * Defines the acceleration function for a given movement type + * in an acceleration configuration with the profile + * @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM. + * + * Movement types are specific to each device, @see libinput_config_accel_type. + * + * Each custom acceleration function is defined by ``n`` points spaced uniformly + * along the x-axis starting from 0 and continuing in a constant step size. + * There by the function is defined by the following points: + * (0 * step, f[0]), (1 * step, f[1]), ..., ((n - 1) * step, f[n - 1]). + * The x-axis represents the device-speed in device units per millisecond. + * The y-axis represents the pointer-speed. + * + * It is up to the user to define those values in accordance with device DPI + * and screen DPI. + * + * @param accel_config The acceleration configuration to modify. + * @param accel_type The movement type to configure a custom function for. + * @param step The distance between each point along the x-axis. + * @param npoints The number of points of the custom acceleration function. + * @param points The points' y-values of the custom acceleration function. + * + * @return A config status code. + * + * @see libinput_config_accel + * @since 1.23 + */ +enum libinput_config_status +libinput_config_accel_set_points(struct libinput_config_accel *accel_config, + enum libinput_config_accel_type accel_type, + double step, size_t npoints, double *points); + +/** + * @ingroup config + * + * Returns a bitmask of the configurable acceleration modes available on + * this device. + * + * @param device The device to configure + * + * @return A bitmask of all configurable modes available on this device. + * + * @since 1.1 + */ +uint32_t +libinput_device_config_accel_get_profiles(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the pointer acceleration profile of this pointer device to the given + * mode. + * + * @param device The device to configure + * @param profile The profile to set the device to. + * + * @return A config status code + * + * @since 1.1 + */ +enum libinput_config_status +libinput_device_config_accel_set_profile(struct libinput_device *device, + enum libinput_config_accel_profile profile); + +/** + * @ingroup config + * + * Get the current pointer acceleration profile for this pointer device. + * + * @param device The device to configure + * + * @return The currently configured pointer acceleration profile. + * + * @since 1.1 + */ +enum libinput_config_accel_profile +libinput_device_config_accel_get_profile(struct libinput_device *device); + +/** + * @ingroup config + * + * Return the default pointer acceleration profile for this pointer device. + * + * @param device The device to configure + * + * @return The default acceleration profile for this device. + * + * @since 1.1 + */ +enum libinput_config_accel_profile +libinput_device_config_accel_get_default_profile(struct libinput_device *device); + +/** + * @ingroup config + * + * Return non-zero if the device supports "natural scrolling". + * + * In traditional scroll mode, the movement of fingers on a touchpad when + * scrolling matches the movement of the scroll bars. When the fingers move + * down, the scroll bar moves down, a line of text on the screen moves + * towards the upper end of the screen. This also matches scroll wheels on + * mice (wheel down, content moves up). + * + * Natural scrolling is the term coined by Apple for inverted scrolling. + * In this mode, the effect of scrolling movement of fingers on a touchpad + * resemble physical manipulation of paper. When the fingers move down, a + * line of text on the screen moves down (scrollbars move up). This is the + * opposite of scroll wheels on mice. + * + * A device supporting natural scrolling can be switched between traditional + * scroll mode and natural scroll mode. + * + * @param device The device to configure + * + * @return Zero if natural scrolling is not supported, non-zero if natural + * scrolling is supported by this device + * + * @see libinput_device_config_scroll_set_natural_scroll_enabled + * @see libinput_device_config_scroll_get_natural_scroll_enabled + * @see libinput_device_config_scroll_get_default_natural_scroll_enabled + */ +int +libinput_device_config_scroll_has_natural_scroll(struct libinput_device *device); + +/** + * @ingroup config + * + * Enable or disable natural scrolling on the device. + * + * @param device The device to configure + * @param enable non-zero to enable, zero to disable natural scrolling + * + * @return A config status code + * + * @see libinput_device_config_scroll_has_natural_scroll + * @see libinput_device_config_scroll_get_natural_scroll_enabled + * @see libinput_device_config_scroll_get_default_natural_scroll_enabled + */ +enum libinput_config_status +libinput_device_config_scroll_set_natural_scroll_enabled(struct libinput_device *device, + int enable); +/** + * @ingroup config + * + * Get the current mode for scrolling on this device + * + * @param device The device to configure + * + * @return Zero if natural scrolling is disabled, non-zero if enabled + * + * @see libinput_device_config_scroll_has_natural_scroll + * @see libinput_device_config_scroll_set_natural_scroll_enabled + * @see libinput_device_config_scroll_get_default_natural_scroll_enabled + */ +int +libinput_device_config_scroll_get_natural_scroll_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default mode for scrolling on this device + * + * @param device The device to configure + * + * @return Zero if natural scrolling is disabled by default, non-zero if enabled + * + * @see libinput_device_config_scroll_has_natural_scroll + * @see libinput_device_config_scroll_set_natural_scroll_enabled + * @see libinput_device_config_scroll_get_natural_scroll_enabled + */ +int +libinput_device_config_scroll_get_default_natural_scroll_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Check if a device has a configuration that supports left-handed usage. + * + * @param device The device to configure + * @return Non-zero if the device can be set to left-handed, or zero + * otherwise + * + * @see libinput_device_config_left_handed_set + * @see libinput_device_config_left_handed_get + * @see libinput_device_config_left_handed_get_default + */ +int +libinput_device_config_left_handed_is_available(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the left-handed configuration of the device. + * + * The exact behavior is device-dependent. On a mouse and most pointing + * devices, left and right buttons are swapped but the middle button is + * unmodified. On a touchpad, physical buttons (if present) are swapped. On a + * clickpad, the top and bottom software-emulated buttons are swapped where + * present, the main area of the touchpad remains a left button. Tapping and + * clickfinger behavior is not affected by this setting. + * + * Changing the left-handed configuration of a device may not take effect + * until all buttons have been logically released. + * + * @param device The device to configure + * @param left_handed Zero to disable, non-zero to enable left-handed mode + * @return A configuration status code + * + * @see libinput_device_config_left_handed_is_available + * @see libinput_device_config_left_handed_get + * @see libinput_device_config_left_handed_get_default + */ +enum libinput_config_status +libinput_device_config_left_handed_set(struct libinput_device *device, + int left_handed); + +/** + * @ingroup config + * + * Get the current left-handed configuration of the device. + * + * @param device The device to configure + * @return Zero if the device is in right-handed mode, non-zero if the + * device is in left-handed mode + * + * @see libinput_device_config_left_handed_is_available + * @see libinput_device_config_left_handed_set + * @see libinput_device_config_left_handed_get_default + */ +int +libinput_device_config_left_handed_get(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default left-handed configuration of the device. + * + * @param device The device to configure + * @return Zero if the device is in right-handed mode by default, or non-zero + * if the device is in left-handed mode by default + * + * @see libinput_device_config_left_handed_is_available + * @see libinput_device_config_left_handed_set + * @see libinput_device_config_left_handed_get + */ +int +libinput_device_config_left_handed_get_default(struct libinput_device *device); + +/** + * @ingroup config + * + * The click method defines when to generate software-emulated + * buttons, usually on a device that does not have a specific physical + * button available. + */ +enum libinput_config_click_method { + /** + * Do not send software-emulated button events. This has no effect + * on events generated by physical buttons. + */ + LIBINPUT_CONFIG_CLICK_METHOD_NONE = 0, + /** + * Use software-button areas to generate button events. + */ + LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS = (1 << 0), + /** + * The number of fingers decides which button press to generate. + */ + LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER = (1 << 1), +}; + +/** + * @ingroup config + * + * Check which button click methods a device supports. The button click + * method defines when to generate software-emulated buttons, usually on a + * device that does not have a specific physical button available. + * + * @param device The device to configure + * + * @return A bitmask of possible methods. + * + * @see libinput_device_config_click_get_methods + * @see libinput_device_config_click_set_method + * @see libinput_device_config_click_get_method + */ +uint32_t +libinput_device_config_click_get_methods(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the button click method for this device. The button click + * method defines when to generate software-emulated buttons, usually on a + * device that does not have a specific physical button available. + * + * @note The selected click method may not take effect immediately. The + * device may require changing to a neutral state first before activating + * the new method. + * + * @param device The device to configure + * @param method The button click method + * + * @return A config status code + * + * @see libinput_device_config_click_get_methods + * @see libinput_device_config_click_get_method + * @see libinput_device_config_click_get_default_method + */ +enum libinput_config_status +libinput_device_config_click_set_method(struct libinput_device *device, + enum libinput_config_click_method method); +/** + * @ingroup config + * + * Get the button click method for this device. The button click + * method defines when to generate software-emulated buttons, usually on a + * device that does not have a specific physical button available. + * + * @param device The device to configure + * + * @return The current button click method for this device + * + * @see libinput_device_config_click_get_methods + * @see libinput_device_config_click_set_method + * @see libinput_device_config_click_get_default_method + */ +enum libinput_config_click_method +libinput_device_config_click_get_method(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default button click method for this device. The button click + * method defines when to generate software-emulated buttons, usually on a + * device that does not have a specific physical button available. + * + * @param device The device to configure + * + * @return The default button click method for this device + * + * @see libinput_device_config_click_get_methods + * @see libinput_device_config_click_set_method + * @see libinput_device_config_click_get_method + */ +enum libinput_config_click_method +libinput_device_config_click_get_default_method(struct libinput_device *device); + +/** + * @ingroup config + */ +enum libinput_config_middle_emulation_state { + /** + * Middle mouse button emulation is to be disabled, or + * is currently disabled. + */ + LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED, + /** + * Middle mouse button emulation is to be enabled, or + * is currently enabled. + */ + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED, +}; + +/** + * @ingroup config + * + * Check if middle mouse button emulation configuration is available on this + * device. See libinput_device_config_middle_emulation_set_enabled() for + * more details. + * + * @note Some devices provide middle mouse button emulation but do not allow + * enabling/disabling that emulation. These devices return zero in + * libinput_device_config_middle_emulation_is_available(). + * + * @param device The device to query + * + * @return Non-zero if middle mouse button emulation is available and can be + * configured, zero otherwise. + * + * @see libinput_device_config_middle_emulation_set_enabled + * @see libinput_device_config_middle_emulation_get_enabled + * @see libinput_device_config_middle_emulation_get_default_enabled + */ +int +libinput_device_config_middle_emulation_is_available( + struct libinput_device *device); + +/** + * @ingroup config + * + * Enable or disable middle button emulation on this device. When enabled, a + * simultaneous press of the left and right button generates a middle mouse + * button event. Releasing the buttons generates a middle mouse button + * release, the left and right button events are discarded otherwise. + * + * See the libinput documentation for more details. + * + * @param device The device to configure + * @param enable @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED to + * disable, @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED To enable + * middle button emulation. + * + * @return A config status code. Disabling middle button emulation on a + * device that does not support middle button emulation always succeeds. + * + * @see libinput_device_config_middle_emulation_is_available + * @see libinput_device_config_middle_emulation_get_enabled + * @see libinput_device_config_middle_emulation_get_default_enabled + */ +enum libinput_config_status +libinput_device_config_middle_emulation_set_enabled( + struct libinput_device *device, + enum libinput_config_middle_emulation_state enable); + +/** + * @ingroup config + * + * Check if configurable middle button emulation is enabled on this device. + * See libinput_device_config_middle_emulation_set_enabled() for more + * details. + * + * If the device does not have configurable middle button emulation, this + * function returns @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED. + * + * @note Some devices provide middle mouse button emulation but do not allow + * enabling/disabling that emulation. These devices always return @ref + * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED. + * + * @param device The device to configure + * @return @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED if disabled + * or not available/configurable, @ref + * LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED If enabled. + * + * @see libinput_device_config_middle_emulation_is_available + * @see libinput_device_config_middle_emulation_set_enabled + * @see libinput_device_config_middle_emulation_get_default_enabled + */ +enum libinput_config_middle_emulation_state +libinput_device_config_middle_emulation_get_enabled( + struct libinput_device *device); + +/** + * @ingroup config + * + * Check if configurable middle button emulation is enabled by default on + * this device. See libinput_device_config_middle_emulation_set_enabled() + * for more details. + * + * If the device does not have configurable middle button + * emulation, this function returns @ref + * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED. + * + * @note Some devices provide middle mouse button emulation but do not allow + * enabling/disabling that emulation. These devices always return @ref + * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED. + * + * @param device The device to configure + * @return @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED If disabled + * or not available, @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED if + * enabled. + * + * @see libinput_device_config_middle_emulation_is_available + * @see libinput_device_config_middle_emulation_set_enabled + * @see libinput_device_config_middle_emulation_get_enabled + */ +enum libinput_config_middle_emulation_state +libinput_device_config_middle_emulation_get_default_enabled( + struct libinput_device *device); + +/** + * @ingroup config + * + * The scroll method of a device selects when to generate scroll axis events + * instead of pointer motion events. + */ +enum libinput_config_scroll_method { + /** + * Never send scroll events instead of pointer motion events. + * This has no effect on events generated by scroll wheels. + */ + LIBINPUT_CONFIG_SCROLL_NO_SCROLL = 0, + /** + * Send scroll events when two fingers are logically down on the + * device. + */ + LIBINPUT_CONFIG_SCROLL_2FG = (1 << 0), + /** + * Send scroll events when a finger moves along the bottom or + * right edge of a device. + */ + LIBINPUT_CONFIG_SCROLL_EDGE = (1 << 1), + /** + * Send scroll events when a button is down and the device moves + * along a scroll-capable axis. + */ + LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN = (1 << 2), +}; + +/** + * @ingroup config + * + * Check which scroll methods a device supports. The method defines when to + * generate scroll axis events instead of pointer motion events. + * + * @param device The device to configure + * + * @return A bitmask of possible methods. + * + * @see libinput_device_config_scroll_set_method + * @see libinput_device_config_scroll_get_method + * @see libinput_device_config_scroll_get_default_method + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_button + * @see libinput_device_config_scroll_get_default_button + */ +uint32_t +libinput_device_config_scroll_get_methods(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the scroll method for this device. The method defines when to + * generate scroll axis events instead of pointer motion events. + * + * @note Setting @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN enables + * the scroll method, but scrolling is only activated when the configured + * button is held down. If no button is set, i.e. + * libinput_device_config_scroll_get_button() returns 0, scrolling + * cannot activate. + * + * @param device The device to configure + * @param method The scroll method for this device. + * + * @return A config status code. + * + * @see libinput_device_config_scroll_get_methods + * @see libinput_device_config_scroll_get_method + * @see libinput_device_config_scroll_get_default_method + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_button + * @see libinput_device_config_scroll_get_default_button + */ +enum libinput_config_status +libinput_device_config_scroll_set_method(struct libinput_device *device, + enum libinput_config_scroll_method method); + +/** + * @ingroup config + * + * Get the scroll method for this device. The method defines when to + * generate scroll axis events instead of pointer motion events. + * + * @param device The device to configure + * @return The current scroll method for this device. + * + * @see libinput_device_config_scroll_get_methods + * @see libinput_device_config_scroll_set_method + * @see libinput_device_config_scroll_get_default_method + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_button + * @see libinput_device_config_scroll_get_default_button + */ +enum libinput_config_scroll_method +libinput_device_config_scroll_get_method(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default scroll method for this device. The method defines when to + * generate scroll axis events instead of pointer motion events. + * + * @param device The device to configure + * @return The default scroll method for this device. + * + * @see libinput_device_config_scroll_get_methods + * @see libinput_device_config_scroll_set_method + * @see libinput_device_config_scroll_get_method + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_button + * @see libinput_device_config_scroll_get_default_button + */ +enum libinput_config_scroll_method +libinput_device_config_scroll_get_default_method(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method + * for this device. + * + * When the current scroll method is set to @ref + * LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN, no button press/release events + * will be send for the configured button. + * + * When the configured button is pressed, any motion events along a + * scroll-capable axis are turned into scroll axis events. + * + * @note Setting the button does not change the scroll method. To change the + * scroll method call libinput_device_config_scroll_set_method(). + * + * If the button is 0, button scrolling is effectively disabled. + * + * @param device The device to configure + * @param button The button which when pressed switches to sending scroll events + * + * @return A config status code + * @retval LIBINPUT_CONFIG_STATUS_SUCCESS On success + * @retval LIBINPUT_CONFIG_STATUS_UNSUPPORTED If @ref + * LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN is not supported + * @retval LIBINPUT_CONFIG_STATUS_INVALID The given button does not + * exist on this device + * + * @see libinput_device_config_scroll_get_methods + * @see libinput_device_config_scroll_set_method + * @see libinput_device_config_scroll_get_method + * @see libinput_device_config_scroll_get_default_method + * @see libinput_device_config_scroll_get_button + * @see libinput_device_config_scroll_get_default_button + */ +enum libinput_config_status +libinput_device_config_scroll_set_button(struct libinput_device *device, + uint32_t button); + +/** + * @ingroup config + * + * Get the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method + * for this device. + * + * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not + * supported, or no button is set, this function returns 0. + * + * @note The return value is independent of the currently selected + * scroll-method. For button scrolling to activate, a device must have the + * @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a non-zero + * button set as scroll button. + * + * @param device The device to configure + * @return The button which when pressed switches to sending scroll events + * + * @see libinput_device_config_scroll_get_methods + * @see libinput_device_config_scroll_set_method + * @see libinput_device_config_scroll_get_method + * @see libinput_device_config_scroll_get_default_method + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_default_button + */ +uint32_t +libinput_device_config_scroll_get_button(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN + * method for this device. + * + * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not supported, + * or no default button is set, this function returns 0. + * + * @param device The device to configure + * @return The default button for the @ref + * LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method + * + * @see libinput_device_config_scroll_get_methods + * @see libinput_device_config_scroll_set_method + * @see libinput_device_config_scroll_get_method + * @see libinput_device_config_scroll_get_default_method + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_button + */ +uint32_t +libinput_device_config_scroll_get_default_button(struct libinput_device *device); + +enum libinput_config_scroll_button_lock_state { + LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED, + LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED, +}; + +/** + * @ingroup config + * + * Set the scroll button lock. If the state is + * @ref LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED, the button must + * physically be held down for button scrolling to work. + * If the state is + * @ref LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED, the button is considered + * logically down after the first press and release sequence, and logically + * up after the second press and release sequence. + * + * @param device The device to configure + * @param state The state to set the scroll button lock to + * + * @return A config status code. Disabling the scroll button lock on + * device that does not support button scrolling always succeeds. + * + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_get_button + * @see libinput_device_config_scroll_get_default_button + */ +enum libinput_config_status +libinput_device_config_scroll_set_button_lock(struct libinput_device *device, + enum libinput_config_scroll_button_lock_state state); + +/** + * @ingroup config + * + * Get the current scroll button lock state. + * + * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not + * supported, or no button is set, this function returns @ref + * LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED. + * + * @note The return value is independent of the currently selected + * scroll-method. For the scroll button lock to activate, a device must have + * the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a + * non-zero button set as scroll button. + * + * @param device The device to configure + * @return The scroll button lock state + * + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_set_button_lock + * @see libinput_device_config_scroll_get_button_lock + * @see libinput_device_config_scroll_get_default_button_lock + */ +enum libinput_config_scroll_button_lock_state +libinput_device_config_scroll_get_button_lock(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default scroll button lock state. + * + * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not + * supported, or no button is set, this function returns @ref + * LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED. + * + * @param device The device to configure + * @return The default scroll button lock state + * + * @see libinput_device_config_scroll_set_button + * @see libinput_device_config_scroll_set_button_lock + * @see libinput_device_config_scroll_get_button_lock + * @see libinput_device_config_scroll_get_default_button_lock + */ +enum libinput_config_scroll_button_lock_state +libinput_device_config_scroll_get_default_button_lock(struct libinput_device *device); + +/** + * @ingroup config + * + * Possible states for the disable-while-typing feature. + */ +enum libinput_config_dwt_state { + LIBINPUT_CONFIG_DWT_DISABLED, + LIBINPUT_CONFIG_DWT_ENABLED, +}; + +/** + * @ingroup config + * + * Check if this device supports configurable disable-while-typing feature. + * This feature is usually available on built-in touchpads and disables the + * touchpad while typing. See the libinput documentation for details. + * + * @param device The device to configure + * @return 0 if this device does not support disable-while-typing, or 1 + * otherwise. + * + * @see libinput_device_config_dwt_set_enabled + * @see libinput_device_config_dwt_get_enabled + * @see libinput_device_config_dwt_get_default_enabled + */ +int +libinput_device_config_dwt_is_available(struct libinput_device *device); + +/** + * @ingroup config + * + * Enable or disable the disable-while-typing feature. When enabled, the + * device will be disabled while typing and for a short period after. See + * the libinput documentation for details. + * + * @note Enabling or disabling disable-while-typing may not take effect + * immediately. + * + * @param device The device to configure + * @param enable @ref LIBINPUT_CONFIG_DWT_DISABLED to disable + * disable-while-typing, @ref LIBINPUT_CONFIG_DWT_ENABLED to enable + * + * @return A config status code. Disabling disable-while-typing on a + * device that does not support the feature always succeeds. + * + * @see libinput_device_config_dwt_is_available + * @see libinput_device_config_dwt_get_enabled + * @see libinput_device_config_dwt_get_default_enabled + */ +enum libinput_config_status +libinput_device_config_dwt_set_enabled(struct libinput_device *device, + enum libinput_config_dwt_state enable); + +/** + * @ingroup config + * + * Check if the disable-while typing feature is currently enabled on this + * device. If the device does not support disable-while-typing, this + * function returns @ref LIBINPUT_CONFIG_DWT_DISABLED. + * + * @param device The device to configure + * @return @ref LIBINPUT_CONFIG_DWT_DISABLED if disabled, @ref + * LIBINPUT_CONFIG_DWT_ENABLED if enabled. + * + * @see libinput_device_config_dwt_is_available + * @see libinput_device_config_dwt_set_enabled + * @see libinput_device_config_dwt_get_default_enabled + */ +enum libinput_config_dwt_state +libinput_device_config_dwt_get_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Check if the disable-while typing feature is enabled on this device by + * default. If the device does not support disable-while-typing, this + * function returns @ref LIBINPUT_CONFIG_DWT_DISABLED. + * + * @param device The device to configure + * @return @ref LIBINPUT_CONFIG_DWT_DISABLED if disabled, @ref + * LIBINPUT_CONFIG_DWT_ENABLED if enabled. + * + * @see libinput_device_config_dwt_is_available + * @see libinput_device_config_dwt_set_enabled + * @see libinput_device_config_dwt_get_enabled + */ +enum libinput_config_dwt_state +libinput_device_config_dwt_get_default_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Possible states for the disable-while-trackpointing feature. + * + * @since 1.21 + */ +enum libinput_config_dwtp_state { + LIBINPUT_CONFIG_DWTP_DISABLED, + LIBINPUT_CONFIG_DWTP_ENABLED, +}; + +/** + * @ingroup config + * + * Check if this device supports configurable disable-while-trackpointing + * feature. This feature is usually available on Thinkpads and disables the + * touchpad while using the trackpoint. See the libinput documentation for + * details. + * + * @param device The device to configure + * @return 0 if this device does not support disable-while-trackpointing, or 1 + * otherwise. + * + * @see libinput_device_config_dwtp_set_enabled + * @see libinput_device_config_dwtp_get_enabled + * @see libinput_device_config_dwtp_get_default_enabled + * + * @since 1.21 + */ +int +libinput_device_config_dwtp_is_available(struct libinput_device *device); + +/** + * @ingroup config + * + * Enable or disable the disable-while-trackpointing feature. When enabled, the + * device will be disabled while using the trackpoint and for a short period + * after. See the libinput documentation for details. + * + * @note Enabling or disabling disable-while-trackpointing may not take effect + * immediately. + * + * @param device The device to configure + * @param enable @ref LIBINPUT_CONFIG_DWTP_DISABLED to disable + * disable-while-trackpointing, @ref LIBINPUT_CONFIG_DWTP_ENABLED to enable + * + * @return A config status code. Disabling disable-while-trackpointing on a + * device that does not support the feature always succeeds. + * + * @see libinput_device_config_dwtp_is_available + * @see libinput_device_config_dwtp_get_enabled + * @see libinput_device_config_dwtp_get_default_enabled + * + * @since 1.21 + */ +enum libinput_config_status +libinput_device_config_dwtp_set_enabled(struct libinput_device *device, + enum libinput_config_dwtp_state enable); + +/** + * @ingroup config + * + * Check if the disable-while trackpointing feature is currently enabled on + * this device. If the device does not support disable-while-trackpointing, + * this function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED. + * + * @param device The device to configure + * @return @ref LIBINPUT_CONFIG_DWTP_DISABLED if disabled, @ref + * LIBINPUT_CONFIG_DWTP_ENABLED if enabled. + * + * @see libinput_device_config_dwtp_is_available + * @see libinput_device_config_dwtp_set_enabled + * @see libinput_device_config_dwtp_get_default_enabled + * + * @since 1.21 + */ +enum libinput_config_dwtp_state +libinput_device_config_dwtp_get_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Check if the disable-while trackpointing feature is enabled on this device + * by default. If the device does not support disable-while-trackpointing, this + * function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED. + * + * @param device The device to configure + * @return @ref LIBINPUT_CONFIG_DWTP_DISABLED if disabled, @ref + * LIBINPUT_CONFIG_DWTP_ENABLED if enabled. + * + * @see libinput_device_config_dwtp_is_available + * @see libinput_device_config_dwtp_set_enabled + * @see libinput_device_config_dwtp_get_enabled + * + * @since 1.21 + */ +enum libinput_config_dwtp_state +libinput_device_config_dwtp_get_default_enabled(struct libinput_device *device); + +/** + * @ingroup config + * + * Check whether a device can have a custom rotation applied. + * + * @param device The device to configure + * @return Non-zero if a device can be rotated, zero otherwise. + * + * @see libinput_device_config_rotation_set_angle + * @see libinput_device_config_rotation_get_angle + * @see libinput_device_config_rotation_get_default_angle + * + * @since 1.4 + */ +int +libinput_device_config_rotation_is_available(struct libinput_device *device); + +/** + * @ingroup config + * + * Set the rotation of a device in degrees clockwise off the logical neutral + * position. Any subsequent motion events are adjusted according to the + * given angle. + * + * The angle has to be in the range of [0, 360[ degrees, otherwise this + * function returns LIBINPUT_CONFIG_STATUS_INVALID. If the angle is a + * multiple of 360 or negative, the caller must ensure the correct ranging + * before calling this function. + * + * The rotation angle is applied to all motion events emitted by the device. + * Thus, rotating the device also changes the angle required or presented by + * scrolling, gestures, etc. + * + * @param device The device to configure + * @param degrees_cw The angle in degrees clockwise + * @return A config status code. Setting a rotation of 0 degrees on a + * device that does not support rotation always succeeds. + * + * @see libinput_device_config_rotation_is_available + * @see libinput_device_config_rotation_get_angle + * @see libinput_device_config_rotation_get_default_angle + * + * @since 1.4 + */ +enum libinput_config_status +libinput_device_config_rotation_set_angle(struct libinput_device *device, + unsigned int degrees_cw); + +/** + * @ingroup config + * + * Get the current rotation of a device in degrees clockwise off the logical + * neutral position. If this device does not support rotation, the return + * value is always 0. + * + * @param device The device to configure + * @return The angle in degrees clockwise + * + * @see libinput_device_config_rotation_is_available + * @see libinput_device_config_rotation_set_angle + * @see libinput_device_config_rotation_get_default_angle + * + * @since 1.4 + */ +unsigned int +libinput_device_config_rotation_get_angle(struct libinput_device *device); + +/** + * @ingroup config + * + * Get the default rotation of a device in degrees clockwise off the logical + * neutral position. If this device does not support rotation, the return + * value is always 0. + * + * @param device The device to configure + * @return The default angle in degrees clockwise + * + * @see libinput_device_config_rotation_is_available + * @see libinput_device_config_rotation_set_angle + * @see libinput_device_config_rotation_get_angle + * + * @since 1.4 + */ +unsigned int +libinput_device_config_rotation_get_default_angle(struct libinput_device *device); + +#ifdef __cplusplus +} +#endif +#endif /* LIBINPUT_H */ diff --git a/input-sys/src/bindings/gen_1_11.rs b/input-sys/src/bindings/gen_1_11.rs index 90accc0..1f0bf24 100644 --- a/input-sys/src/bindings/gen_1_11.rs +++ b/input-sys/src/bindings/gen_1_11.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.2 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/input-sys/src/bindings/gen_1_14.rs b/input-sys/src/bindings/gen_1_14.rs index b1593fc..7e9294b 100644 --- a/input-sys/src/bindings/gen_1_14.rs +++ b/input-sys/src/bindings/gen_1_14.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.2 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/input-sys/src/bindings/gen_1_15.rs b/input-sys/src/bindings/gen_1_15.rs index b3e6eee..2441dec 100644 --- a/input-sys/src/bindings/gen_1_15.rs +++ b/input-sys/src/bindings/gen_1_15.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.2 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/input-sys/src/bindings/gen_1_19.rs b/input-sys/src/bindings/gen_1_19.rs index dea0ac6..80873fe 100644 --- a/input-sys/src/bindings/gen_1_19.rs +++ b/input-sys/src/bindings/gen_1_19.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.2 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/input-sys/src/bindings/gen_1_21.rs b/input-sys/src/bindings/gen_1_21.rs index 7b6b780..070a935 100644 --- a/input-sys/src/bindings/gen_1_21.rs +++ b/input-sys/src/bindings/gen_1_21.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.2 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/input-sys/src/bindings/gen_1_23.rs b/input-sys/src/bindings/gen_1_23.rs new file mode 100644 index 0000000..1a38e19 --- /dev/null +++ b/input-sys/src/bindings/gen_1_23.rs @@ -0,0 +1,4689 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +pub const _FEATURES_H: u32 = 1; +pub const _DEFAULT_SOURCE: u32 = 1; +pub const __GLIBC_USE_ISOC2X: u32 = 0; +pub const __USE_ISOC11: u32 = 1; +pub const __USE_ISOC99: u32 = 1; +pub const __USE_ISOC95: u32 = 1; +pub const __USE_POSIX_IMPLICITLY: u32 = 1; +pub const _POSIX_SOURCE: u32 = 1; +pub const _POSIX_C_SOURCE: u32 = 200809; +pub const __USE_POSIX: u32 = 1; +pub const __USE_POSIX2: u32 = 1; +pub const __USE_POSIX199309: u32 = 1; +pub const __USE_POSIX199506: u32 = 1; +pub const __USE_XOPEN2K: u32 = 1; +pub const __USE_XOPEN2K8: u32 = 1; +pub const _ATFILE_SOURCE: u32 = 1; +pub const __WORDSIZE: u32 = 64; +pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; +pub const __SYSCALL_WORDSIZE: u32 = 64; +pub const __TIMESIZE: u32 = 64; +pub const __USE_MISC: u32 = 1; +pub const __USE_ATFILE: u32 = 1; +pub const __USE_FORTIFY_LEVEL: u32 = 0; +pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; +pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; +pub const __GLIBC_USE_C2X_STRTOL: u32 = 0; +pub const _STDC_PREDEF_H: u32 = 1; +pub const __STDC_IEC_559__: u32 = 1; +pub const __STDC_IEC_60559_BFP__: u32 = 201404; +pub const __STDC_IEC_559_COMPLEX__: u32 = 1; +pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404; +pub const __STDC_ISO_10646__: u32 = 201706; +pub const __GNU_LIBRARY__: u32 = 6; +pub const __GLIBC__: u32 = 2; +pub const __GLIBC_MINOR__: u32 = 39; +pub const _SYS_CDEFS_H: u32 = 1; +pub const __glibc_c99_flexarr_available: u32 = 1; +pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; +pub const __HAVE_GENERIC_SELECTION: u32 = 1; +pub const __GLIBC_USE_LIB_EXT2: u32 = 0; +pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; +pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; +pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; +pub const _STDLIB_H: u32 = 1; +pub const WNOHANG: u32 = 1; +pub const WUNTRACED: u32 = 2; +pub const WSTOPPED: u32 = 2; +pub const WEXITED: u32 = 4; +pub const WCONTINUED: u32 = 8; +pub const WNOWAIT: u32 = 16777216; +pub const __WNOTHREAD: u32 = 536870912; +pub const __WALL: u32 = 1073741824; +pub const __WCLONE: u32 = 2147483648; +pub const __W_CONTINUED: u32 = 65535; +pub const __WCOREFLAG: u32 = 128; +pub const __HAVE_FLOAT128: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; +pub const __HAVE_FLOAT64X: u32 = 1; +pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; +pub const __HAVE_FLOAT16: u32 = 0; +pub const __HAVE_FLOAT32: u32 = 1; +pub const __HAVE_FLOAT64: u32 = 1; +pub const __HAVE_FLOAT32X: u32 = 1; +pub const __HAVE_FLOAT128X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; +pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; +pub const __ldiv_t_defined: u32 = 1; +pub const __lldiv_t_defined: u32 = 1; +pub const RAND_MAX: u32 = 2147483647; +pub const EXIT_FAILURE: u32 = 1; +pub const EXIT_SUCCESS: u32 = 0; +pub const _SYS_TYPES_H: u32 = 1; +pub const _BITS_TYPES_H: u32 = 1; +pub const _BITS_TYPESIZES_H: u32 = 1; +pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; +pub const __INO_T_MATCHES_INO64_T: u32 = 1; +pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; +pub const __STATFS_MATCHES_STATFS64: u32 = 1; +pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1; +pub const __FD_SETSIZE: u32 = 1024; +pub const _BITS_TIME64_H: u32 = 1; +pub const __clock_t_defined: u32 = 1; +pub const __clockid_t_defined: u32 = 1; +pub const __time_t_defined: u32 = 1; +pub const __timer_t_defined: u32 = 1; +pub const _BITS_STDINT_INTN_H: u32 = 1; +pub const __BIT_TYPES_DEFINED__: u32 = 1; +pub const _ENDIAN_H: u32 = 1; +pub const _BITS_ENDIAN_H: u32 = 1; +pub const __LITTLE_ENDIAN: u32 = 1234; +pub const __BIG_ENDIAN: u32 = 4321; +pub const __PDP_ENDIAN: u32 = 3412; +pub const _BITS_ENDIANNESS_H: u32 = 1; +pub const __BYTE_ORDER: u32 = 1234; +pub const __FLOAT_WORD_ORDER: u32 = 1234; +pub const LITTLE_ENDIAN: u32 = 1234; +pub const BIG_ENDIAN: u32 = 4321; +pub const PDP_ENDIAN: u32 = 3412; +pub const BYTE_ORDER: u32 = 1234; +pub const _BITS_BYTESWAP_H: u32 = 1; +pub const _BITS_UINTN_IDENTITY_H: u32 = 1; +pub const _SYS_SELECT_H: u32 = 1; +pub const __sigset_t_defined: u32 = 1; +pub const __timeval_defined: u32 = 1; +pub const _STRUCT_TIMESPEC: u32 = 1; +pub const FD_SETSIZE: u32 = 1024; +pub const _BITS_PTHREADTYPES_COMMON_H: u32 = 1; +pub const _THREAD_SHARED_TYPES_H: u32 = 1; +pub const _BITS_PTHREADTYPES_ARCH_H: u32 = 1; +pub const __SIZEOF_PTHREAD_MUTEX_T: u32 = 40; +pub const __SIZEOF_PTHREAD_ATTR_T: u32 = 56; +pub const __SIZEOF_PTHREAD_RWLOCK_T: u32 = 56; +pub const __SIZEOF_PTHREAD_BARRIER_T: u32 = 32; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: u32 = 4; +pub const __SIZEOF_PTHREAD_COND_T: u32 = 48; +pub const __SIZEOF_PTHREAD_CONDATTR_T: u32 = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: u32 = 8; +pub const __SIZEOF_PTHREAD_BARRIERATTR_T: u32 = 4; +pub const _THREAD_MUTEX_INTERNAL_H: u32 = 1; +pub const __PTHREAD_MUTEX_HAVE_PREV: u32 = 1; +pub const __have_pthread_attr_t: u32 = 1; +pub const _ALLOCA_H: u32 = 1; +pub const _STDINT_H: u32 = 1; +pub const _BITS_WCHAR_H: u32 = 1; +pub const _BITS_STDINT_UINTN_H: u32 = 1; +pub const _BITS_STDINT_LEAST_H: u32 = 1; +pub const INT8_MIN: i32 = -128; +pub const INT16_MIN: i32 = -32768; +pub const INT32_MIN: i32 = -2147483648; +pub const INT8_MAX: u32 = 127; +pub const INT16_MAX: u32 = 32767; +pub const INT32_MAX: u32 = 2147483647; +pub const UINT8_MAX: u32 = 255; +pub const UINT16_MAX: u32 = 65535; +pub const UINT32_MAX: u32 = 4294967295; +pub const INT_LEAST8_MIN: i32 = -128; +pub const INT_LEAST16_MIN: i32 = -32768; +pub const INT_LEAST32_MIN: i32 = -2147483648; +pub const INT_LEAST8_MAX: u32 = 127; +pub const INT_LEAST16_MAX: u32 = 32767; +pub const INT_LEAST32_MAX: u32 = 2147483647; +pub const UINT_LEAST8_MAX: u32 = 255; +pub const UINT_LEAST16_MAX: u32 = 65535; +pub const UINT_LEAST32_MAX: u32 = 4294967295; +pub const INT_FAST8_MIN: i32 = -128; +pub const INT_FAST16_MIN: i64 = -9223372036854775808; +pub const INT_FAST32_MIN: i64 = -9223372036854775808; +pub const INT_FAST8_MAX: u32 = 127; +pub const INT_FAST16_MAX: u64 = 9223372036854775807; +pub const INT_FAST32_MAX: u64 = 9223372036854775807; +pub const UINT_FAST8_MAX: u32 = 255; +pub const UINT_FAST16_MAX: i32 = -1; +pub const UINT_FAST32_MAX: i32 = -1; +pub const INTPTR_MIN: i64 = -9223372036854775808; +pub const INTPTR_MAX: u64 = 9223372036854775807; +pub const UINTPTR_MAX: i32 = -1; +pub const PTRDIFF_MIN: i64 = -9223372036854775808; +pub const PTRDIFF_MAX: u64 = 9223372036854775807; +pub const SIG_ATOMIC_MIN: i32 = -2147483648; +pub const SIG_ATOMIC_MAX: u32 = 2147483647; +pub const SIZE_MAX: i32 = -1; +pub const WINT_MIN: u32 = 0; +pub const WINT_MAX: u32 = 4294967295; +pub const _SYS_SYSMACROS_H: u32 = 1; +pub const _BITS_SYSMACROS_H: u32 = 1; +pub type wchar_t = ::std::os::raw::c_int; +pub type _Float32 = f32; +pub type _Float64 = f64; +pub type _Float32x = f64; +pub type _Float64x = u128; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct div_t { + pub quot: ::std::os::raw::c_int, + pub rem: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_div_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(div_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(div_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(rem) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ldiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_ldiv_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ldiv_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(rem) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lldiv_t { + pub quot: ::std::os::raw::c_longlong, + pub rem: ::std::os::raw::c_longlong, +} +#[test] +fn bindgen_test_layout_lldiv_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(lldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lldiv_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn __ctype_get_mb_cur_max() -> usize; +} +extern "C" { + pub fn atof(__nptr: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn atoi(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn atol(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn atoll(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtod( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + ) -> f64; +} +extern "C" { + pub fn strtof( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + ) -> f32; +} +extern "C" { + pub fn strtold( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + ) -> u128; +} +extern "C" { + pub fn strtol( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn strtoul( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strtoq( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtouq( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn strtoll( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoull( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn l64a(__n: ::std::os::raw::c_long) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn a64l(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__fsid_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__fsid_t), + "::", + stringify!(__val) + ) + ); +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type u_char = __u_char; +pub type u_short = __u_short; +pub type u_int = __u_int; +pub type u_long = __u_long; +pub type quad_t = __quad_t; +pub type u_quad_t = __u_quad_t; +pub type fsid_t = __fsid_t; +pub type loff_t = __loff_t; +pub type ino_t = __ino_t; +pub type dev_t = __dev_t; +pub type gid_t = __gid_t; +pub type mode_t = __mode_t; +pub type nlink_t = __nlink_t; +pub type uid_t = __uid_t; +pub type off_t = __off_t; +pub type pid_t = __pid_t; +pub type id_t = __id_t; +pub type daddr_t = __daddr_t; +pub type caddr_t = __caddr_t; +pub type key_t = __key_t; +pub type clock_t = __clock_t; +pub type clockid_t = __clockid_t; +pub type time_t = __time_t; +pub type timer_t = __timer_t; +pub type ulong = ::std::os::raw::c_ulong; +pub type ushort = ::std::os::raw::c_ushort; +pub type uint = ::std::os::raw::c_uint; +pub type u_int8_t = __uint8_t; +pub type u_int16_t = __uint16_t; +pub type u_int32_t = __uint32_t; +pub type u_int64_t = __uint64_t; +pub type register_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___sigset_t() { + const UNINIT: ::std::mem::MaybeUninit<__sigset_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__sigset_t>(), + 128usize, + concat!("Size of: ", stringify!(__sigset_t)) + ); + assert_eq!( + ::std::mem::align_of::<__sigset_t>(), + 8usize, + concat!("Alignment of ", stringify!(__sigset_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__sigset_t), + "::", + stringify!(__val) + ) + ); +} +pub type sigset_t = __sigset_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +#[test] +fn bindgen_test_layout_timeval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(timeval)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(timeval)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(timeval), + "::", + stringify!(tv_sec) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(timeval), + "::", + stringify!(tv_usec) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +#[test] +fn bindgen_test_layout_timespec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(timespec)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(timespec)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(timespec), + "::", + stringify!(tv_sec) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(timespec), + "::", + stringify!(tv_nsec) + ) + ); +} +pub type suseconds_t = __suseconds_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +#[test] +fn bindgen_test_layout_fd_set() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(fd_set)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(fd_set)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__fds_bits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fd_set), + "::", + stringify!(__fds_bits) + ) + ); +} +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +pub type blksize_t = __blksize_t; +pub type blkcnt_t = __blkcnt_t; +pub type fsblkcnt_t = __fsblkcnt_t; +pub type fsfilcnt_t = __fsfilcnt_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub union __atomic_wide_counter { + pub __value64: ::std::os::raw::c_ulonglong, + pub __value32: __atomic_wide_counter__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __atomic_wide_counter__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout___atomic_wide_counter__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__atomic_wide_counter__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__atomic_wide_counter__bindgen_ty_1>(), + 8usize, + concat!("Size of: ", stringify!(__atomic_wide_counter__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<__atomic_wide_counter__bindgen_ty_1>(), + 4usize, + concat!( + "Alignment of ", + stringify!(__atomic_wide_counter__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__low) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__atomic_wide_counter__bindgen_ty_1), + "::", + stringify!(__low) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__high) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__atomic_wide_counter__bindgen_ty_1), + "::", + stringify!(__high) + ) + ); +} +#[test] +fn bindgen_test_layout___atomic_wide_counter() { + const UNINIT: ::std::mem::MaybeUninit<__atomic_wide_counter> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__atomic_wide_counter>(), + 8usize, + concat!("Size of: ", stringify!(__atomic_wide_counter)) + ); + assert_eq!( + ::std::mem::align_of::<__atomic_wide_counter>(), + 8usize, + concat!("Alignment of ", stringify!(__atomic_wide_counter)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value64) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__atomic_wide_counter), + "::", + stringify!(__value64) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value32) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__atomic_wide_counter), + "::", + stringify!(__value32) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_list { + pub __prev: *mut __pthread_internal_list, + pub __next: *mut __pthread_internal_list, +} +#[test] +fn bindgen_test_layout___pthread_internal_list() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_internal_list> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__pthread_internal_list>(), + 16usize, + concat!("Size of: ", stringify!(__pthread_internal_list)) + ); + assert_eq!( + ::std::mem::align_of::<__pthread_internal_list>(), + 8usize, + concat!("Alignment of ", stringify!(__pthread_internal_list)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__prev) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__pthread_internal_list), + "::", + stringify!(__prev) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__next) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__pthread_internal_list), + "::", + stringify!(__next) + ) + ); +} +pub type __pthread_list_t = __pthread_internal_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_slist { + pub __next: *mut __pthread_internal_slist, +} +#[test] +fn bindgen_test_layout___pthread_internal_slist() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_internal_slist> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__pthread_internal_slist>(), + 8usize, + concat!("Size of: ", stringify!(__pthread_internal_slist)) + ); + assert_eq!( + ::std::mem::align_of::<__pthread_internal_slist>(), + 8usize, + concat!("Alignment of ", stringify!(__pthread_internal_slist)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__next) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__pthread_internal_slist), + "::", + stringify!(__next) + ) + ); +} +pub type __pthread_slist_t = __pthread_internal_slist; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_mutex_s { + pub __lock: ::std::os::raw::c_int, + pub __count: ::std::os::raw::c_uint, + pub __owner: ::std::os::raw::c_int, + pub __nusers: ::std::os::raw::c_uint, + pub __kind: ::std::os::raw::c_int, + pub __spins: ::std::os::raw::c_short, + pub __elision: ::std::os::raw::c_short, + pub __list: __pthread_list_t, +} +#[test] +fn bindgen_test_layout___pthread_mutex_s() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_mutex_s> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__pthread_mutex_s>(), + 40usize, + concat!("Size of: ", stringify!(__pthread_mutex_s)) + ); + assert_eq!( + ::std::mem::align_of::<__pthread_mutex_s>(), + 8usize, + concat!("Alignment of ", stringify!(__pthread_mutex_s)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__lock) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__lock) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__count) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__owner) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__owner) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__nusers) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__nusers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__kind) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__kind) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__spins) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__spins) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__elision) as usize - ptr as usize }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__elision) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__list) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__pthread_mutex_s), + "::", + stringify!(__list) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_rwlock_arch_t { + pub __readers: ::std::os::raw::c_uint, + pub __writers: ::std::os::raw::c_uint, + pub __wrphase_futex: ::std::os::raw::c_uint, + pub __writers_futex: ::std::os::raw::c_uint, + pub __pad3: ::std::os::raw::c_uint, + pub __pad4: ::std::os::raw::c_uint, + pub __cur_writer: ::std::os::raw::c_int, + pub __shared: ::std::os::raw::c_int, + pub __rwelision: ::std::os::raw::c_schar, + pub __pad1: [::std::os::raw::c_uchar; 7usize], + pub __pad2: ::std::os::raw::c_ulong, + pub __flags: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout___pthread_rwlock_arch_t() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_rwlock_arch_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__pthread_rwlock_arch_t>(), + 56usize, + concat!("Size of: ", stringify!(__pthread_rwlock_arch_t)) + ); + assert_eq!( + ::std::mem::align_of::<__pthread_rwlock_arch_t>(), + 8usize, + concat!("Alignment of ", stringify!(__pthread_rwlock_arch_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__readers) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__readers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__writers) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__writers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wrphase_futex) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__wrphase_futex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__writers_futex) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__writers_futex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad3) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__pad3) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__pad4) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__cur_writer) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__cur_writer) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__shared) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__shared) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__rwelision) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__rwelision) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad1) as usize - ptr as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__pad1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad2) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__pad2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__flags) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__pthread_rwlock_arch_t), + "::", + stringify!(__flags) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __pthread_cond_s { + pub __wseq: __atomic_wide_counter, + pub __g1_start: __atomic_wide_counter, + pub __g_refs: [::std::os::raw::c_uint; 2usize], + pub __g_size: [::std::os::raw::c_uint; 2usize], + pub __g1_orig_size: ::std::os::raw::c_uint, + pub __wrefs: ::std::os::raw::c_uint, + pub __g_signals: [::std::os::raw::c_uint; 2usize], +} +#[test] +fn bindgen_test_layout___pthread_cond_s() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_cond_s> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__pthread_cond_s>(), + 48usize, + concat!("Size of: ", stringify!(__pthread_cond_s)) + ); + assert_eq!( + ::std::mem::align_of::<__pthread_cond_s>(), + 8usize, + concat!("Alignment of ", stringify!(__pthread_cond_s)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wseq) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__wseq) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__g1_start) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__g1_start) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__g_refs) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__g_refs) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__g_size) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__g_size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__g1_orig_size) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__g1_orig_size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wrefs) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__wrefs) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__g_signals) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__pthread_cond_s), + "::", + stringify!(__g_signals) + ) + ); +} +pub type __tss_t = ::std::os::raw::c_uint; +pub type __thrd_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __once_flag { + pub __data: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout___once_flag() { + const UNINIT: ::std::mem::MaybeUninit<__once_flag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__once_flag>(), + 4usize, + concat!("Size of: ", stringify!(__once_flag)) + ); + assert_eq!( + ::std::mem::align_of::<__once_flag>(), + 4usize, + concat!("Alignment of ", stringify!(__once_flag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__once_flag), + "::", + stringify!(__data) + ) + ); +} +pub type pthread_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutexattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_pthread_mutexattr_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_mutexattr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_mutexattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutexattr_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutexattr_t), + "::", + stringify!(__align) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_condattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_pthread_condattr_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_condattr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_condattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_condattr_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_condattr_t), + "::", + stringify!(__align) + ) + ); +} +pub type pthread_key_t = ::std::os::raw::c_uint; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_attr_t { + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_pthread_attr_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(pthread_attr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_attr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(__align) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutex_t { + pub __data: __pthread_mutex_s, + pub __size: [::std::os::raw::c_char; 40usize], + pub __align: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_pthread_mutex_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__align) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_cond_t { + pub __data: __pthread_cond_s, + pub __size: [::std::os::raw::c_char; 48usize], + pub __align: ::std::os::raw::c_longlong, +} +#[test] +fn bindgen_test_layout_pthread_cond_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(pthread_cond_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_cond_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__align) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlock_t { + pub __data: __pthread_rwlock_arch_t, + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_pthread_rwlock_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__align) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlockattr_t { + pub __size: [::std::os::raw::c_char; 8usize], + pub __align: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_pthread_rwlockattr_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(pthread_rwlockattr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_rwlockattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlockattr_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlockattr_t), + "::", + stringify!(__align) + ) + ); +} +pub type pthread_spinlock_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrier_t { + pub __size: [::std::os::raw::c_char; 32usize], + pub __align: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_pthread_barrier_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrier_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrier_t), + "::", + stringify!(__align) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrierattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_pthread_barrierattr_t() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_barrierattr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_barrierattr_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrierattr_t), + "::", + stringify!(__size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrierattr_t), + "::", + stringify!(__align) + ) + ); +} +extern "C" { + pub fn random() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srandom(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn initstate( + __seed: ::std::os::raw::c_uint, + __statebuf: *mut ::std::os::raw::c_char, + __statelen: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn setstate(__statebuf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct random_data { + pub fptr: *mut i32, + pub rptr: *mut i32, + pub state: *mut i32, + pub rand_type: ::std::os::raw::c_int, + pub rand_deg: ::std::os::raw::c_int, + pub rand_sep: ::std::os::raw::c_int, + pub end_ptr: *mut i32, +} +#[test] +fn bindgen_test_layout_random_data() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(random_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(random_data)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fptr) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(fptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rptr) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(rptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).state) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(state) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rand_type) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(rand_type) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rand_deg) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(rand_deg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rand_sep) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(rand_sep) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).end_ptr) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(random_data), + "::", + stringify!(end_ptr) + ) + ); +} +extern "C" { + pub fn random_r(__buf: *mut random_data, __result: *mut i32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srandom_r( + __seed: ::std::os::raw::c_uint, + __buf: *mut random_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn initstate_r( + __seed: ::std::os::raw::c_uint, + __statebuf: *mut ::std::os::raw::c_char, + __statelen: usize, + __buf: *mut random_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setstate_r( + __statebuf: *mut ::std::os::raw::c_char, + __buf: *mut random_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rand() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn rand_r(__seed: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; +} +extern "C" { + pub fn lrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn mrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srand48(__seedval: ::std::os::raw::c_long); +} +extern "C" { + pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; +} +extern "C" { + pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct drand48_data { + pub __x: [::std::os::raw::c_ushort; 3usize], + pub __old_x: [::std::os::raw::c_ushort; 3usize], + pub __c: ::std::os::raw::c_ushort, + pub __init: ::std::os::raw::c_ushort, + pub __a: ::std::os::raw::c_ulonglong, +} +#[test] +fn bindgen_test_layout_drand48_data() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(drand48_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(drand48_data)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__x) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(drand48_data), + "::", + stringify!(__x) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__old_x) as usize - ptr as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(drand48_data), + "::", + stringify!(__old_x) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__c) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(drand48_data), + "::", + stringify!(__c) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__init) as usize - ptr as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(drand48_data), + "::", + stringify!(__init) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__a) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(drand48_data), + "::", + stringify!(__a) + ) + ); +} +extern "C" { + pub fn drand48_r(__buffer: *mut drand48_data, __result: *mut f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn erand48_r( + __xsubi: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + __result: *mut f64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lrand48_r( + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nrand48_r( + __xsubi: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mrand48_r( + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn jrand48_r( + __xsubi: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand48_r( + __seedval: ::std::os::raw::c_long, + __buffer: *mut drand48_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn seed48_r( + __seed16v: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lcong48_r( + __param: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn arc4random() -> __uint32_t; +} +extern "C" { + pub fn arc4random_buf(__buf: *mut ::std::os::raw::c_void, __size: usize); +} +extern "C" { + pub fn arc4random_uniform(__upper_bound: __uint32_t) -> __uint32_t; +} +extern "C" { + pub fn malloc(__size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn calloc( + __nmemb: ::std::os::raw::c_ulong, + __size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn realloc( + __ptr: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn free(__ptr: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn reallocarray( + __ptr: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn alloca(__size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn valloc(__size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut ::std::os::raw::c_void, + __alignment: usize, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn aligned_alloc( + __alignment: ::std::os::raw::c_ulong, + __size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn abort() -> !; +} +extern "C" { + pub fn atexit(__func: ::std::option::Option) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn at_quick_exit( + __func: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn on_exit( + __func: ::std::option::Option< + unsafe extern "C" fn( + __status: ::std::os::raw::c_int, + __arg: *mut ::std::os::raw::c_void, + ), + >, + __arg: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn exit(__status: ::std::os::raw::c_int) -> !; +} +extern "C" { + pub fn quick_exit(__status: ::std::os::raw::c_int) -> !; +} +extern "C" { + pub fn _Exit(__status: ::std::os::raw::c_int) -> !; +} +extern "C" { + pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn putenv(__string: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setenv( + __name: *const ::std::os::raw::c_char, + __value: *const ::std::os::raw::c_char, + __replace: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearenv() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps( + __template: *mut ::std::os::raw::c_char, + __suffixlen: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn realpath( + __name: *const ::std::os::raw::c_char, + __resolved: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +pub type __compar_fn_t = ::std::option::Option< + unsafe extern "C" fn( + arg1: *const ::std::os::raw::c_void, + arg2: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn bsearch( + __key: *const ::std::os::raw::c_void, + __base: *const ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __compar: __compar_fn_t, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn qsort( + __base: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __compar: __compar_fn_t, + ); +} +extern "C" { + pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn div(__numer: ::std::os::raw::c_int, __denom: ::std::os::raw::c_int) -> div_t; +} +extern "C" { + pub fn ldiv(__numer: ::std::os::raw::c_long, __denom: ::std::os::raw::c_long) -> ldiv_t; +} +extern "C" { + pub fn lldiv( + __numer: ::std::os::raw::c_longlong, + __denom: ::std::os::raw::c_longlong, + ) -> lldiv_t; +} +extern "C" { + pub fn ecvt( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fcvt( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn gcvt( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn qecvt( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn qfcvt( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn qgcvt( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ecvt_r( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fcvt_r( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn qecvt_r( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn qfcvt_r( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbtowc( + __pwc: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wctomb(__s: *mut ::std::os::raw::c_char, __wchar: wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const ::std::os::raw::c_char, __n: usize) -> usize; +} +extern "C" { + pub fn wcstombs(__s: *mut ::std::os::raw::c_char, __pwcs: *const wchar_t, __n: usize) -> usize; +} +extern "C" { + pub fn rpmatch(__response: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsubopt( + __optionp: *mut *mut ::std::os::raw::c_char, + __tokens: *const *mut ::std::os::raw::c_char, + __valuep: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getloadavg(__loadavg: *mut f64, __nelem: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +pub type __gnuc_va_list = __builtin_va_list; +pub type va_list = __builtin_va_list; +extern "C" { + pub fn gnu_dev_major(__dev: __dev_t) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn gnu_dev_minor(__dev: __dev_t) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn gnu_dev_makedev( + __major: ::std::os::raw::c_uint, + __minor: ::std::os::raw::c_uint, + ) -> __dev_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_ref(udev: *mut udev) -> *mut udev; +} +extern "C" { + pub fn udev_unref(udev: *mut udev) -> *mut udev; +} +extern "C" { + pub fn udev_new() -> *mut udev; +} +extern "C" { + pub fn udev_set_log_fn( + udev: *mut udev, + log_fn: ::std::option::Option< + unsafe extern "C" fn( + udev: *mut udev, + priority: ::std::os::raw::c_int, + file: *const ::std::os::raw::c_char, + line: ::std::os::raw::c_int, + fn_: *const ::std::os::raw::c_char, + format: *const ::std::os::raw::c_char, + args: *mut __va_list_tag, + ), + >, + ); +} +extern "C" { + pub fn udev_get_log_priority(udev: *mut udev) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_set_log_priority(udev: *mut udev, priority: ::std::os::raw::c_int); +} +extern "C" { + pub fn udev_get_userdata(udev: *mut udev) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn udev_set_userdata(udev: *mut udev, userdata: *mut ::std::os::raw::c_void); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev_list_entry { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_list_entry_get_next(list_entry: *mut udev_list_entry) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_list_entry_get_by_name( + list_entry: *mut udev_list_entry, + name: *const ::std::os::raw::c_char, + ) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_list_entry_get_name( + list_entry: *mut udev_list_entry, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_list_entry_get_value( + list_entry: *mut udev_list_entry, + ) -> *const ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev_device { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_device_ref(udev_device: *mut udev_device) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_unref(udev_device: *mut udev_device) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_get_udev(udev_device: *mut udev_device) -> *mut udev; +} +extern "C" { + pub fn udev_device_new_from_syspath( + udev: *mut udev, + syspath: *const ::std::os::raw::c_char, + ) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_new_from_devnum( + udev: *mut udev, + type_: ::std::os::raw::c_char, + devnum: dev_t, + ) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_new_from_subsystem_sysname( + udev: *mut udev, + subsystem: *const ::std::os::raw::c_char, + sysname: *const ::std::os::raw::c_char, + ) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_new_from_device_id( + udev: *mut udev, + id: *const ::std::os::raw::c_char, + ) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_new_from_environment(udev: *mut udev) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_get_parent(udev_device: *mut udev_device) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_get_parent_with_subsystem_devtype( + udev_device: *mut udev_device, + subsystem: *const ::std::os::raw::c_char, + devtype: *const ::std::os::raw::c_char, + ) -> *mut udev_device; +} +extern "C" { + pub fn udev_device_get_devpath(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_subsystem( + udev_device: *mut udev_device, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_devtype(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_syspath(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_sysname(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_sysnum(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_devnode(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_is_initialized(udev_device: *mut udev_device) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_device_get_devlinks_list_entry( + udev_device: *mut udev_device, + ) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_device_get_properties_list_entry( + udev_device: *mut udev_device, + ) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_device_get_tags_list_entry(udev_device: *mut udev_device) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_device_get_current_tags_list_entry( + udev_device: *mut udev_device, + ) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_device_get_sysattr_list_entry( + udev_device: *mut udev_device, + ) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_device_get_property_value( + udev_device: *mut udev_device, + key: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_driver(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_devnum(udev_device: *mut udev_device) -> dev_t; +} +extern "C" { + pub fn udev_device_get_action(udev_device: *mut udev_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_get_seqnum(udev_device: *mut udev_device) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn udev_device_get_usec_since_initialized( + udev_device: *mut udev_device, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn udev_device_get_sysattr_value( + udev_device: *mut udev_device, + sysattr: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn udev_device_set_sysattr_value( + udev_device: *mut udev_device, + sysattr: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_device_has_tag( + udev_device: *mut udev_device, + tag: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_device_has_current_tag( + udev_device: *mut udev_device, + tag: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev_monitor { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_monitor_ref(udev_monitor: *mut udev_monitor) -> *mut udev_monitor; +} +extern "C" { + pub fn udev_monitor_unref(udev_monitor: *mut udev_monitor) -> *mut udev_monitor; +} +extern "C" { + pub fn udev_monitor_get_udev(udev_monitor: *mut udev_monitor) -> *mut udev; +} +extern "C" { + pub fn udev_monitor_new_from_netlink( + udev: *mut udev, + name: *const ::std::os::raw::c_char, + ) -> *mut udev_monitor; +} +extern "C" { + pub fn udev_monitor_enable_receiving(udev_monitor: *mut udev_monitor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_monitor_set_receive_buffer_size( + udev_monitor: *mut udev_monitor, + size: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_monitor_get_fd(udev_monitor: *mut udev_monitor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_monitor_receive_device(udev_monitor: *mut udev_monitor) -> *mut udev_device; +} +extern "C" { + pub fn udev_monitor_filter_add_match_subsystem_devtype( + udev_monitor: *mut udev_monitor, + subsystem: *const ::std::os::raw::c_char, + devtype: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_monitor_filter_add_match_tag( + udev_monitor: *mut udev_monitor, + tag: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_monitor_filter_update(udev_monitor: *mut udev_monitor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_monitor_filter_remove(udev_monitor: *mut udev_monitor) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev_enumerate { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_enumerate_ref(udev_enumerate: *mut udev_enumerate) -> *mut udev_enumerate; +} +extern "C" { + pub fn udev_enumerate_unref(udev_enumerate: *mut udev_enumerate) -> *mut udev_enumerate; +} +extern "C" { + pub fn udev_enumerate_get_udev(udev_enumerate: *mut udev_enumerate) -> *mut udev; +} +extern "C" { + pub fn udev_enumerate_new(udev: *mut udev) -> *mut udev_enumerate; +} +extern "C" { + pub fn udev_enumerate_add_match_subsystem( + udev_enumerate: *mut udev_enumerate, + subsystem: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_nomatch_subsystem( + udev_enumerate: *mut udev_enumerate, + subsystem: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_match_sysattr( + udev_enumerate: *mut udev_enumerate, + sysattr: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_nomatch_sysattr( + udev_enumerate: *mut udev_enumerate, + sysattr: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_match_property( + udev_enumerate: *mut udev_enumerate, + property: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_match_sysname( + udev_enumerate: *mut udev_enumerate, + sysname: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_match_tag( + udev_enumerate: *mut udev_enumerate, + tag: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_match_parent( + udev_enumerate: *mut udev_enumerate, + parent: *mut udev_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_match_is_initialized( + udev_enumerate: *mut udev_enumerate, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_add_syspath( + udev_enumerate: *mut udev_enumerate, + syspath: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_scan_devices( + udev_enumerate: *mut udev_enumerate, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_scan_subsystems( + udev_enumerate: *mut udev_enumerate, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_enumerate_get_list_entry( + udev_enumerate: *mut udev_enumerate, + ) -> *mut udev_list_entry; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev_queue { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_queue_ref(udev_queue: *mut udev_queue) -> *mut udev_queue; +} +extern "C" { + pub fn udev_queue_unref(udev_queue: *mut udev_queue) -> *mut udev_queue; +} +extern "C" { + pub fn udev_queue_get_udev(udev_queue: *mut udev_queue) -> *mut udev; +} +extern "C" { + pub fn udev_queue_new(udev: *mut udev) -> *mut udev_queue; +} +extern "C" { + pub fn udev_queue_get_kernel_seqnum(udev_queue: *mut udev_queue) + -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn udev_queue_get_udev_seqnum(udev_queue: *mut udev_queue) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn udev_queue_get_udev_is_active(udev_queue: *mut udev_queue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_queue_get_queue_is_empty(udev_queue: *mut udev_queue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_queue_get_seqnum_is_finished( + udev_queue: *mut udev_queue, + seqnum: ::std::os::raw::c_ulonglong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_queue_get_seqnum_sequence_is_finished( + udev_queue: *mut udev_queue, + start: ::std::os::raw::c_ulonglong, + end: ::std::os::raw::c_ulonglong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_queue_get_fd(udev_queue: *mut udev_queue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_queue_flush(udev_queue: *mut udev_queue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn udev_queue_get_queued_list_entry(udev_queue: *mut udev_queue) -> *mut udev_list_entry; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udev_hwdb { + _unused: [u8; 0], +} +extern "C" { + pub fn udev_hwdb_new(udev: *mut udev) -> *mut udev_hwdb; +} +extern "C" { + pub fn udev_hwdb_ref(hwdb: *mut udev_hwdb) -> *mut udev_hwdb; +} +extern "C" { + pub fn udev_hwdb_unref(hwdb: *mut udev_hwdb) -> *mut udev_hwdb; +} +extern "C" { + pub fn udev_hwdb_get_properties_list_entry( + hwdb: *mut udev_hwdb, + modalias: *const ::std::os::raw::c_char, + flags: ::std::os::raw::c_uint, + ) -> *mut udev_list_entry; +} +extern "C" { + pub fn udev_util_encode_string( + str_: *const ::std::os::raw::c_char, + str_enc: *mut ::std::os::raw::c_char, + len: usize, + ) -> ::std::os::raw::c_int; +} +#[doc = " @ingroup base\n @struct libinput\n\n A handle for accessing libinput. This struct is refcounted, use\n libinput_ref() and libinput_unref()."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput { + _unused: [u8; 0], +} +#[doc = " @ingroup device\n @struct libinput_device\n\n A base handle for accessing libinput devices. This struct is\n refcounted, use libinput_device_ref() and libinput_device_unref()."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_device { + _unused: [u8; 0], +} +#[doc = " @ingroup device\n @struct libinput_device_group\n\n A base handle for accessing libinput device groups. This struct is\n refcounted, use libinput_device_group_ref() and\n libinput_device_group_unref()."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_device_group { + _unused: [u8; 0], +} +#[doc = " @ingroup seat\n @struct libinput_seat\n\n The base handle for accessing libinput seats. This struct is\n refcounted, use libinput_seat_ref() and libinput_seat_unref()."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_seat { + _unused: [u8; 0], +} +#[doc = " @ingroup device\n @struct libinput_tablet_tool\n\n An object representing a tool being used by a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.\n\n Tablet events generated by such a device are bound to a specific tool\n rather than coming from the device directly. Depending on the hardware it\n is possible to track the same physical tool across multiple\n struct libinput_device devices.\n See libinput_tablet_tool_get_serial() for more details.\n\n This struct is refcounted, use libinput_tablet_tool_ref() and\n libinput_tablet_tool_unref().\n\n @since 1.2"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_tablet_tool { + _unused: [u8; 0], +} +#[doc = " @ingroup event\n @struct libinput_event\n\n The base event type. Use libinput_event_get_pointer_event() or similar to\n get the actual event type.\n\n @warning Unlike other structs events are considered transient and\n not refcounted."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event { + _unused: [u8; 0], +} +#[doc = " @ingroup event\n @struct libinput_event_device_notify\n\n An event notifying the caller of a device being added or removed."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_device_notify { + _unused: [u8; 0], +} +#[doc = " @ingroup event_keyboard\n @struct libinput_event_keyboard\n\n A keyboard event representing a key press/release."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_keyboard { + _unused: [u8; 0], +} +#[doc = " @ingroup event_pointer\n @struct libinput_event_pointer\n\n A pointer event representing relative or absolute pointer movement,\n a button press/release or scroll axis events."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_pointer { + _unused: [u8; 0], +} +#[doc = " @ingroup event_touch\n @struct libinput_event_touch\n\n Touch event representing a touch down, move or up, as well as a touch\n cancel and touch frame events. Valid event types for this event are @ref\n LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref\n LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref\n LIBINPUT_EVENT_TOUCH_FRAME."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_touch { + _unused: [u8; 0], +} +#[doc = " @ingroup event_tablet\n @struct libinput_event_tablet_tool\n\n Tablet tool event representing an axis update, button press, or tool\n update. Valid event types for this event are @ref\n LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY and @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @since 1.2"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_tablet_tool { + _unused: [u8; 0], +} +#[doc = " @ingroup event_tablet_pad\n @struct libinput_event_tablet_pad\n\n Tablet pad event representing a button press, or ring/strip update on\n the tablet pad itself. Valid event types for this event are @ref\n LIBINPUT_EVENT_TABLET_PAD_BUTTON, @ref LIBINPUT_EVENT_TABLET_PAD_RING and\n @ref LIBINPUT_EVENT_TABLET_PAD_STRIP.\n\n @since 1.3"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_tablet_pad { + _unused: [u8; 0], +} +pub const libinput_log_priority_LIBINPUT_LOG_PRIORITY_DEBUG: libinput_log_priority = 10; +pub const libinput_log_priority_LIBINPUT_LOG_PRIORITY_INFO: libinput_log_priority = 20; +pub const libinput_log_priority_LIBINPUT_LOG_PRIORITY_ERROR: libinput_log_priority = 30; +#[doc = " @ingroup base\n\n Log priority for internal logging messages."] +pub type libinput_log_priority = ::std::os::raw::c_uint; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_KEYBOARD: libinput_device_capability = 0; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_POINTER: libinput_device_capability = 1; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_TOUCH: libinput_device_capability = 2; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_TABLET_TOOL: libinput_device_capability = + 3; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_TABLET_PAD: libinput_device_capability = 4; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_GESTURE: libinput_device_capability = 5; +pub const libinput_device_capability_LIBINPUT_DEVICE_CAP_SWITCH: libinput_device_capability = 6; +#[doc = " @ingroup device\n\n Capabilities on a device. A device may have one or more capabilities\n at a time, capabilities remain static for the lifetime of the device."] +pub type libinput_device_capability = ::std::os::raw::c_uint; +pub const libinput_key_state_LIBINPUT_KEY_STATE_RELEASED: libinput_key_state = 0; +pub const libinput_key_state_LIBINPUT_KEY_STATE_PRESSED: libinput_key_state = 1; +#[doc = " @ingroup device\n\n Logical state of a key. Note that the logical state may not represent\n the physical state of the key."] +pub type libinput_key_state = ::std::os::raw::c_uint; +pub const libinput_led_LIBINPUT_LED_NUM_LOCK: libinput_led = 1; +pub const libinput_led_LIBINPUT_LED_CAPS_LOCK: libinput_led = 2; +pub const libinput_led_LIBINPUT_LED_SCROLL_LOCK: libinput_led = 4; +#[doc = " @ingroup device\n\n Mask reflecting LEDs on a device."] +pub type libinput_led = ::std::os::raw::c_uint; +pub const libinput_button_state_LIBINPUT_BUTTON_STATE_RELEASED: libinput_button_state = 0; +pub const libinput_button_state_LIBINPUT_BUTTON_STATE_PRESSED: libinput_button_state = 1; +#[doc = " @ingroup device\n\n Logical state of a physical button. Note that the logical state may not\n represent the physical state of the button."] +pub type libinput_button_state = ::std::os::raw::c_uint; +pub const libinput_pointer_axis_LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL: libinput_pointer_axis = 0; +pub const libinput_pointer_axis_LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL: libinput_pointer_axis = 1; +#[doc = " @ingroup device\n\n Axes on a device with the capability @ref LIBINPUT_DEVICE_CAP_POINTER\n that are not x or y coordinates.\n\n The two scroll axes @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and\n @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL are engaged separately,\n depending on the device. libinput provides some scroll direction locking\n but it is up to the caller to determine which axis is needed and\n appropriate in the current interaction"] +pub type libinput_pointer_axis = ::std::os::raw::c_uint; +#[doc = " The event is caused by the rotation of a wheel."] +pub const libinput_pointer_axis_source_LIBINPUT_POINTER_AXIS_SOURCE_WHEEL: + libinput_pointer_axis_source = 1; +#[doc = " The event is caused by the movement of one or more fingers on a\n device."] +pub const libinput_pointer_axis_source_LIBINPUT_POINTER_AXIS_SOURCE_FINGER: + libinput_pointer_axis_source = 2; +#[doc = " The event is caused by the motion of some device."] +pub const libinput_pointer_axis_source_LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS: + libinput_pointer_axis_source = 3; +#[doc = " The event is caused by the tilting of a mouse wheel rather than\n its rotation. This method is commonly used on mice without\n separate horizontal scroll wheels.\n\n @deprecated This axis source is deprecated as of libinput 1.16.\n It was never used by any device before libinput 1.16. All wheel\n tilt devices use @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL instead."] +pub const libinput_pointer_axis_source_LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: + libinput_pointer_axis_source = 4; +#[doc = " @ingroup device\n\n The source for a libinput_pointer_axis event. See\n libinput_event_pointer_get_axis_source() for details.\n\n @note Pointer axis sources are deprecated, the source is now encoded in\n the event types\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS."] +pub type libinput_pointer_axis_source = ::std::os::raw::c_uint; +pub const libinput_tablet_pad_ring_axis_source_LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN: + libinput_tablet_pad_ring_axis_source = 1; +#[doc = " The event is caused by the movement of one or more fingers on\n the ring."] +pub const libinput_tablet_pad_ring_axis_source_LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER: + libinput_tablet_pad_ring_axis_source = 2; +#[doc = " @ingroup event_tablet_pad\n\n The source for a @ref LIBINPUT_EVENT_TABLET_PAD_RING event. See\n libinput_event_tablet_pad_get_ring_source() for details.\n\n @since 1.3"] +pub type libinput_tablet_pad_ring_axis_source = ::std::os::raw::c_uint; +pub const libinput_tablet_pad_strip_axis_source_LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN: + libinput_tablet_pad_strip_axis_source = 1; +#[doc = " The event is caused by the movement of one or more fingers on\n the strip."] +pub const libinput_tablet_pad_strip_axis_source_LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER: + libinput_tablet_pad_strip_axis_source = 2; +#[doc = " @ingroup event_tablet_pad\n\n The source for a @ref LIBINPUT_EVENT_TABLET_PAD_STRIP event. See\n libinput_event_tablet_pad_get_strip_source() for details.\n\n @since 1.3"] +pub type libinput_tablet_pad_strip_axis_source = ::std::os::raw::c_uint; +#[doc = "< A generic pen"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_PEN: libinput_tablet_tool_type = 1; +#[doc = "< Eraser"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_ERASER: libinput_tablet_tool_type = 2; +#[doc = "< A paintbrush-like tool"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_BRUSH: libinput_tablet_tool_type = 3; +#[doc = "< Physical drawing tool, e.g.\nWacom Inking Pen"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_PENCIL: libinput_tablet_tool_type = 4; +#[doc = "< An airbrush-like tool"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: libinput_tablet_tool_type = + 5; +#[doc = "< A mouse bound to the tablet"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_MOUSE: libinput_tablet_tool_type = 6; +#[doc = "< A mouse tool with a lens"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_LENS: libinput_tablet_tool_type = 7; +#[doc = "< A rotary device with\npositional and rotation\ndata"] +pub const libinput_tablet_tool_type_LIBINPUT_TABLET_TOOL_TYPE_TOTEM: libinput_tablet_tool_type = 8; +#[doc = " @ingroup device\n\n Available tool types for a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. The tool type defines the default\n usage of the tool as advertised by the manufacturer. Multiple different\n physical tools may share the same tool type, e.g. a Wacom Classic Pen,\n Wacom Pro Pen and a Wacom Grip Pen are all of type @ref\n LIBINPUT_TABLET_TOOL_TYPE_PEN.\n Use libinput_tablet_tool_get_tool_id() to get a specific model where applicable.\n\n Note that on some device, the eraser tool is on the tail end of a pen\n device. On other devices, e.g. MS Surface 3, the eraser is the pen tip\n while a button is held down.\n\n @note The @ref libinput_tablet_tool_type can only describe the default physical\n type of the device. For devices with adjustable physical properties\n the tool type remains the same, i.e. putting a Wacom stroke nib into a\n classic pen leaves the tool type as @ref LIBINPUT_TABLET_TOOL_TYPE_PEN.\n\n @since 1.2"] +pub type libinput_tablet_tool_type = ::std::os::raw::c_uint; +pub const libinput_tablet_tool_proximity_state_LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT: + libinput_tablet_tool_proximity_state = 0; +pub const libinput_tablet_tool_proximity_state_LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN: + libinput_tablet_tool_proximity_state = 1; +#[doc = " @ingroup device\n\n The state of proximity for a tool on a device. The device must have the @ref\n LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.\n\n The proximity of a tool is a binary state signalling whether the tool is\n within a detectable distance of the tablet device. A tool that is out of\n proximity cannot generate events.\n\n On some hardware a tool goes out of proximity when it ceases to touch the\n surface. On other hardware, the tool is still detectable within a short\n distance (a few cm) off the surface.\n\n @since 1.2"] +pub type libinput_tablet_tool_proximity_state = ::std::os::raw::c_uint; +pub const libinput_tablet_tool_tip_state_LIBINPUT_TABLET_TOOL_TIP_UP: + libinput_tablet_tool_tip_state = 0; +pub const libinput_tablet_tool_tip_state_LIBINPUT_TABLET_TOOL_TIP_DOWN: + libinput_tablet_tool_tip_state = 1; +#[doc = " @ingroup device\n\n The tip contact state for a tool on a device. The device must have\n the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.\n\n The tip contact state of a tool is a binary state signalling whether the tool is\n touching the surface of the tablet device.\n\n @since 1.2"] +pub type libinput_tablet_tool_tip_state = ::std::os::raw::c_uint; +#[doc = " @ingroup tablet_pad_modes\n @struct libinput_tablet_pad_mode_group\n\n A mode on a tablet pad is a virtual grouping of functionality, usually\n based on some visual feedback like LEDs on the pad. The set of buttons,\n rings and strips that share the same mode are a \"mode group\". Whenever\n the mode changes, all buttons, rings and strips within this mode group\n are affected.\n\n Most tablets only have a single mode group, some tablets provide multiple\n mode groups through independent banks of LEDs (e.g. the Wacom Cintiq\n 24HD). libinput guarantees that at least one mode group is always\n available.\n\n This struct is refcounted, use libinput_tablet_pad_mode_group_ref() and\n libinput_tablet_pad_mode_group_unref().\n\n @since 1.4"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_tablet_pad_mode_group { + _unused: [u8; 0], +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Most devices only provide a single mode group, however devices such as\n the Wacom Cintiq 22HD provide two mode groups. If multiple mode groups\n are available, a caller should use\n libinput_tablet_pad_mode_group_has_button(),\n libinput_tablet_pad_mode_group_has_ring() and\n libinput_tablet_pad_mode_group_has_strip() to associate each button,\n ring and strip with the correct mode group.\n\n @return the number of mode groups available on this device\n\n @since 1.4"] + pub fn libinput_device_tablet_pad_get_num_mode_groups( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n The returned mode group is not refcounted and may become invalid after\n the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and\n libinput_tablet_pad_mode_group_unref() to continue using the handle\n outside of the immediate scope.\n\n While at least one reference is kept by the caller, the returned mode\n group will be identical for each subsequent call of this function with\n the same index and that same struct is returned from\n libinput_event_tablet_pad_get_mode_group(), provided the event was\n generated by this mode group.\n\n @param device A device with the @ref LIBINPUT_DEVICE_CAP_TABLET_PAD\n capability\n @param index A mode group index\n @return the mode group with the given index or NULL if an invalid index\n is given.\n\n @since 1.4"] + pub fn libinput_device_tablet_pad_get_mode_group( + device: *mut libinput_device, + index: ::std::os::raw::c_uint, + ) -> *mut libinput_tablet_pad_mode_group; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n The returned number is the same index as passed to\n libinput_device_tablet_pad_get_mode_group(). For tablets with only one\n mode this number is always 0.\n\n @param group A previously obtained mode group\n @return the numeric index this mode group represents, starting at 0\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_get_index( + group: *mut libinput_tablet_pad_mode_group, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Query the mode group for the number of available modes. The number of\n modes is usually decided by the number of physical LEDs available on the\n device. Different mode groups may have a different number of modes. Use\n libinput_tablet_pad_mode_group_get_mode() to get the currently active\n mode.\n\n libinput guarantees that at least one mode is available. A device without\n mode switching capability has a single mode group and a single mode.\n\n @param group A previously obtained mode group\n @return the number of modes available in this mode group\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_get_num_modes( + group: *mut libinput_tablet_pad_mode_group, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Return the current mode this mode group is in. Note that the returned\n mode is the mode valid as of completing the last libinput_dispatch().\n The returned mode may thus be different than the mode returned by\n libinput_event_tablet_pad_get_mode().\n\n For example, if the mode was toggled three times between the call to\n libinput_dispatch(), this function returns the third mode but the events\n in the event queue will return the modes 1, 2 and 3, respectively.\n\n @param group A previously obtained mode group\n @return the numeric index of the current mode in this group, starting at 0\n\n @see libinput_event_tablet_pad_get_mode\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_get_mode( + group: *mut libinput_tablet_pad_mode_group, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Devices without mode switching capabilities return true for every button.\n\n @param group A previously obtained mode group\n @param button A button index, starting at 0\n @return true if the given button index is part of this mode group or\n false otherwise\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_has_button( + group: *mut libinput_tablet_pad_mode_group, + button: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Devices without mode switching capabilities return true for every ring.\n\n @param group A previously obtained mode group\n @param ring A ring index, starting at 0\n @return true if the given ring index is part of this mode group or\n false otherwise\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_has_ring( + group: *mut libinput_tablet_pad_mode_group, + ring: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Devices without mode switching capabilities return true for every strip.\n\n @param group A previously obtained mode group\n @param strip A strip index, starting at 0\n @return true if the given strip index is part of this mode group or\n false otherwise\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_has_strip( + group: *mut libinput_tablet_pad_mode_group, + strip: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n The toggle button in a mode group is the button assigned to cycle to or\n directly assign a new mode when pressed. Not all devices have a toggle\n button and some devices may have more than one toggle button. For\n example, the Wacom Cintiq 24HD has six toggle buttons in two groups, each\n directly selecting one of the three modes per group.\n\n Devices without mode switching capabilities return false for every button.\n\n @param group A previously obtained mode group\n @param button A button index, starting at 0\n @retval non-zero if the button is a mode toggle button for this group, or\n zero otherwise\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_button_is_toggle( + group: *mut libinput_tablet_pad_mode_group, + button: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Increase the refcount of the mode group. A mode group will be\n freed whenever the refcount reaches 0.\n\n @param group A previously obtained mode group\n @return The passed mode group\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_ref( + group: *mut libinput_tablet_pad_mode_group, + ) -> *mut libinput_tablet_pad_mode_group; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Decrease the refcount of the mode group. A mode group will be\n freed whenever the refcount reaches 0.\n\n @param group A previously obtained mode group\n @return NULL if the group was destroyed, otherwise the passed mode group\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_unref( + group: *mut libinput_tablet_pad_mode_group, + ) -> *mut libinput_tablet_pad_mode_group; +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Set caller-specific data associated with this mode group. libinput does\n not manage, look at, or modify this data. The caller must ensure the\n data is valid.\n\n @param group A previously obtained mode group\n @param user_data Caller-specific data pointer\n @see libinput_tablet_pad_mode_group_get_user_data\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_set_user_data( + group: *mut libinput_tablet_pad_mode_group, + user_data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + #[doc = " @ingroup tablet_pad_modes\n\n Get the caller-specific data associated with this mode group, if any.\n\n @param group A previously obtained mode group\n @return Caller-specific data pointer or NULL if none was set\n @see libinput_tablet_pad_mode_group_set_user_data\n\n @since 1.4"] + pub fn libinput_tablet_pad_mode_group_get_user_data( + group: *mut libinput_tablet_pad_mode_group, + ) -> *mut ::std::os::raw::c_void; +} +pub const libinput_switch_state_LIBINPUT_SWITCH_STATE_OFF: libinput_switch_state = 0; +pub const libinput_switch_state_LIBINPUT_SWITCH_STATE_ON: libinput_switch_state = 1; +#[doc = " @ingroup device\n\n The state of a switch. The default state of a switch is @ref\n LIBINPUT_SWITCH_STATE_OFF and no event is sent to confirm a switch in the\n off position. If a switch is logically on during initialization, libinput\n sends an event of type @ref LIBINPUT_EVENT_SWITCH_TOGGLE with a state\n @ref LIBINPUT_SWITCH_STATE_ON.\n\n @since 1.7"] +pub type libinput_switch_state = ::std::os::raw::c_uint; +#[doc = " The laptop lid was closed when the switch state is @ref\n LIBINPUT_SWITCH_STATE_ON, or was opened when it is @ref\n LIBINPUT_SWITCH_STATE_OFF."] +pub const libinput_switch_LIBINPUT_SWITCH_LID: libinput_switch = 1; +#[doc = " This switch indicates whether the device is in normal laptop mode\n or behaves like a tablet-like device where the primary\n interaction is usually a touch screen. When in tablet mode, the\n keyboard and touchpad are usually inaccessible.\n\n If the switch is in state @ref LIBINPUT_SWITCH_STATE_OFF, the\n device is in laptop mode. If the switch is in state @ref\n LIBINPUT_SWITCH_STATE_ON, the device is in tablet mode and the\n keyboard or touchpad may not be accessible.\n\n It is up to the caller to identify which devices are inaccessible\n in tablet mode."] +pub const libinput_switch_LIBINPUT_SWITCH_TABLET_MODE: libinput_switch = 2; +#[doc = " @ingroup device\n\n The type of a switch.\n\n @since 1.7"] +pub type libinput_switch = ::std::os::raw::c_uint; +#[doc = " @ingroup event_switch\n @struct libinput_event_switch\n\n A switch event representing a changed state in a switch.\n\n @since 1.7"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_switch { + _unused: [u8; 0], +} +#[doc = " This is not a real event type, and is only used to tell the user that\n no new event is available in the queue. See\n libinput_next_event_type()."] +pub const libinput_event_type_LIBINPUT_EVENT_NONE: libinput_event_type = 0; +#[doc = " Signals that a device has been added to the context. The device will\n not be read until the next time the user calls libinput_dispatch()\n and data is available.\n\n This allows setting up initial device configuration before any events\n are created."] +pub const libinput_event_type_LIBINPUT_EVENT_DEVICE_ADDED: libinput_event_type = 1; +#[doc = " Signals that a device has been removed. No more events from the\n associated device will be in the queue or be queued after this event."] +pub const libinput_event_type_LIBINPUT_EVENT_DEVICE_REMOVED: libinput_event_type = 2; +#[doc = " Signals that a device has been removed. No more events from the\n associated device will be in the queue or be queued after this event."] +pub const libinput_event_type_LIBINPUT_EVENT_KEYBOARD_KEY: libinput_event_type = 300; +#[doc = " Signals that a device has been removed. No more events from the\n associated device will be in the queue or be queued after this event."] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_MOTION: libinput_event_type = 400; +#[doc = " Signals that a device has been removed. No more events from the\n associated device will be in the queue or be queued after this event."] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: libinput_event_type = 401; +#[doc = " Signals that a device has been removed. No more events from the\n associated device will be in the queue or be queued after this event."] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_BUTTON: libinput_event_type = 402; +#[doc = " A scroll event from various sources.\n\n This event is deprecated as of libinput 1.19. Use\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS instead.\n\n Use libinput_event_pointer_get_axis_source() to determine the\n source of a scroll event. For libinput versions 1.19 and later,\n the source is encoded in the event type.\n\n This event is sent **in addition** to events of type\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.\n Do not mix and match, either use the old event or the new events.\n libinput makes no guarantee about the relation between\n @ref LIBINPUT_EVENT_POINTER_AXIS and the new event types\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. You may receive\n multiple zero, one or more new events per legacy event.\n\n @warning Ignore this event if you are processing\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS."] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_AXIS: libinput_event_type = 403; +#[doc = " A scroll event from a wheel. This event is sent is sent **in\n addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS\n event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_WHEEL. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_SCROLL_WHEEL: libinput_event_type = 404; +#[doc = " A scroll event caused by the movement of one or more fingers on a\n device. This event is sent is sent **in addition** to the @ref\n LIBINPUT_EVENT_POINTER_AXIS event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_FINGER. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_SCROLL_FINGER: libinput_event_type = 405; +#[doc = " A scroll event from a continuous scroll source, e.g. button\n scrolling. This event is sent is sent **in\n addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS\n event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS: libinput_event_type = 406; +#[doc = " A scroll event from a continuous scroll source, e.g. button\n scrolling. This event is sent is sent **in\n addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS\n event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_TOUCH_DOWN: libinput_event_type = 500; +#[doc = " A scroll event from a continuous scroll source, e.g. button\n scrolling. This event is sent is sent **in\n addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS\n event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_TOUCH_UP: libinput_event_type = 501; +#[doc = " A scroll event from a continuous scroll source, e.g. button\n scrolling. This event is sent is sent **in\n addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS\n event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_TOUCH_MOTION: libinput_event_type = 502; +#[doc = " A scroll event from a continuous scroll source, e.g. button\n scrolling. This event is sent is sent **in\n addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS\n event for all events with a\n libinput_event_pointer_get_axis_source() of @ref\n LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref\n LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.\n\n See the libinput documentation for details.\n\n @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_TOUCH_CANCEL: libinput_event_type = 503; +#[doc = " Signals the end of a set of touchpoints at one device sample\n time. This event has no coordinate information attached."] +pub const libinput_event_type_LIBINPUT_EVENT_TOUCH_FRAME: libinput_event_type = 504; +#[doc = " One or more axes have changed state on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. This event is only sent\n when the tool is in proximity, see @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for details.\n\n The proximity event contains the initial state of the axis as the\n tool comes into proximity. An event of type @ref\n LIBINPUT_EVENT_TABLET_TOOL_AXIS is only sent when an axis value\n changes from this initial state. It is possible for a tool to\n enter and leave proximity without sending an event of type @ref\n LIBINPUT_EVENT_TABLET_TOOL_AXIS.\n\n An event of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS is sent\n when the tip state does not change. See the documentation for\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP for more details.\n\n @since 1.2"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_TOOL_AXIS: libinput_event_type = 600; +#[doc = " Signals that a tool has come in or out of proximity of a device with\n the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.\n\n Proximity events contain each of the current values for each axis,\n and these values may be extracted from them in the same way they are\n with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events.\n\n Some tools may always be in proximity. For these tools, events of\n type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN are sent only once after @ref\n LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref\n LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT are sent only once before @ref\n LIBINPUT_EVENT_DEVICE_REMOVED.\n\n If the tool that comes into proximity supports x/y coordinates,\n libinput guarantees that both x and y are set in the proximity\n event.\n\n When a tool goes out of proximity, the value of every axis should be\n assumed to have an undefined state and any buttons that are currently held\n down on the stylus are marked as released. Button release events for\n each button that was held down on the stylus are sent before the\n proximity out event.\n\n @since 1.2"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: libinput_event_type = 601; +#[doc = " Signals that a tool has come in contact with the surface of a\n device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.\n\n On devices without distance proximity detection, the @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP is sent immediately after @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for the tip down event, and\n immediately before for the tip up event.\n\n The decision when a tip touches the surface is device-dependent\n and may be derived from pressure data or other means. If the tip\n state is changed by axes changing state, the\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP event includes the changed\n axes and no additional axis event is sent for this state change.\n In other words, a caller must look at both @ref\n LIBINPUT_EVENT_TABLET_TOOL_AXIS and @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP events to know the current state\n of the axes.\n\n If a button state change occurs at the same time as a tip state\n change, the order of events is device-dependent.\n\n @since 1.2"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_TOOL_TIP: libinput_event_type = 602; +#[doc = " Signals that a tool has changed a logical button state on a\n device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.\n\n Button state changes occur on their own and do not include axis\n state changes. If button and axis state changes occur within the\n same logical hardware event, the order of the @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON and @ref\n LIBINPUT_EVENT_TABLET_TOOL_AXIS event is device-specific.\n\n This event is not to be confused with the button events emitted\n by the tablet pad. See @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON.\n\n @see LIBINPUT_EVENT_TABLET_PAD_BUTTON\n\n @since 1.2"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_TOOL_BUTTON: libinput_event_type = 603; +#[doc = " A button pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A button differs from @ref LIBINPUT_EVENT_TABLET_PAD_KEY in that\n buttons are sequentially indexed from 0 and do not carry any\n other information. Keys have a specific functionality assigned\n to them. The key code thus carries a semantic meaning, a button\n number does not.\n\n This event is not to be confused with the button events emitted\n by tools on a tablet (@ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON).\n\n @since 1.3"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_PAD_BUTTON: libinput_event_type = 700; +#[doc = " A status change on a tablet ring with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n @since 1.3"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_PAD_RING: libinput_event_type = 701; +#[doc = " A status change on a strip on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n @since 1.3"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_PAD_STRIP: libinput_event_type = 702; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_TABLET_PAD_KEY: libinput_event_type = 703; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: libinput_event_type = 800; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: libinput_event_type = 801; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_SWIPE_END: libinput_event_type = 802; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: libinput_event_type = 803; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: libinput_event_type = 804; +#[doc = " A key pressed on a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n\n A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that\n keys have a specific functionality assigned to them (buttons are\n sequentially ordered). The key code thus carries a semantic\n meaning, a button number does not.\n\n @since 1.15"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_PINCH_END: libinput_event_type = 805; +#[doc = " @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_HOLD_BEGIN: libinput_event_type = 806; +#[doc = " @since 1.19"] +pub const libinput_event_type_LIBINPUT_EVENT_GESTURE_HOLD_END: libinput_event_type = 807; +#[doc = " @since 1.7"] +pub const libinput_event_type_LIBINPUT_EVENT_SWITCH_TOGGLE: libinput_event_type = 900; +#[doc = " @ingroup base\n\n Event type for events returned by libinput_get_event()."] +pub type libinput_event_type = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup event\n\n Destroy the event, freeing all associated resources. Resources obtained\n from this event must be considered invalid after this call.\n\n @warning Unlike other structs events are considered transient and\n not refcounted. Calling libinput_event_destroy() will\n destroy the event.\n\n @param event An event retrieved by libinput_get_event()."] + pub fn libinput_event_destroy(event: *mut libinput_event); +} +extern "C" { + #[doc = " @ingroup event\n\n Get the type of the event.\n\n @param event An event retrieved by libinput_get_event()."] + pub fn libinput_event_get_type(event: *mut libinput_event) -> libinput_event_type; +} +extern "C" { + #[doc = " @ingroup event\n\n Get the libinput context from the event.\n\n @param event The libinput event\n @return The libinput context for this event."] + pub fn libinput_event_get_context(event: *mut libinput_event) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the device associated with this event. For device added/removed\n events this is the device added or removed. For all other device events,\n this is the device that generated the event.\n\n This device is not refcounted and its lifetime is that of the event. Use\n libinput_device_ref() before using the device outside of this scope.\n\n @return The device associated with this event"] + pub fn libinput_event_get_device(event: *mut libinput_event) -> *mut libinput_device; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the pointer event that is this input event. If the event type does\n not match the pointer event types, this function returns NULL.\n\n The inverse of this function is libinput_event_pointer_get_base_event().\n\n @return A pointer event, or NULL for other events"] + pub fn libinput_event_get_pointer_event( + event: *mut libinput_event, + ) -> *mut libinput_event_pointer; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the keyboard event that is this input event. If the event type does\n not match the keyboard event types, this function returns NULL.\n\n The inverse of this function is libinput_event_keyboard_get_base_event().\n\n @return A keyboard event, or NULL for other events"] + pub fn libinput_event_get_keyboard_event( + event: *mut libinput_event, + ) -> *mut libinput_event_keyboard; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the touch event that is this input event. If the event type does\n not match the touch event types, this function returns NULL.\n\n The inverse of this function is libinput_event_touch_get_base_event().\n\n @return A touch event, or NULL for other events"] + pub fn libinput_event_get_touch_event(event: *mut libinput_event) -> *mut libinput_event_touch; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_event_gesture { + _unused: [u8; 0], +} +extern "C" { + #[doc = " @ingroup event\n\n Return the gesture event that is this input event. If the event type does\n not match the gesture event types, this function returns NULL.\n\n A gesture's lifetime has three distinct stages: begin, update and end, each\n with their own event types. Begin is sent when the fingers are first set\n down or libinput decides that the gesture begins. For @ref\n LIBINPUT_EVENT_GESTURE_PINCH_BEGIN this sets the initial scale. Any\n events changing properties of the gesture are sent as update events. On\n termination of the gesture, an end event is sent.\n\n The inverse of this function is libinput_event_gesture_get_base_event().\n\n @return A gesture event, or NULL for other events"] + pub fn libinput_event_get_gesture_event( + event: *mut libinput_event, + ) -> *mut libinput_event_gesture; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the tablet tool event that is this input event. If the event type\n does not match the tablet tool event types, this function returns NULL.\n\n The inverse of this function is libinput_event_tablet_tool_get_base_event().\n\n @return A tablet tool event, or NULL for other events\n\n @since 1.2"] + pub fn libinput_event_get_tablet_tool_event( + event: *mut libinput_event, + ) -> *mut libinput_event_tablet_tool; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the tablet pad event that is this input event. If the event type does not\n match the tablet pad event types, this function returns NULL.\n\n The inverse of this function is libinput_event_tablet_pad_get_base_event().\n\n @return A tablet pad event, or NULL for other events"] + pub fn libinput_event_get_tablet_pad_event( + event: *mut libinput_event, + ) -> *mut libinput_event_tablet_pad; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the switch event that is this input event. If the event type does\n not match the switch event types, this function returns NULL.\n\n The inverse of this function is libinput_event_switch_get_base_event().\n\n @return A switch event, or NULL for other events\n\n @since 1.7"] + pub fn libinput_event_get_switch_event( + event: *mut libinput_event, + ) -> *mut libinput_event_switch; +} +extern "C" { + #[doc = " @ingroup event\n\n Return the device event that is this input event. If the event type does\n not match the device event types, this function returns NULL.\n\n The inverse of this function is\n libinput_event_device_notify_get_base_event().\n\n @return A device event, or NULL for other events"] + pub fn libinput_event_get_device_notify_event( + event: *mut libinput_event, + ) -> *mut libinput_event_device_notify; +} +extern "C" { + #[doc = " @ingroup event\n\n @return The generic libinput_event of this event"] + pub fn libinput_event_device_notify_get_base_event( + event: *mut libinput_event_device_notify, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_keyboard\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event"] + pub fn libinput_event_keyboard_get_time(event: *mut libinput_event_keyboard) -> u32; +} +extern "C" { + #[doc = " @ingroup event_keyboard\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event in microseconds"] + pub fn libinput_event_keyboard_get_time_usec(event: *mut libinput_event_keyboard) -> u64; +} +extern "C" { + #[doc = " @ingroup event_keyboard\n\n @return The keycode that triggered this key event"] + pub fn libinput_event_keyboard_get_key(event: *mut libinput_event_keyboard) -> u32; +} +extern "C" { + #[doc = " @ingroup event_keyboard\n\n @return The state change of the key"] + pub fn libinput_event_keyboard_get_key_state( + event: *mut libinput_event_keyboard, + ) -> libinput_key_state; +} +extern "C" { + #[doc = " @ingroup event_keyboard\n\n @return The generic libinput_event of this event"] + pub fn libinput_event_keyboard_get_base_event( + event: *mut libinput_event_keyboard, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_keyboard\n\n For the key of a @ref LIBINPUT_EVENT_KEYBOARD_KEY event, return the total number\n of keys pressed on all devices on the associated seat after the event was\n triggered.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_KEYBOARD_KEY. For other events, this function returns 0.\n\n @return The seat wide pressed key count for the key of this event"] + pub fn libinput_event_keyboard_get_seat_key_count(event: *mut libinput_event_keyboard) -> u32; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event"] + pub fn libinput_event_pointer_get_time(event: *mut libinput_event_pointer) -> u32; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event in microseconds"] + pub fn libinput_event_pointer_get_time_usec(event: *mut libinput_event_pointer) -> u64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the delta between the last event and the current event. For pointer\n events that are not of type @ref LIBINPUT_EVENT_POINTER_MOTION, this\n function returns 0.\n\n If a device employs pointer acceleration, the delta returned by this\n function is the accelerated delta.\n\n Relative motion deltas are to be interpreted as pixel movement of a\n standardized mouse. See the libinput documentation for more details.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION.\n\n @return The relative x movement since the last event"] + pub fn libinput_event_pointer_get_dx(event: *mut libinput_event_pointer) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the delta between the last event and the current event. For pointer\n events that are not of type @ref LIBINPUT_EVENT_POINTER_MOTION, this\n function returns 0.\n\n If a device employs pointer acceleration, the delta returned by this\n function is the accelerated delta.\n\n Relative motion deltas are to be interpreted as pixel movement of a\n standardized mouse. See the libinput documentation for more details.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION.\n\n @return The relative y movement since the last event"] + pub fn libinput_event_pointer_get_dy(event: *mut libinput_event_pointer) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the relative delta of the unaccelerated motion vector of the\n current event. For pointer events that are not of type @ref\n LIBINPUT_EVENT_POINTER_MOTION, this function returns 0.\n\n Relative unaccelerated motion deltas are raw device coordinates.\n Note that these coordinates are subject to the device's native\n resolution. Touchpad coordinates represent raw device coordinates in the\n X resolution of the touchpad. See the libinput documentation for more\n details.\n\n Any rotation applied to the device also applies to unaccelerated motion\n (see libinput_device_config_rotation_set_angle()).\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION.\n\n @return The unaccelerated relative x movement since the last event"] + pub fn libinput_event_pointer_get_dx_unaccelerated(event: *mut libinput_event_pointer) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the relative delta of the unaccelerated motion vector of the\n current event. For pointer events that are not of type @ref\n LIBINPUT_EVENT_POINTER_MOTION, this function returns 0.\n\n Relative unaccelerated motion deltas are raw device coordinates.\n Note that these coordinates are subject to the device's native\n resolution. Touchpad coordinates represent raw device coordinates in the\n X resolution of the touchpad. See the libinput documentation for more\n details.\n\n Any rotation applied to the device also applies to unaccelerated motion\n (see libinput_device_config_rotation_set_angle()).\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION.\n\n @return The unaccelerated relative y movement since the last event"] + pub fn libinput_event_pointer_get_dy_unaccelerated(event: *mut libinput_event_pointer) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the current absolute x coordinate of the pointer event, in mm from\n the top left corner of the device. To get the corresponding output screen\n coordinate, use libinput_event_pointer_get_absolute_x_transformed().\n\n For pointer events that are not of type\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.\n\n @return The current absolute x coordinate"] + pub fn libinput_event_pointer_get_absolute_x(event: *mut libinput_event_pointer) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the current absolute y coordinate of the pointer event, in mm from\n the top left corner of the device. To get the corresponding output screen\n coordinate, use libinput_event_pointer_get_absolute_y_transformed().\n\n For pointer events that are not of type\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.\n\n @return The current absolute y coordinate"] + pub fn libinput_event_pointer_get_absolute_y(event: *mut libinput_event_pointer) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the current absolute x coordinate of the pointer event, transformed to\n screen coordinates.\n\n For pointer events that are not of type\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this\n function is undefined.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.\n\n @param event The libinput pointer event\n @param width The current output screen width\n @return The current absolute x coordinate transformed to a screen coordinate"] + pub fn libinput_event_pointer_get_absolute_x_transformed( + event: *mut libinput_event_pointer, + width: u32, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the current absolute y coordinate of the pointer event, transformed to\n screen coordinates.\n\n For pointer events that are not of type\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this function is\n undefined.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.\n\n @param event The libinput pointer event\n @param height The current output screen height\n @return The current absolute y coordinate transformed to a screen coordinate"] + pub fn libinput_event_pointer_get_absolute_y_transformed( + event: *mut libinput_event_pointer, + height: u32, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the button that triggered this event.\n For pointer events that are not of type @ref\n LIBINPUT_EVENT_POINTER_BUTTON, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_BUTTON.\n\n @return The button triggering this event"] + pub fn libinput_event_pointer_get_button(event: *mut libinput_event_pointer) -> u32; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the button state that triggered this event.\n For pointer events that are not of type @ref\n LIBINPUT_EVENT_POINTER_BUTTON, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_BUTTON.\n\n @return The button state triggering this event"] + pub fn libinput_event_pointer_get_button_state( + event: *mut libinput_event_pointer, + ) -> libinput_button_state; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n For the button of a @ref LIBINPUT_EVENT_POINTER_BUTTON event, return the\n total number of buttons pressed on all devices on the associated seat\n after the event was triggered.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_BUTTON. For other events, this function\n returns 0.\n\n @return The seat wide pressed button count for the key of this event"] + pub fn libinput_event_pointer_get_seat_button_count(event: *mut libinput_event_pointer) -> u32; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Check if the event has a valid value for the given axis.\n\n If this function returns non-zero for an axis and\n libinput_event_pointer_get_axis_value() returns a value of 0, the event\n is a scroll stop event.\n\n For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, @ref\n LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or @ref\n LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_AXIS,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.\n\n @return Non-zero if this event contains a value for this axis"] + pub fn libinput_event_pointer_has_axis( + event: *mut libinput_event_pointer, + axis: libinput_pointer_axis, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the axis value of the given axis. The interpretation of the value\n depends on the axis. For the two scrolling axes\n @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and\n @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in\n relative scroll units, with the positive direction being down or right,\n respectively. For the interpretation of the value, see\n libinput_event_pointer_get_axis_source().\n\n If libinput_event_pointer_has_axis() returns 0 for an axis, this function\n returns 0 for that axis.\n\n For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,\n this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_AXIS.\n\n @return The axis value of this event\n\n @see libinput_event_pointer_get_axis_value_discrete"] + pub fn libinput_event_pointer_get_axis_value( + event: *mut libinput_event_pointer, + axis: libinput_pointer_axis, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the source for a given axis event. Axis events (scroll events) can\n be caused by a hardware item such as a scroll wheel or emulated from\n other input sources, such as two-finger or edge scrolling on a\n touchpad.\n\n If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_FINGER, libinput\n guarantees that a scroll sequence is terminated with a scroll value of 0.\n A caller may use this information to decide on whether kinetic scrolling\n should be triggered on this scroll sequence.\n The coordinate system is identical to the cursor movement, i.e. a\n scroll value of 1 represents the equivalent relative motion of 1.\n\n If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, no terminating\n event is guaranteed (though it may happen).\n Scrolling is in discrete steps, the value is the angle the wheel moved\n in degrees. The default is 15 degrees per wheel click, but some mice may\n have differently grained wheels. It is up to the caller how to interpret\n such different step sizes. Callers should use\n libinput_event_pointer_get_scroll_value_v120() for a simpler API of\n handling scroll wheel events of different step sizes.\n\n If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, libinput\n guarantees that a scroll sequence is terminated with a scroll value of 0.\n The coordinate system is identical to the cursor movement, i.e. a\n scroll value of 1 represents the equivalent relative motion of 1.\n\n @deprecated The source @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT is\n deprecated as of libinput 1.16. No device has ever sent this source.\n\n For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,\n this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_AXIS.\n\n @note This function is superfluous as of libinput 1.19. The event\n codes for @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, @ref\n LIBINPUT_EVENT_POINTER_SCROLL_FINGER and @ref\n LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS have the axis source encoded in\n the event type.\n\n @return The source for this axis event"] + pub fn libinput_event_pointer_get_axis_source( + event: *mut libinput_event_pointer, + ) -> libinput_pointer_axis_source; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the axis value in discrete steps for a given axis event. How a\n value translates into a discrete step depends on the source.\n\n @note This function does not support high-resolution mouse wheels and\n should be considered deprecated as of libinput 1.19. Callers should use\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL and\n libinput_event_pointer_get_scroll_value_v120() instead.\n\n If the event is not of type @ref LIBINPUT_EVENT_POINTER_AXIS, this\n function returns 0.\n\n If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, the discrete\n value correspond to the number of physical mouse wheel clicks.\n\n If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS or @ref\n LIBINPUT_POINTER_AXIS_SOURCE_FINGER, the discrete value is always 0.\n\n @return The discrete value for the given event.\n\n @see libinput_event_pointer_get_axis_value\n @see libinput_event_pointer_get_scroll_value_v120"] + pub fn libinput_event_pointer_get_axis_value_discrete( + event: *mut libinput_event_pointer, + axis: libinput_pointer_axis, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n Return the axis value of the given axis. The interpretation of the value\n depends on the axis. For the two scrolling axes\n @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and\n @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in\n relative scroll units, with the positive direction being down or right,\n respectively. If libinput_event_pointer_has_axis() returns 0 for an axis,\n this function returns 0 for that axis.\n\n If the event is @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, libinput\n guarantees that a scroll sequence is terminated with a scroll value of 0.\n A caller may use this information to decide on whether kinetic scrolling\n should be triggered on this scroll sequence.\n The coordinate system is identical to the cursor movement, i.e. a\n scroll value of 1 represents the equivalent relative motion of 1.\n\n If the event is @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, no terminating\n event is guaranteed (though it may happen).\n Scrolling is in discrete steps, the value is the angle the wheel moved\n in degrees. The default is 15 degrees per wheel click, but some mice may\n have differently grained wheels. It is up to the caller how to interpret\n such different step sizes. Callers should use\n libinput_event_pointer_get_scroll_value_v120() for a simpler API of\n handling scroll wheel events of different step sizes.\n\n If the event is @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS, libinput\n guarantees that a scroll sequence is terminated with a scroll value of 0.\n The coordinate system is identical to the cursor movement, i.e. a\n scroll value of 1 represents the equivalent relative motion of 1.\n\n For pointer events that are not of type\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS, this function returns zero.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,\n @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, or\n @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.\n\n @return The axis value of this event\n\n @see libinput_event_pointer_get_scroll_value_v120\n\n @since 1.19"] + pub fn libinput_event_pointer_get_scroll_value( + event: *mut libinput_event_pointer, + axis: libinput_pointer_axis, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n For events of type @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL\n the v120-normalized value represents the movement in logical mouse wheel\n clicks, normalized to the -120..+120 range.\n\n A value that is a fraction of ±120 indicates a wheel movement less than\n one logical click, a caller should either scroll by the respective\n fraction of the normal scroll distance or accumulate that value until a\n multiple of 120 is reached.\n\n For most callers, this is the preferred way of handling high-resolution\n scroll events.\n\n The normalized v120 value does not take device-specific physical angles\n or distances into account, i.e. a wheel with a click angle of 20 degrees\n produces only 18 logical clicks per 360 degree rotation, a wheel with a\n click angle of 15 degrees produces 24 logical clicks per 360 degree\n rotation. Where the physical angle matters, use\n libinput_event_pointer_get_axis_value() instead.\n\n The magic number 120 originates from the \n Windows Vista Mouse Wheel design document.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL.\n\n @return A value normalized to the 0-±120 range\n\n @see libinput_event_pointer_get_axis_value\n @see libinput_event_pointer_get_axis_value_discrete\n\n @since 1.19"] + pub fn libinput_event_pointer_get_scroll_value_v120( + event: *mut libinput_event_pointer, + axis: libinput_pointer_axis, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_pointer\n\n @return The generic libinput_event of this event"] + pub fn libinput_event_pointer_get_base_event( + event: *mut libinput_event_pointer, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event"] + pub fn libinput_event_touch_get_time(event: *mut libinput_event_touch) -> u32; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event in microseconds"] + pub fn libinput_event_touch_get_time_usec(event: *mut libinput_event_touch) -> u64; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n Get the slot of this touch event. See the kernel's multitouch\n protocol B documentation for more information.\n\n If the touch event has no assigned slot, for example if it is from a\n single touch device, this function returns -1.\n\n For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref\n LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref\n LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0.\n\n @note It is an application bug to call this function for events of type\n other than @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP,\n @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref LIBINPUT_EVENT_TOUCH_CANCEL.\n\n @return The slot of this touch event"] + pub fn libinput_event_touch_get_slot(event: *mut libinput_event_touch) -> i32; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n Get the seat slot of the touch event. A seat slot is a non-negative seat\n wide unique identifier of an active touch point.\n\n Events from single touch devices will be represented as one individual\n touch point per device.\n\n For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref\n LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref\n LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0.\n\n @note It is an application bug to call this function for events of type\n other than @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP,\n @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref LIBINPUT_EVENT_TOUCH_CANCEL.\n\n @return The seat slot of the touch event"] + pub fn libinput_event_touch_get_seat_slot(event: *mut libinput_event_touch) -> i32; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n Return the current absolute x coordinate of the touch event, in mm from\n the top left corner of the device. To get the corresponding output screen\n coordinate, use libinput_event_touch_get_x_transformed().\n\n For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref\n LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.\n\n @note It is an application bug to call this function for events of type\n other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref\n LIBINPUT_EVENT_TOUCH_MOTION.\n\n @param event The libinput touch event\n @return The current absolute x coordinate"] + pub fn libinput_event_touch_get_x(event: *mut libinput_event_touch) -> f64; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n Return the current absolute y coordinate of the touch event, in mm from\n the top left corner of the device. To get the corresponding output screen\n coordinate, use libinput_event_touch_get_y_transformed().\n\n For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref\n LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.\n\n @note It is an application bug to call this function for events of type\n other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref\n LIBINPUT_EVENT_TOUCH_MOTION.\n\n @param event The libinput touch event\n @return The current absolute y coordinate"] + pub fn libinput_event_touch_get_y(event: *mut libinput_event_touch) -> f64; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n Return the current absolute x coordinate of the touch event, transformed to\n screen coordinates.\n\n For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref\n LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.\n\n @note It is an application bug to call this function for events of type\n other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref\n LIBINPUT_EVENT_TOUCH_MOTION.\n\n @param event The libinput touch event\n @param width The current output screen width\n @return The current absolute x coordinate transformed to a screen coordinate"] + pub fn libinput_event_touch_get_x_transformed( + event: *mut libinput_event_touch, + width: u32, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n Return the current absolute y coordinate of the touch event, transformed to\n screen coordinates.\n\n For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref\n LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.\n\n @note It is an application bug to call this function for events of type\n other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref\n LIBINPUT_EVENT_TOUCH_MOTION.\n\n @param event The libinput touch event\n @param height The current output screen height\n @return The current absolute y coordinate transformed to a screen coordinate"] + pub fn libinput_event_touch_get_y_transformed( + event: *mut libinput_event_touch, + height: u32, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_touch\n\n @return The generic libinput_event of this event"] + pub fn libinput_event_touch_get_base_event( + event: *mut libinput_event_touch, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event"] + pub fn libinput_event_gesture_get_time(event: *mut libinput_event_gesture) -> u32; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @return The event time for this event in microseconds"] + pub fn libinput_event_gesture_get_time_usec(event: *mut libinput_event_gesture) -> u64; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n @return The generic libinput_event of this event"] + pub fn libinput_event_gesture_get_base_event( + event: *mut libinput_event_gesture, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the number of fingers used for a gesture. This can be used e.g.\n to differentiate between 3 or 4 finger swipes.\n\n This function can be called on all gesture events and the returned finger\n count value remains the same for the lifetime of a gesture. Thus, if a\n user puts down a fourth finger during a three-finger swipe gesture,\n libinput will end the three-finger gesture and, if applicable, start a\n four-finger swipe gesture. A caller may decide that those gestures are\n semantically identical and continue the two gestures as one single gesture.\n\n @return the number of fingers used for a gesture"] + pub fn libinput_event_gesture_get_finger_count( + event: *mut libinput_event_gesture, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return if the gesture ended normally, or if it was cancelled.\n For gesture events that are not of type\n @ref LIBINPUT_EVENT_GESTURE_SWIPE_END or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_GESTURE_SWIPE_END or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_END.\n\n @return 0 or 1, with 1 indicating that the gesture was cancelled."] + pub fn libinput_event_gesture_get_cancelled( + event: *mut libinput_event_gesture, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the delta between the last event and the current event. For gesture\n events that are not of type @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.\n\n If a device employs pointer acceleration, the delta returned by this\n function is the accelerated delta.\n\n Relative motion deltas are normalized to represent those of a device with\n 1000dpi resolution. See the libinput documentation for more details.\n\n @return the relative x movement since the last event"] + pub fn libinput_event_gesture_get_dx(event: *mut libinput_event_gesture) -> f64; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the delta between the last event and the current event. For gesture\n events that are not of type @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.\n\n If a device employs pointer acceleration, the delta returned by this\n function is the accelerated delta.\n\n Relative motion deltas are normalized to represent those of a device with\n 1000dpi resolution. See the libinput documentation for more details.\n\n @return the relative y movement since the last event"] + pub fn libinput_event_gesture_get_dy(event: *mut libinput_event_gesture) -> f64; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the relative delta of the unaccelerated motion vector of the\n current event. For gesture events that are not of type\n @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.\n\n Relative unaccelerated motion deltas are normalized to represent those of a\n device with 1000dpi resolution. See the libinput documentation for more\n details. Note that unaccelerated events are not equivalent to 'raw' events\n as read from the device.\n\n Any rotation applied to the device also applies to gesture motion\n (see libinput_device_config_rotation_set_angle()).\n\n @return the unaccelerated relative x movement since the last event"] + pub fn libinput_event_gesture_get_dx_unaccelerated(event: *mut libinput_event_gesture) -> f64; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the relative delta of the unaccelerated motion vector of the\n current event. For gesture events that are not of type\n @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.\n\n Relative unaccelerated motion deltas are normalized to represent those of a\n device with 1000dpi resolution. See the libinput documentation for more\n details. Note that unaccelerated events are not equivalent to 'raw' events\n as read from the device.\n\n Any rotation applied to the device also applies to gesture motion\n (see libinput_device_config_rotation_set_angle()).\n\n @return the unaccelerated relative y movement since the last event"] + pub fn libinput_event_gesture_get_dy_unaccelerated(event: *mut libinput_event_gesture) -> f64; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the absolute scale of a pinch gesture, the scale is the division\n of the current distance between the fingers and the distance at the start\n of the gesture. The scale begins at 1.0, and if e.g. the fingers moved\n together by 50% then the scale will become 0.5, if they move twice as far\n apart as initially the scale becomes 2.0, etc.\n\n For gesture events that are of type @ref\n LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, this function returns 1.0.\n\n For gesture events that are of type @ref\n LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns the scale value\n of the most recent @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event (if\n any) or 1.0 otherwise.\n\n For all other events this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, @ref\n LIBINPUT_EVENT_GESTURE_PINCH_END or\n @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.\n\n @return the absolute scale of a pinch gesture"] + pub fn libinput_event_gesture_get_scale(event: *mut libinput_event_gesture) -> f64; +} +extern "C" { + #[doc = " @ingroup event_gesture\n\n Return the angle delta in degrees between the last and the current @ref\n LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event. For gesture events that\n are not of type @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this\n function returns 0.\n\n The angle delta is defined as the change in angle of the line formed by\n the 2 fingers of a pinch gesture. Clockwise rotation is represented\n by a positive delta, counter-clockwise by a negative delta. If e.g. the\n fingers are on the 12 and 6 location of a clock face plate and they move\n to the 1 resp. 7 location in a single event then the angle delta is\n 30 degrees.\n\n If more than two fingers are present, the angle represents the rotation\n around the center of gravity. The calculation of the center of gravity is\n implementation-dependent.\n\n @return the angle delta since the last event"] + pub fn libinput_event_gesture_get_angle_delta(event: *mut libinput_event_gesture) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n @return The generic libinput_event of this event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_base_event( + event: *mut libinput_event_tablet_tool, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the x axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_x_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the y axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_y_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the pressure axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_pressure_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the distance axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n For tablet tool events of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY,\n this function always returns 1.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_distance_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the tilt x axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_tilt_x_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the tilt y axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_tilt_y_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the z-rotation axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_rotation_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the slider axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_slider_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the size major axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise"] + pub fn libinput_event_tablet_tool_size_major_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the size minor axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise"] + pub fn libinput_event_tablet_tool_size_minor_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if the wheel axis was updated in this event.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,\n @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or\n @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.\n\n @note It is an application bug to call this function for events other\n than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref\n LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref\n LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return 1 if the axis was updated or 0 otherwise\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_wheel_has_changed( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the X coordinate of the tablet tool, in mm from the top left\n corner of the tablet in its current logical orientation. Use\n libinput_event_tablet_tool_get_x_transformed() for transforming the axis\n value into a different coordinate space.\n\n @note On some devices, returned value may be negative or larger than the\n width of the device. See the libinput documentation for more details.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_x(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the Y coordinate of the tablet tool, in mm from the top left\n corner of the tablet in its current logical orientation. Use\n libinput_event_tablet_tool_get_y_transformed() for transforming the axis\n value into a different coordinate space.\n\n @note On some devices, returned value may be negative or larger than the\n width of the device. See the libinput documentation for more details.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_y(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the delta between the last event and the current event.\n If the tool employs pointer acceleration, the delta returned by this\n function is the accelerated delta.\n\n This value is in screen coordinate space, the delta is to be interpreted\n like the return value of libinput_event_pointer_get_dx().\n See the libinput documentation for more details.\n\n @param event The libinput tablet event\n @return The relative x movement since the last event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_dx(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the delta between the last event and the current event.\n If the tool employs pointer acceleration, the delta returned by this\n function is the accelerated delta.\n\n This value is in screen coordinate space, the delta is to be interpreted\n like the return value of libinput_event_pointer_get_dx().\n See the libinput documentation for more details.\n\n @param event The libinput tablet event\n @return The relative y movement since the last event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_dy(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current pressure being applied on the tool in use, normalized\n to the range [0, 1].\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_pressure(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current distance from the tablet's sensor, normalized to the\n range [0, 1].\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_distance(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current tilt along the X axis of the tablet's current logical\n orientation, in degrees off the tablet's z axis. That is, if the tool is\n perfectly orthogonal to the tablet, the tilt angle is 0. When the top\n tilts towards the logical top/left of the tablet, the x/y tilt angles are\n negative, if the top tilts towards the logical bottom/right of the\n tablet, the x/y tilt angles are positive.\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the axis in degrees\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_tilt_x(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current tilt along the Y axis of the tablet's current logical\n orientation, in degrees off the tablet's z axis. That is, if the tool is\n perfectly orthogonal to the tablet, the tilt angle is 0. When the top\n tilts towards the logical top/left of the tablet, the x/y tilt angles are\n negative, if the top tilts towards the logical bottom/right of the\n tablet, the x/y tilt angles are positive.\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis in degrees\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_tilt_y(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current z rotation of the tool in degrees, clockwise from the\n tool's logical neutral position.\n\n For tools of type @ref LIBINPUT_TABLET_TOOL_TYPE_MOUSE and @ref\n LIBINPUT_TABLET_TOOL_TYPE_LENS the logical neutral position is\n pointing to the current logical north of the tablet. For tools of type @ref\n LIBINPUT_TABLET_TOOL_TYPE_BRUSH, the logical neutral position is with the\n buttons pointing up.\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_rotation(event: *mut libinput_event_tablet_tool) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current position of the slider on the tool, normalized to the\n range [-1, 1]. The logical zero is the neutral position of the slider, or\n the logical center of the axis. This axis is available on e.g. the Wacom\n Airbrush.\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the the axis\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_slider_position( + event: *mut libinput_event_tablet_tool, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current size in mm along the major axis of the touching\n ellipse. This axis is not necessarily aligned with either x or y, the\n rotation must be taken into account.\n\n Where no rotation is available on a tool, or where rotation is zero, the\n major axis aligns with the y axis and the minor axis with the x axis.\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the axis major in mm"] + pub fn libinput_event_tablet_tool_get_size_major(event: *mut libinput_event_tablet_tool) + -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the current size in mm along the minor axis of the touching\n ellipse. This axis is not necessarily aligned with either x or y, the\n rotation must be taken into account.\n\n Where no rotation is available on a tool, or where rotation is zero, the\n minor axis aligns with the y axis and the minor axis with the x axis.\n\n If this axis does not exist on the current tool, this function returns 0.\n\n @param event The libinput tablet tool event\n @return The current value of the axis minor in mm"] + pub fn libinput_event_tablet_tool_get_size_minor(event: *mut libinput_event_tablet_tool) + -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the delta for the wheel in degrees.\n\n @param event The libinput tablet tool event\n @return The delta of the wheel, in degrees, compared to the last event\n\n @see libinput_event_tablet_tool_get_wheel_delta_discrete"] + pub fn libinput_event_tablet_tool_get_wheel_delta( + event: *mut libinput_event_tablet_tool, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the delta for the wheel in discrete steps (e.g. wheel clicks).\n\n @param event The libinput tablet tool event\n @return The delta of the wheel, in discrete steps, compared to the last event\n\n @see libinput_event_tablet_tool_get_wheel_delta_discrete\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_wheel_delta_discrete( + event: *mut libinput_event_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the current absolute x coordinate of the tablet tool event,\n transformed to screen coordinates.\n\n @note This function may be called for a specific axis even if\n libinput_event_tablet_tool_*_has_changed() returns 0 for that axis.\n libinput always includes all device axes in the event.\n\n @note On some devices, returned value may be negative or larger than the\n width of the device. See the libinput documentation for more details.\n\n @param event The libinput tablet tool event\n @param width The current output screen width\n @return the current absolute x coordinate transformed to a screen coordinate\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_x_transformed( + event: *mut libinput_event_tablet_tool, + width: u32, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the current absolute y coordinate of the tablet tool event,\n transformed to screen coordinates.\n\n @note This function may be called for a specific axis even if\n libinput_event_tablet_tool_*_has_changed() returns 0 for that axis.\n libinput always includes all device axes in the event.\n\n @note On some devices, returned value may be negative or larger than the\n width of the device. See the libinput documentation for more details.\n\n @param event The libinput tablet tool event\n @param height The current output screen height\n @return the current absolute y coordinate transformed to a screen coordinate\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_y_transformed( + event: *mut libinput_event_tablet_tool, + height: u32, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the tool that was in use during this event.\n\n The returned tablet tool is not refcounted and may become invalid after\n the next call to libinput. Use libinput_tablet_tool_ref() and\n libinput_tablet_tool_unref() to continue using the handle outside of the\n immediate scope.\n\n If the caller holds at least one reference, this struct is used\n whenever the tools enters proximity again.\n\n @note Physical tool tracking requires hardware support. If unavailable,\n libinput creates one tool per type per tablet. See\n libinput_tablet_tool_get_serial() for more details.\n\n @param event The libinput tablet tool event\n @return The new tool triggering this event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_tool( + event: *mut libinput_event_tablet_tool, + ) -> *mut libinput_tablet_tool; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the new proximity state of a tool from a proximity event.\n Used to check whether or not a tool came in or out of proximity during an\n event of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.\n\n The proximity state represents the logical proximity state which does not\n necessarily match when a tool comes into sensor range or leaves the\n sensor range. On some tools this range does not represent the physical\n range but a reduced tool-specific logical range. If the range is reduced,\n this is done transparent to the caller.\n\n For example, the Wacom mouse and lens cursor tools are usually\n used in relative mode, lying flat on the tablet. Movement typically follows\n the interaction normal mouse movements have, i.e. slightly lift the tool and\n place it in a separate location. The proximity detection on Wacom\n tablets however extends further than the user may lift the mouse, i.e. the\n tool may not be lifted out of physical proximity. For such tools, libinput\n provides software-emulated proximity.\n\n @param event The libinput tablet tool event\n @return The new proximity state of the tool from the event.\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_proximity_state( + event: *mut libinput_event_tablet_tool, + ) -> libinput_tablet_tool_proximity_state; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Returns the new tip state of a tool from a tip event.\n Used to check whether or not a tool came in contact with the tablet\n surface or left contact with the tablet surface during an\n event of type @ref LIBINPUT_EVENT_TABLET_TOOL_TIP.\n\n @param event The libinput tablet tool event\n @return The new tip state of the tool from the event.\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_tip_state( + event: *mut libinput_event_tablet_tool, + ) -> libinput_tablet_tool_tip_state; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the button that triggered this event. For events that are not of\n type @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return the button triggering this event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_button(event: *mut libinput_event_tablet_tool) -> u32; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the button state of the event.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON.\n\n @param event The libinput tablet tool event\n @return the button state triggering this event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_button_state( + event: *mut libinput_event_tablet_tool, + ) -> libinput_button_state; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n For the button of a @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON event, return the total\n number of buttons pressed on all devices on the associated seat after the\n the event was triggered.\n\n\" @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. For other events, this function returns 0.\n\n @param event The libinput tablet tool event\n @return the seat wide pressed button count for the key of this event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_seat_button_count( + event: *mut libinput_event_tablet_tool, + ) -> u32; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @param event The libinput tablet tool event\n @return The event time for this event\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_time(event: *mut libinput_event_tablet_tool) -> u32; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @param event The libinput tablet tool event\n @return The event time for this event in microseconds\n\n @since 1.2"] + pub fn libinput_event_tablet_tool_get_time_usec(event: *mut libinput_event_tablet_tool) -> u64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the high-level tool type for a tool object.\n\n The high level tool describes general interaction expected with the tool.\n For example, a user would expect a tool of type @ref\n LIBINPUT_TABLET_TOOL_TYPE_PEN to interact with a graphics application\n taking pressure and tilt into account. The default virtual tool assigned\n should be a drawing tool, e.g. a virtual pen or brush.\n A tool of type @ref LIBINPUT_TABLET_TOOL_TYPE_ERASER would normally be\n mapped to an eraser-like virtual tool.\n\n If supported by the hardware, a more specific tool id is always\n available, see libinput_tablet_tool_get_tool_id().\n\n @param tool The libinput tool\n @return The tool type for this tool object\n\n @see libinput_tablet_tool_get_tool_id\n\n @since 1.2"] + pub fn libinput_tablet_tool_get_type( + tool: *mut libinput_tablet_tool, + ) -> libinput_tablet_tool_type; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the tool ID for a tool object. If nonzero, this number identifies\n the specific type of the tool with more precision than the type returned in\n libinput_tablet_tool_get_type(). Not all tablets support a tool ID.\n\n Tablets known to support tool IDs include the Wacom Intuos 3, 4, 5, Wacom\n Cintiq and Wacom Intuos Pro series. The tool ID can be used to\n distinguish between e.g. a Wacom Classic Pen or a Wacom Pro Pen. It is\n the caller's responsibility to interpret the tool ID.\n\n @param tool The libinput tool\n @return The tool ID for this tool object or 0 if none is provided\n\n @see libinput_tablet_tool_get_type\n\n @since 1.2"] + pub fn libinput_tablet_tool_get_tool_id(tool: *mut libinput_tablet_tool) -> u64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Increment the reference count of the tool by one. A tool is destroyed\n whenever the reference count reaches 0. See libinput_tablet_tool_unref().\n\n @param tool The tool to increment the ref count of\n @return The passed tool\n\n @see libinput_tablet_tool_unref\n\n @since 1.2"] + pub fn libinput_tablet_tool_ref(tool: *mut libinput_tablet_tool) -> *mut libinput_tablet_tool; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Decrement the reference count of the tool by one. When the reference\n count of the tool reaches 0, the memory allocated for the tool will be\n freed.\n\n @param tool The tool to decrement the ref count of\n @return NULL if the tool was destroyed otherwise the passed tool\n\n @see libinput_tablet_tool_ref\n\n @since 1.2"] + pub fn libinput_tablet_tool_unref(tool: *mut libinput_tablet_tool) + -> *mut libinput_tablet_tool; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool supports pressure.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise.\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_pressure( + tool: *mut libinput_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool supports distance.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise.\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_distance( + tool: *mut libinput_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool supports tilt.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise.\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_tilt(tool: *mut libinput_tablet_tool) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool supports z-rotation.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise.\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_rotation( + tool: *mut libinput_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool has a slider axis.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise.\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_slider( + tool: *mut libinput_tablet_tool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool has a ellipsis major and minor.\n Where the underlying hardware only supports one of either major or minor,\n libinput emulates the other axis as a circular contact, i.e. major ==\n minor for all values of major.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise."] + pub fn libinput_tablet_tool_has_size(tool: *mut libinput_tablet_tool) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return whether the tablet tool has a relative wheel.\n\n @param tool The tool to check the axis capabilities of\n @return Nonzero if the axis is available, zero otherwise.\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_wheel(tool: *mut libinput_tablet_tool) + -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Check if a tablet tool has a button with the\n passed-in code (see linux/input.h).\n\n @param tool A tablet tool\n @param code button code to check for\n\n @return 1 if the tool supports this button code, 0 if it does not\n\n @since 1.2"] + pub fn libinput_tablet_tool_has_button( + tool: *mut libinput_tablet_tool, + code: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return nonzero if the physical tool can be uniquely identified by\n libinput, or nonzero otherwise. If a tool can be uniquely identified,\n keeping a reference to the tool allows tracking the tool across\n proximity out sequences and across compatible tablets.\n See libinput_tablet_tool_get_serial() for more details.\n\n @param tool A tablet tool\n @return 1 if the tool can be uniquely identified, 0 otherwise.\n\n @see libinput_tablet_tool_get_serial\n\n @since 1.2"] + pub fn libinput_tablet_tool_is_unique(tool: *mut libinput_tablet_tool) + -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the serial number of a tool. If the tool does not report a serial\n number, this function returns zero.\n\n Some tools provide hardware information that enables libinput to uniquely\n identify the physical device. For example, tools compatible with the\n Wacom Intuos 4, Intuos 5, Intuos Pro and Cintiq series are uniquely\n identifiable through a serial number. libinput does not specify how a\n tool can be identified uniquely, a caller should use\n libinput_tablet_tool_is_unique() to check if the tool is unique.\n\n libinput creates a struct @ref libinput_tablet_tool on the first\n proximity in of this tool. By default, this struct is destroyed on\n proximity out and re-initialized on the next proximity in. If a caller\n keeps a reference to the tool by using libinput_tablet_tool_ref()\n libinput re-uses this struct whenever that same physical tool comes into\n proximity on any tablet\n recognized by libinput. It is possible to attach tool-specific virtual\n state to the tool. For example, a graphics program such as the GIMP may\n assign a specific color to each tool, allowing the artist to use the\n tools like physical pens of different color. In multi-tablet setups it is\n also possible to track the tool across devices.\n\n If the tool does not have a unique identifier, libinput creates a single\n struct @ref libinput_tablet_tool per tool type on each tablet the tool is\n used on.\n\n @param tool The libinput tool\n @return The tool serial number\n\n @see libinput_tablet_tool_is_unique\n\n @since 1.2"] + pub fn libinput_tablet_tool_get_serial(tool: *mut libinput_tablet_tool) -> u64; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Return the user data associated with a tool object. libinput does\n not manage, look at, or modify this data. The caller must ensure the\n data is valid.\n\n @param tool The libinput tool\n @return The user data associated with the tool object\n\n @since 1.2"] + pub fn libinput_tablet_tool_get_user_data( + tool: *mut libinput_tablet_tool, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = " @ingroup event_tablet\n\n Set the user data associated with a tool object, if any.\n\n @param tool The libinput tool\n @param user_data The user data to associate with the tool object\n\n @since 1.2"] + pub fn libinput_tablet_tool_set_user_data( + tool: *mut libinput_tablet_tool, + user_data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n @return The generic libinput_event of this event\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_base_event( + event: *mut libinput_event_tablet_pad, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the current position of the ring, in degrees counterclockwise\n from the northern-most point of the ring in the tablet's current logical\n orientation.\n\n If the source is @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER,\n libinput sends a terminating event with a ring value of -1 when the\n finger is lifted from the ring. A caller may use this information to e.g.\n determine if kinetic scrolling should be triggered.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return The current value of the the axis\n @retval -1 The finger was lifted\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_ring_position( + event: *mut libinput_event_tablet_pad, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the number of the ring that has changed state, with 0 being the\n first ring. On tablets with only one ring, this function always returns\n 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return The index of the ring that changed state\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_ring_number( + event: *mut libinput_event_tablet_pad, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the source of the interaction with the ring. If the source is\n @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, libinput sends a ring\n position value of -1 to terminate the current interaction.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return The source of the ring interaction\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_ring_source( + event: *mut libinput_event_tablet_pad, + ) -> libinput_tablet_pad_ring_axis_source; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the current position of the strip, normalized to the range\n [0, 1], with 0 being the top/left-most point in the tablet's current\n logical orientation.\n\n If the source is @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER,\n libinput sends a terminating event with a ring value of -1 when the\n finger is lifted from the ring. A caller may use this information to e.g.\n determine if kinetic scrolling should be triggered.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return The current value of the the axis\n @retval -1 The finger was lifted\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_strip_position( + event: *mut libinput_event_tablet_pad, + ) -> f64; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the number of the strip that has changed state, with 0 being the\n first strip. On tablets with only one strip, this function always returns\n 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return The index of the strip that changed state\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_strip_number( + event: *mut libinput_event_tablet_pad, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the source of the interaction with the strip. If the source is\n @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, libinput sends a strip\n position value of -1 to terminate the current interaction.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return The source of the strip interaction\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_strip_source( + event: *mut libinput_event_tablet_pad, + ) -> libinput_tablet_pad_strip_axis_source; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Return the button number that triggered this event, starting at 0.\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON,\n this function returns 0.\n\n Note that the number returned is a generic sequential button number and\n not a semantic button code as defined in linux/input.h.\n See the libinput documentation for more details.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return the button triggering this event\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_button_number( + event: *mut libinput_event_tablet_pad, + ) -> u32; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Return the button state of the event.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return the button state triggering this event\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_button_state( + event: *mut libinput_event_tablet_pad, + ) -> libinput_button_state; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Return the key code that triggered this event, e.g. KEY_CONTROLPANEL. The\n list of key codes is defined in linux/input-event-codes.h.\n\n For events that are not of type @ref LIBINPUT_EVENT_TABLET_PAD_KEY,\n this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_KEY. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return the key code triggering this event\n\n @since 1.15"] + pub fn libinput_event_tablet_pad_get_key(event: *mut libinput_event_tablet_pad) -> u32; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Return the key state of the event.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_TABLET_PAD_KEY. For other events, this function\n returns 0.\n\n @param event The libinput tablet pad event\n @return the key state triggering this event\n\n @since 1.15"] + pub fn libinput_event_tablet_pad_get_key_state( + event: *mut libinput_event_tablet_pad, + ) -> libinput_key_state; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the mode the button, ring, or strip that triggered this event is\n in, at the time of the event.\n\n The mode is a virtual grouping of functionality, usually based on some\n visual feedback like LEDs on the pad. Mode indices start at 0, a device\n that does not support modes always returns 0.\n\n @note Pad keys are not part of a mode group. It is an application bug to\n call this function for @ref LIBINPUT_EVENT_TABLET_PAD_KEY.\n\n Mode switching is controlled by libinput and more than one mode may exist\n on the tablet. This function returns the mode that this event's button,\n ring or strip is logically in. If the button is a mode toggle button\n and the button event caused a new mode to be toggled, the mode returned\n is the new mode the button is in.\n\n Note that the returned mode is the mode valid as of the time of the\n event. The returned mode may thus be different to the mode returned by\n libinput_tablet_pad_mode_group_get_mode(). See\n libinput_tablet_pad_mode_group_get_mode() for details.\n\n @param event The libinput tablet pad event\n @return the 0-indexed mode of this button, ring or strip at the time of\n the event\n\n @see libinput_tablet_pad_mode_group_get_mode\n\n @since 1.4"] + pub fn libinput_event_tablet_pad_get_mode( + event: *mut libinput_event_tablet_pad, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n Returns the mode group that the button, ring, or strip that triggered\n this event is considered in. The mode is a virtual grouping of\n functionality, usually based on some visual feedback like LEDs on the\n pad.\n\n @note Pad keys are not part of a mode group. It is an application bug to\n call this function for @ref LIBINPUT_EVENT_TABLET_PAD_KEY.\n\n The returned mode group is not refcounted and may become invalid after\n the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and\n libinput_tablet_pad_mode_group_unref() to continue using the handle\n outside of the immediate scope.\n\n @param event The libinput tablet pad event\n @return the mode group of the button, ring or strip that caused this event\n\n @see libinput_device_tablet_pad_get_mode_group\n\n @since 1.4"] + pub fn libinput_event_tablet_pad_get_mode_group( + event: *mut libinput_event_tablet_pad, + ) -> *mut libinput_tablet_pad_mode_group; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @param event The libinput tablet pad event\n @return The event time for this event\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_time(event: *mut libinput_event_tablet_pad) -> u32; +} +extern "C" { + #[doc = " @ingroup event_tablet_pad\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @param event The libinput tablet pad event\n @return The event time for this event in microseconds\n\n @since 1.3"] + pub fn libinput_event_tablet_pad_get_time_usec(event: *mut libinput_event_tablet_pad) -> u64; +} +extern "C" { + #[doc = " @ingroup event_switch\n\n Return the switch that triggered this event.\n For pointer events that are not of type @ref\n LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_SWITCH_TOGGLE.\n\n @param event The libinput switch event\n @return The switch triggering this event\n\n @since 1.7"] + pub fn libinput_event_switch_get_switch(event: *mut libinput_event_switch) -> libinput_switch; +} +extern "C" { + #[doc = " @ingroup event_switch\n\n Return the switch state that triggered this event.\n For switch events that are not of type @ref\n LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0.\n\n @note It is an application bug to call this function for events other than\n @ref LIBINPUT_EVENT_SWITCH_TOGGLE.\n\n @param event The libinput switch event\n @return The switch state triggering this event\n\n @since 1.7"] + pub fn libinput_event_switch_get_switch_state( + event: *mut libinput_event_switch, + ) -> libinput_switch_state; +} +extern "C" { + #[doc = " @ingroup event_switch\n\n @return The generic libinput_event of this event\n\n @since 1.7"] + pub fn libinput_event_switch_get_base_event( + event: *mut libinput_event_switch, + ) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup event_switch\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @param event The libinput switch event\n @return The event time for this event\n\n @since 1.7"] + pub fn libinput_event_switch_get_time(event: *mut libinput_event_switch) -> u32; +} +extern "C" { + #[doc = " @ingroup event_switch\n\n @note Timestamps may not always increase. See the libinput documentation\n for more details.\n\n @param event The libinput switch event\n @return The event time for this event in microseconds\n\n @since 1.7"] + pub fn libinput_event_switch_get_time_usec(event: *mut libinput_event_switch) -> u64; +} +#[doc = " @ingroup base\n @struct libinput_interface\n\n libinput does not open file descriptors to devices directly, instead\n open_restricted() and close_restricted() are called for each path that\n must be opened.\n\n @see libinput_udev_create_context\n @see libinput_path_create_context"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_interface { + #[doc = " Open the device at the given path with the flags provided and\n return the fd.\n\n @param path The device path to open\n @param flags Flags as defined by open(2)\n @param user_data The user_data provided in\n libinput_udev_create_context()\n\n @return The file descriptor, or a negative errno on failure."] + pub open_restricted: ::std::option::Option< + unsafe extern "C" fn( + path: *const ::std::os::raw::c_char, + flags: ::std::os::raw::c_int, + user_data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + #[doc = " Close the file descriptor.\n\n @param fd The file descriptor to close\n @param user_data The user_data provided in\n libinput_udev_create_context()"] + pub close_restricted: ::std::option::Option< + unsafe extern "C" fn(fd: ::std::os::raw::c_int, user_data: *mut ::std::os::raw::c_void), + >, +} +#[test] +fn bindgen_test_layout_libinput_interface() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(libinput_interface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(libinput_interface)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).open_restricted) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(libinput_interface), + "::", + stringify!(open_restricted) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).close_restricted) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(libinput_interface), + "::", + stringify!(close_restricted) + ) + ); +} +extern "C" { + #[doc = " @ingroup base\n\n Create a new libinput context from udev. This context is inactive until\n assigned a seat ID with libinput_udev_assign_seat().\n\n @param interface The callback interface\n @param user_data Caller-specific data passed to the various callback\n interfaces.\n @param udev An already initialized udev context\n\n @return An initialized, but inactive libinput context or NULL on error"] + pub fn libinput_udev_create_context( + interface: *const libinput_interface, + user_data: *mut ::std::os::raw::c_void, + udev: *mut udev, + ) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup base\n\n Assign a seat to this libinput context. New devices or the removal of\n existing devices will appear as events during libinput_dispatch().\n\n libinput_udev_assign_seat() succeeds even if no input devices are currently\n available on this seat, or if devices are available but fail to open in\n @ref libinput_interface::open_restricted. Devices that do not have the\n minimum capabilities to be recognized as pointer, keyboard or touch\n device are ignored. Such devices and those that failed to open\n ignored until the next call to libinput_resume().\n\n This function may only be called once per context.\n\n @param libinput A libinput context initialized with\n libinput_udev_create_context()\n @param seat_id A seat identifier. This string must not be NULL.\n\n @return 0 on success or -1 on failure."] + pub fn libinput_udev_assign_seat( + libinput: *mut libinput, + seat_id: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup base\n\n Create a new libinput context that requires the caller to manually add or\n remove devices with libinput_path_add_device() and\n libinput_path_remove_device().\n\n The context is fully initialized but will not generate events until at\n least one device has been added.\n\n The reference count of the context is initialized to 1. See @ref\n libinput_unref.\n\n @param interface The callback interface\n @param user_data Caller-specific data passed to the various callback\n interfaces.\n\n @return An initialized, empty libinput context."] + pub fn libinput_path_create_context( + interface: *const libinput_interface, + user_data: *mut ::std::os::raw::c_void, + ) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup base\n\n Add a device to a libinput context initialized with\n libinput_path_create_context(). If successful, the device will be\n added to the internal list and re-opened on libinput_resume(). The device\n can be removed with libinput_path_remove_device().\n\n If the device was successfully initialized, it is returned in the device\n argument. The lifetime of the returned device pointer is limited until\n the next libinput_dispatch(), use libinput_device_ref() to keep a permanent\n reference.\n\n @param libinput A previously initialized libinput context\n @param path Path to an input device\n @return The newly initiated device on success, or NULL on failure.\n\n @note It is an application bug to call this function on a libinput\n context initialized with libinput_udev_create_context()."] + pub fn libinput_path_add_device( + libinput: *mut libinput, + path: *const ::std::os::raw::c_char, + ) -> *mut libinput_device; +} +extern "C" { + #[doc = " @ingroup base\n\n Remove a device from a libinput context initialized with\n libinput_path_create_context() or added to such a context with\n libinput_path_add_device().\n\n Events already processed from this input device are kept in the queue,\n the @ref LIBINPUT_EVENT_DEVICE_REMOVED event marks the end of events for\n this device.\n\n If no matching device exists, this function does nothing.\n\n @param device A libinput device\n\n @note It is an application bug to call this function on a libinput\n context initialized with libinput_udev_create_context()."] + pub fn libinput_path_remove_device(device: *mut libinput_device); +} +extern "C" { + #[doc = " @ingroup base\n\n libinput keeps a single file descriptor for all events. Call into\n libinput_dispatch() if any events become available on this fd.\n\n @return The file descriptor used to notify of pending events."] + pub fn libinput_get_fd(libinput: *mut libinput) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup base\n\n Main event dispatchment function. Reads events of the file descriptors\n and processes them internally. Use libinput_get_event() to retrieve the\n events.\n\n Dispatching does not necessarily queue libinput events. This function\n should be called immediately once data is available on the file\n descriptor returned by libinput_get_fd(). libinput has a number of\n timing-sensitive features (e.g. tap-to-click), any delay in calling\n libinput_dispatch() may prevent these features from working correctly.\n\n @param libinput A previously initialized libinput context\n\n @return 0 on success, or a negative errno on failure"] + pub fn libinput_dispatch(libinput: *mut libinput) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup base\n\n Retrieve the next event from libinput's internal event queue.\n\n After handling the retrieved event, the caller must destroy it using\n libinput_event_destroy().\n\n @param libinput A previously initialized libinput context\n @return The next available event, or NULL if no event is available."] + pub fn libinput_get_event(libinput: *mut libinput) -> *mut libinput_event; +} +extern "C" { + #[doc = " @ingroup base\n\n Return the type of the next event in the internal queue. This function\n does not pop the event off the queue and the next call to\n libinput_get_event() returns that event.\n\n @param libinput A previously initialized libinput context\n @return The event type of the next available event or @ref\n LIBINPUT_EVENT_NONE if no event is available."] + pub fn libinput_next_event_type(libinput: *mut libinput) -> libinput_event_type; +} +extern "C" { + #[doc = " @ingroup base\n\n Set caller-specific data associated with this context. libinput does\n not manage, look at, or modify this data. The caller must ensure the\n data is valid.\n\n @param libinput A previously initialized libinput context\n @param user_data Caller-specific data passed to the various callback\n interfaces."] + pub fn libinput_set_user_data(libinput: *mut libinput, user_data: *mut ::std::os::raw::c_void); +} +extern "C" { + #[doc = " @ingroup base\n\n Get the caller-specific data associated with this context, if any.\n\n @param libinput A previously initialized libinput context\n @return The caller-specific data previously assigned in\n libinput_set_user_data(), libinput_path_create_context() or\n libinput_udev_create_context()."] + pub fn libinput_get_user_data(libinput: *mut libinput) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = " @ingroup base\n\n Resume a suspended libinput context. This re-enables device\n monitoring and adds existing devices.\n\n @param libinput A previously initialized libinput context\n @see libinput_suspend\n\n @return 0 on success or -1 on failure"] + pub fn libinput_resume(libinput: *mut libinput) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup base\n\n Suspend monitoring for new devices and close existing devices.\n This all but terminates libinput but does keep the context\n valid to be resumed with libinput_resume().\n\n @param libinput A previously initialized libinput context"] + pub fn libinput_suspend(libinput: *mut libinput); +} +extern "C" { + #[doc = " @ingroup base\n\n Add a reference to the context. A context is destroyed whenever the\n reference count reaches 0. See @ref libinput_unref.\n\n @param libinput A previously initialized valid libinput context\n @return The passed libinput context"] + pub fn libinput_ref(libinput: *mut libinput) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup base\n\n Dereference the libinput context. After this, the context may have been\n destroyed, if the last reference was dereferenced. If so, the context is\n invalid and may not be interacted with.\n\n @bug When the refcount reaches zero, libinput_unref() releases resources\n even if a caller still holds refcounted references to related resources\n (e.g. a libinput_device). When libinput_unref() returns\n NULL, the caller must consider any resources related to that context\n invalid. See https://bugs.freedesktop.org/show_bug.cgi?id=91872.\n\n Example code:\n @code\n li = libinput_path_create_context(&interface, NULL);\n device = libinput_path_add_device(li, \"/dev/input/event0\");\n // get extra reference to device\n libinput_device_ref(device);\n\n // refcount reaches 0, so *all* resources are cleaned up,\n // including device\n libinput_unref(li);\n\n // INCORRECT: device has been cleaned up and must not be used\n // li = libinput_device_get_context(device);\n @endcode\n\n @param libinput A previously initialized libinput context\n @return NULL if context was destroyed otherwise the passed context"] + pub fn libinput_unref(libinput: *mut libinput) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup base\n\n Set the log priority for the libinput context. Messages with priorities\n equal to or higher than the argument will be printed to the context's\n log handler.\n\n The default log priority is @ref LIBINPUT_LOG_PRIORITY_ERROR.\n\n @param libinput A previously initialized libinput context\n @param priority The minimum priority of log messages to print.\n\n @see libinput_log_set_handler\n @see libinput_log_get_priority"] + pub fn libinput_log_set_priority(libinput: *mut libinput, priority: libinput_log_priority); +} +extern "C" { + #[doc = " @ingroup base\n\n Get the context's log priority. Messages with priorities equal to or\n higher than the argument will be printed to the current log handler.\n\n The default log priority is @ref LIBINPUT_LOG_PRIORITY_ERROR.\n\n @param libinput A previously initialized libinput context\n @return The minimum priority of log messages to print.\n\n @see libinput_log_set_handler\n @see libinput_log_set_priority"] + pub fn libinput_log_get_priority(libinput: *const libinput) -> libinput_log_priority; +} +#[doc = " @ingroup base\n\n Log handler type for custom logging.\n\n @param libinput The libinput context\n @param priority The priority of the current message\n @param format Message format in printf-style\n @param args Message arguments\n\n @see libinput_log_set_priority\n @see libinput_log_get_priority\n @see libinput_log_set_handler"] +pub type libinput_log_handler = ::std::option::Option< + unsafe extern "C" fn( + libinput: *mut libinput, + priority: libinput_log_priority, + format: *const ::std::os::raw::c_char, + args: *mut __va_list_tag, + ), +>; +extern "C" { + #[doc = " @ingroup base\n\n Set the context's log handler. Messages with priorities equal to or\n higher than the context's log priority will be passed to the given\n log handler.\n\n The default log handler prints to stderr.\n\n @param libinput A previously initialized libinput context\n @param log_handler The log handler for library messages.\n\n @see libinput_log_set_priority\n @see libinput_log_get_priority"] + pub fn libinput_log_set_handler(libinput: *mut libinput, log_handler: libinput_log_handler); +} +extern "C" { + #[doc = " @ingroup seat\n\n Increase the refcount of the seat. A seat will be freed whenever the\n refcount reaches 0. This may happen during libinput_dispatch() if the\n seat was removed from the system. A caller must ensure to reference\n the seat correctly to avoid dangling pointers.\n\n @param seat A previously obtained seat\n @return The passed seat"] + pub fn libinput_seat_ref(seat: *mut libinput_seat) -> *mut libinput_seat; +} +extern "C" { + #[doc = " @ingroup seat\n\n Decrease the refcount of the seat. A seat will be freed whenever the\n refcount reaches 0. This may happen during libinput_dispatch() if the\n seat was removed from the system. A caller must ensure to reference\n the seat correctly to avoid dangling pointers.\n\n @param seat A previously obtained seat\n @return NULL if seat was destroyed, otherwise the passed seat"] + pub fn libinput_seat_unref(seat: *mut libinput_seat) -> *mut libinput_seat; +} +extern "C" { + #[doc = " @ingroup seat\n\n Set caller-specific data associated with this seat. libinput does\n not manage, look at, or modify this data. The caller must ensure the\n data is valid.\n\n @param seat A previously obtained seat\n @param user_data Caller-specific data pointer\n @see libinput_seat_get_user_data"] + pub fn libinput_seat_set_user_data( + seat: *mut libinput_seat, + user_data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + #[doc = " @ingroup seat\n\n Get the caller-specific data associated with this seat, if any.\n\n @param seat A previously obtained seat\n @return Caller-specific data pointer or NULL if none was set\n @see libinput_seat_set_user_data"] + pub fn libinput_seat_get_user_data(seat: *mut libinput_seat) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = " @ingroup seat\n\n Get the libinput context from the seat.\n\n @param seat A previously obtained seat\n @return The libinput context for this seat."] + pub fn libinput_seat_get_context(seat: *mut libinput_seat) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup seat\n\n Return the physical name of the seat. For libinput contexts created from\n udev, this is always the same value as passed into\n libinput_udev_assign_seat() and all seats from that context will have\n the same physical name.\n\n The physical name of the seat is one that is usually set by the system or\n lower levels of the stack. In most cases, this is the base filter for\n devices - devices assigned to seats outside the current seat will not\n be available to the caller.\n\n @param seat A previously obtained seat\n @return The physical name of this seat"] + pub fn libinput_seat_get_physical_name( + seat: *mut libinput_seat, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = " @ingroup seat\n\n Return the logical name of the seat. This is an identifier to group sets\n of devices within the compositor.\n\n @param seat A previously obtained seat\n @return The logical name of this seat"] + pub fn libinput_seat_get_logical_name( + seat: *mut libinput_seat, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = " @ingroup device\n\n Increase the refcount of the input device. An input device will be freed\n whenever the refcount reaches 0. This may happen during\n libinput_dispatch() if the device was removed from the system. A caller\n must ensure to reference the device correctly to avoid dangling pointers.\n\n @param device A previously obtained device\n @return The passed device"] + pub fn libinput_device_ref(device: *mut libinput_device) -> *mut libinput_device; +} +extern "C" { + #[doc = " @ingroup device\n\n Decrease the refcount of the input device. An input device will be freed\n whenever the refcount reaches 0. This may happen during libinput_dispatch\n if the device was removed from the system. A caller must ensure to\n reference the device correctly to avoid dangling pointers.\n\n @param device A previously obtained device\n @return NULL if the device was destroyed, otherwise the passed device"] + pub fn libinput_device_unref(device: *mut libinput_device) -> *mut libinput_device; +} +extern "C" { + #[doc = " @ingroup device\n\n Set caller-specific data associated with this input device. libinput does\n not manage, look at, or modify this data. The caller must ensure the\n data is valid.\n\n @param device A previously obtained device\n @param user_data Caller-specific data pointer\n @see libinput_device_get_user_data"] + pub fn libinput_device_set_user_data( + device: *mut libinput_device, + user_data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + #[doc = " @ingroup device\n\n Get the caller-specific data associated with this input device, if any.\n\n @param device A previously obtained device\n @return Caller-specific data pointer or NULL if none was set\n @see libinput_device_set_user_data"] + pub fn libinput_device_get_user_data( + device: *mut libinput_device, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the libinput context from the device.\n\n @param device A previously obtained device\n @return The libinput context for this device."] + pub fn libinput_device_get_context(device: *mut libinput_device) -> *mut libinput; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the device group this device is assigned to. Some physical\n devices like graphics tablets are represented by multiple kernel\n devices and thus by multiple struct @ref libinput_device.\n\n libinput assigns these devices to the same @ref libinput_device_group\n allowing the caller to identify such devices and adjust configuration\n settings accordingly. For example, setting a tablet to left-handed often\n means turning it upside down. A touch device on the same tablet would\n need to be turned upside down too to work correctly.\n\n All devices are part of a device group though for most devices the group\n will be a singleton. A device is assigned to a device group on @ref\n LIBINPUT_EVENT_DEVICE_ADDED and removed from that group on @ref\n LIBINPUT_EVENT_DEVICE_REMOVED. It is up to the caller to track how many\n devices are in each device group.\n\n @dot\n digraph groups_libinput {\n rankdir=\"TB\";\n node [\n shape=\"box\";\n ]\n\n mouse [ label=\"mouse\"; URL=\"\\ref libinput_device\"];\n kbd [ label=\"keyboard\"; URL=\"\\ref libinput_device\"];\n\n pen [ label=\"tablet pen\"; URL=\"\\ref libinput_device\"];\n touch [ label=\"tablet touch\"; URL=\"\\ref libinput_device\"];\n pad [ label=\"tablet pad\"; URL=\"\\ref libinput_device\"];\n\n group1 [ label=\"group 1\"; URL=\"\\ref libinput_device_group\"];\n group2 [ label=\"group 2\"; URL=\"\\ref libinput_device_group\"];\n group3 [ label=\"group 3\"; URL=\"\\ref libinput_device_group\"];\n\n mouse -> group1\n kbd -> group2\n\n pen -> group3;\n touch -> group3;\n pad -> group3;\n }\n @enddot\n\n Device groups do not get re-used once the last device in the group was\n removed, i.e. unplugging and re-plugging a physical device with grouped\n devices will return a different device group after every unplug.\n\n The returned device group is not refcounted and may become invalid after\n the next call to libinput. Use libinput_device_group_ref() and\n libinput_device_group_unref() to continue using the handle outside of the\n immediate scope.\n\n Device groups are assigned based on the LIBINPUT_DEVICE_GROUP udev\n property, see the libinput documentation for more details.\n\n @return The device group this device belongs to"] + pub fn libinput_device_get_device_group( + device: *mut libinput_device, + ) -> *mut libinput_device_group; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the system name of the device.\n\n To get the descriptive device name, use libinput_device_get_name().\n\n @param device A previously obtained device\n @return System name of the device\n"] + pub fn libinput_device_get_sysname( + device: *mut libinput_device, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = " @ingroup device\n\n The descriptive device name as advertised by the kernel and/or the\n hardware itself. To get the sysname for this device, use\n libinput_device_get_sysname().\n\n The lifetime of the returned string is tied to the struct\n libinput_device. The string may be the empty string but is never NULL.\n\n @param device A previously obtained device\n @return The device name"] + pub fn libinput_device_get_name(device: *mut libinput_device) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the product ID for this device.\n\n @param device A previously obtained device\n @return The product ID of this device"] + pub fn libinput_device_get_id_product(device: *mut libinput_device) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the vendor ID for this device.\n\n @param device A previously obtained device\n @return The vendor ID of this device"] + pub fn libinput_device_get_id_vendor(device: *mut libinput_device) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup device\n\n A device may be mapped to a single output, or all available outputs. If a\n device is mapped to a single output only, a relative device may not move\n beyond the boundaries of this output. An absolute device has its input\n coordinates mapped to the extents of this output.\n\n @note Use of this function is discouraged. Its return value is not\n precisely defined and may not be understood by the caller or may be\n insufficient to map the device. Instead, the system configuration could\n set a udev property the caller understands and interprets correctly. The\n caller could then obtain device with libinput_device_get_udev_device()\n and query it for this property. For more complex cases, the caller\n must implement monitor-to-device association heuristics.\n\n @return The name of the output this device is mapped to, or NULL if no\n output is set"] + pub fn libinput_device_get_output_name( + device: *mut libinput_device, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the seat associated with this input device.\n\n A seat can be uniquely identified by the physical and logical seat name.\n There will ever be only one seat instance with a given physical and logical\n seat name pair at any given time, but if no external reference is kept, it\n may be destroyed if no device belonging to it is left.\n\n The returned seat is not refcounted and may become invalid after\n the next call to libinput. Use libinput_seat_ref() and\n libinput_seat_unref() to continue using the handle outside of the\n immediate scope.\n\n See the libinput documentation for more information on seats.\n\n @param device A previously obtained device\n @return The seat this input device belongs to"] + pub fn libinput_device_get_seat(device: *mut libinput_device) -> *mut libinput_seat; +} +extern "C" { + #[doc = " @ingroup device\n\n Change the logical seat associated with this device by removing the\n device and adding it to the new seat.\n\n This command is identical to physically unplugging the device, then\n re-plugging it as a member of the new seat. libinput will generate a\n @ref LIBINPUT_EVENT_DEVICE_REMOVED event and this @ref libinput_device is\n considered removed from the context; it will not generate further events\n and will be freed when the refcount reaches zero.\n A @ref LIBINPUT_EVENT_DEVICE_ADDED event is generated with a new @ref\n libinput_device handle. It is the caller's responsibility to update\n references to the new device accordingly.\n\n If the logical seat name already exists in the device's physical seat,\n the device is added to this seat. Otherwise, a new seat is created.\n\n @note This change applies to this device until removal or @ref\n libinput_suspend(), whichever happens earlier.\n\n @param device A previously obtained device\n @param name The new logical seat name\n @return 0 on success, non-zero on error"] + pub fn libinput_device_set_seat_logical_name( + device: *mut libinput_device, + name: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Return a udev handle to the device that is this libinput device, if any.\n The returned handle has a refcount of at least 1, the caller must call\n udev_device_unref() once to release the associated resources.\n See the [libudev documentation]\n (http://www.freedesktop.org/software/systemd/libudev/) for details.\n\n Some devices may not have a udev device, or the udev device may be\n unobtainable. This function returns NULL if no udev device was available.\n\n Calling this function multiple times for the same device may not\n return the same udev handle each time.\n\n @param device A previously obtained device\n @return A udev handle to the device with a refcount of >= 1 or NULL.\n @retval NULL This device is not represented by a udev device"] + pub fn libinput_device_get_udev_device(device: *mut libinput_device) -> *mut udev_device; +} +extern "C" { + #[doc = " @ingroup device\n\n Update the LEDs on the device, if any. If the device does not have\n LEDs, or does not have one or more of the LEDs given in the mask, this\n function does nothing.\n\n @param device A previously obtained device\n @param leds A mask of the LEDs to set, or unset."] + pub fn libinput_device_led_update(device: *mut libinput_device, leds: libinput_led); +} +extern "C" { + #[doc = " @ingroup device\n\n Check if the given device has the specified capability\n\n @return Non-zero if the given device has the capability or zero otherwise"] + pub fn libinput_device_has_capability( + device: *mut libinput_device, + capability: libinput_device_capability, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Get the physical size of a device in mm, where meaningful. This function\n only succeeds on devices with the required data, i.e. tablets, touchpads\n and touchscreens.\n\n If this function returns nonzero, width and height are unmodified.\n\n @param device The device\n @param width Set to the width of the device\n @param height Set to the height of the device\n @return 0 on success, or nonzero otherwise"] + pub fn libinput_device_get_size( + device: *mut libinput_device, + width: *mut f64, + height: *mut f64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Check if a @ref LIBINPUT_DEVICE_CAP_POINTER device has a button with the\n given code (see linux/input-event-codes.h).\n\n @param device A current input device\n @param code Button code to check for, e.g. BTN_LEFT\n\n @return 1 if the device supports this button code, 0 if it does not, -1\n on error."] + pub fn libinput_device_pointer_has_button( + device: *mut libinput_device, + code: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Check if a @ref LIBINPUT_DEVICE_CAP_KEYBOARD device has a key with the\n given code (see linux/input-event-codes.h).\n\n @param device A current input device\n @param code Key code to check for, e.g. KEY_ESC\n\n @return 1 if the device supports this key code, 0 if it does not, -1\n on error."] + pub fn libinput_device_keyboard_has_key( + device: *mut libinput_device, + code: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Check how many touches a @ref LIBINPUT_DEVICE_CAP_TOUCH device supports\n simultaneously.\n\n @param device A current input device\n\n @return The number of simultaneous touches or 0 if unknown, -1\n on error.\n\n @since 1.11"] + pub fn libinput_device_touch_get_touch_count( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Check if a @ref LIBINPUT_DEVICE_CAP_SWITCH device has a switch of the\n given type.\n\n @param device A current input device\n @param sw Switch to check for\n\n @return 1 if the device supports this switch, 0 if it does not, -1\n on error.\n\n @since 1.9"] + pub fn libinput_device_switch_has_switch( + device: *mut libinput_device, + sw: libinput_switch, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Return the number of buttons on a device with the\n @ref LIBINPUT_DEVICE_CAP_TABLET_PAD capability.\n Buttons on a pad device are numbered sequentially, see the\n libinput documentation for details.\n\n @param device A current input device\n\n @return The number of buttons supported by the device.\n\n @since 1.3"] + pub fn libinput_device_tablet_pad_get_num_buttons( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Return the number of rings a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides.\n\n @param device A current input device\n\n @return The number of rings or 0 if the device has no rings.\n\n @see libinput_event_tablet_pad_get_ring_number\n\n @since 1.3"] + pub fn libinput_device_tablet_pad_get_num_rings( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Return the number of strips a device with the @ref\n LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides.\n\n @param device A current input device\n\n @return The number of strips or 0 if the device has no strips.\n\n @see libinput_event_tablet_pad_get_strip_number\n\n @since 1.3"] + pub fn libinput_device_tablet_pad_get_num_strips( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Check if a @ref LIBINPUT_DEVICE_CAP_TABLET_PAD device has a key with the\n given code (see linux/input-event-codes.h).\n\n @param device A current input device\n @param code Key code to check for, e.g. KEY_ESC\n\n @return 1 if the device supports this key code, 0 if it does not, -1\n on error.\n\n @since 1.15"] + pub fn libinput_device_tablet_pad_has_key( + device: *mut libinput_device, + code: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup device\n\n Increase the refcount of the device group. A device group will be freed\n whenever the refcount reaches 0. This may happen during\n libinput_dispatch() if all devices of this group were removed from the\n system. A caller must ensure to reference the device group correctly to\n avoid dangling pointers.\n\n @param group A previously obtained device group\n @return The passed device group"] + pub fn libinput_device_group_ref( + group: *mut libinput_device_group, + ) -> *mut libinput_device_group; +} +extern "C" { + #[doc = " @ingroup device\n\n Decrease the refcount of the device group. A device group will be freed\n whenever the refcount reaches 0. This may happen during\n libinput_dispatch() if all devices of this group were removed from the\n system. A caller must ensure to reference the device group correctly to\n avoid dangling pointers.\n\n @param group A previously obtained device group\n @return NULL if the device group was destroyed, otherwise the passed\n device group"] + pub fn libinput_device_group_unref( + group: *mut libinput_device_group, + ) -> *mut libinput_device_group; +} +extern "C" { + #[doc = " @ingroup device\n\n Set caller-specific data associated with this device group. libinput does\n not manage, look at, or modify this data. The caller must ensure the\n data is valid.\n\n @param group A previously obtained device group\n @param user_data Caller-specific data pointer\n @see libinput_device_group_get_user_data"] + pub fn libinput_device_group_set_user_data( + group: *mut libinput_device_group, + user_data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + #[doc = " @ingroup device\n\n Get the caller-specific data associated with this input device group, if\n any.\n\n @param group A previously obtained group\n @return Caller-specific data pointer or NULL if none was set\n @see libinput_device_group_set_user_data"] + pub fn libinput_device_group_get_user_data( + group: *mut libinput_device_group, + ) -> *mut ::std::os::raw::c_void; +} +#[doc = "< Config applied successfully"] +pub const libinput_config_status_LIBINPUT_CONFIG_STATUS_SUCCESS: libinput_config_status = 0; +#[doc = "< Configuration not available on\nthis device"] +pub const libinput_config_status_LIBINPUT_CONFIG_STATUS_UNSUPPORTED: libinput_config_status = 1; +#[doc = "< Invalid parameter range"] +pub const libinput_config_status_LIBINPUT_CONFIG_STATUS_INVALID: libinput_config_status = 2; +#[doc = " @ingroup config\n\n Status codes returned when applying configuration settings."] +pub type libinput_config_status = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Return a string describing the error.\n\n @param status The status to translate to a string\n @return A human-readable string representing the error or NULL for an\n invalid status."] + pub fn libinput_config_status_to_str( + status: libinput_config_status, + ) -> *const ::std::os::raw::c_char; +} +#[doc = "< Tapping is to be disabled, or is\ncurrently disabled"] +pub const libinput_config_tap_state_LIBINPUT_CONFIG_TAP_DISABLED: libinput_config_tap_state = 0; +#[doc = "< Tapping is to be enabled, or is\ncurrently enabled"] +pub const libinput_config_tap_state_LIBINPUT_CONFIG_TAP_ENABLED: libinput_config_tap_state = 1; +#[doc = " @ingroup config"] +pub type libinput_config_tap_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Check if the device supports tap-to-click and how many fingers can be\n used for tapping. See\n libinput_device_config_tap_set_enabled() for more information.\n\n @param device The device to configure\n @return The number of fingers that can generate a tap event, or 0 if the\n device does not support tapping.\n\n @see libinput_device_config_tap_set_enabled\n @see libinput_device_config_tap_get_enabled\n @see libinput_device_config_tap_get_default_enabled"] + pub fn libinput_device_config_tap_get_finger_count( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable tap-to-click on this device, with a default mapping of\n 1, 2, 3 finger tap mapping to left, right, middle click, respectively.\n Tapping is limited by the number of simultaneous touches\n supported by the device, see\n libinput_device_config_tap_get_finger_count().\n\n @param device The device to configure\n @param enable @ref LIBINPUT_CONFIG_TAP_ENABLED to enable tapping or @ref\n LIBINPUT_CONFIG_TAP_DISABLED to disable tapping\n\n @return A config status code. Disabling tapping on a device that does not\n support tapping always succeeds.\n\n @see libinput_device_config_tap_get_finger_count\n @see libinput_device_config_tap_get_enabled\n @see libinput_device_config_tap_get_default_enabled"] + pub fn libinput_device_config_tap_set_enabled( + device: *mut libinput_device, + enable: libinput_config_tap_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if tap-to-click is enabled on this device. If the device does not\n support tapping, this function always returns @ref\n LIBINPUT_CONFIG_TAP_DISABLED.\n\n @param device The device to configure\n\n @retval LIBINPUT_CONFIG_TAP_ENABLED If tapping is currently enabled\n @retval LIBINPUT_CONFIG_TAP_DISABLED If tapping is currently disabled\n\n @see libinput_device_config_tap_get_finger_count\n @see libinput_device_config_tap_set_enabled\n @see libinput_device_config_tap_get_default_enabled"] + pub fn libinput_device_config_tap_get_enabled( + device: *mut libinput_device, + ) -> libinput_config_tap_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Return the default setting for whether tap-to-click is enabled on this\n device.\n\n @param device The device to configure\n @retval LIBINPUT_CONFIG_TAP_ENABLED If tapping is enabled by default\n @retval LIBINPUT_CONFIG_TAP_DISABLED If tapping Is disabled by default\n\n @see libinput_device_config_tap_get_finger_count\n @see libinput_device_config_tap_set_enabled\n @see libinput_device_config_tap_get_enabled"] + pub fn libinput_device_config_tap_get_default_enabled( + device: *mut libinput_device, + ) -> libinput_config_tap_state; +} +#[doc = " 1/2/3 finger tap maps to left/right/middle"] +pub const libinput_config_tap_button_map_LIBINPUT_CONFIG_TAP_MAP_LRM: + libinput_config_tap_button_map = 0; +#[doc = " 1/2/3 finger tap maps to left/middle/right"] +pub const libinput_config_tap_button_map_LIBINPUT_CONFIG_TAP_MAP_LMR: + libinput_config_tap_button_map = 1; +#[doc = " @ingroup config\n\n @since 1.5"] +pub type libinput_config_tap_button_map = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Set the finger number to button number mapping for tap-to-click. The\n default mapping on most devices is to have a 1, 2 and 3 finger tap to map\n to the left, right and middle button, respectively.\n A device may permit changing the button mapping but disallow specific\n maps. In this case @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED is returned,\n the caller is expected to handle this case correctly.\n\n Changing the button mapping may not take effect immediately,\n the device may wait until it is in a neutral state before applying any\n changes.\n\n The mapping may be changed when tap-to-click is disabled. The new mapping\n takes effect when tap-to-click is enabled in the future.\n\n @note It is an application bug to call this function for devices where\n libinput_device_config_tap_get_finger_count() returns 0.\n\n @param device The device to configure\n @param map The new finger-to-button number mapping\n @return A config status code. Changing the order on a device that does not\n support tapping always fails with @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED.\n\n @see libinput_device_config_tap_get_button_map\n @see libinput_device_config_tap_get_default_button_map\n\n @since 1.5"] + pub fn libinput_device_config_tap_set_button_map( + device: *mut libinput_device, + map: libinput_config_tap_button_map, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the finger number to button number mapping for tap-to-click.\n\n The return value for a device that does not support tapping is always\n @ref LIBINPUT_CONFIG_TAP_MAP_LRM.\n\n @note It is an application bug to call this function for devices where\n libinput_device_config_tap_get_finger_count() returns 0.\n\n @param device The device to configure\n @return The current finger-to-button number mapping\n\n @see libinput_device_config_tap_set_button_map\n @see libinput_device_config_tap_get_default_button_map\n\n @since 1.5"] + pub fn libinput_device_config_tap_get_button_map( + device: *mut libinput_device, + ) -> libinput_config_tap_button_map; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default finger number to button number mapping for tap-to-click.\n\n The return value for a device that does not support tapping is always\n @ref LIBINPUT_CONFIG_TAP_MAP_LRM.\n\n @note It is an application bug to call this function for devices where\n libinput_device_config_tap_get_finger_count() returns 0.\n\n @param device The device to configure\n @return The current finger-to-button number mapping\n\n @see libinput_device_config_tap_set_button_map\n @see libinput_device_config_tap_get_default_button_map\n\n @since 1.5"] + pub fn libinput_device_config_tap_get_default_button_map( + device: *mut libinput_device, + ) -> libinput_config_tap_button_map; +} +#[doc = " Drag is to be disabled, or is\n currently disabled."] +pub const libinput_config_drag_state_LIBINPUT_CONFIG_DRAG_DISABLED: libinput_config_drag_state = 0; +#[doc = " Drag is to be enabled, or is\n currently enabled"] +pub const libinput_config_drag_state_LIBINPUT_CONFIG_DRAG_ENABLED: libinput_config_drag_state = 1; +#[doc = " @ingroup config\n\n A config status to distinguish or set dragging on a device. Currently\n implemented for tap-and-drag only, see\n libinput_device_config_tap_set_drag_enabled()\n\n @since 1.2"] +pub type libinput_config_drag_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable tap-and-drag on this device. When enabled, a\n tap immediately followed by a finger down results in a button down event,\n subsequent finger motion thus triggers a drag. The button is released\n on finger up. See the libinput documentation for more details.\n\n @param device The device to configure\n @param enable @ref LIBINPUT_CONFIG_DRAG_ENABLED to enable, @ref\n LIBINPUT_CONFIG_DRAG_DISABLED to disable tap-and-drag\n\n @see libinput_device_config_tap_drag_get_enabled\n @see libinput_device_config_tap_drag_get_default_enabled\n\n @since 1.2"] + pub fn libinput_device_config_tap_set_drag_enabled( + device: *mut libinput_device, + enable: libinput_config_drag_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Return whether tap-and-drag is enabled or disabled on this device.\n\n @param device The device to check\n @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled\n @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is\n disabled\n\n @see libinput_device_config_tap_drag_set_enabled\n @see libinput_device_config_tap_drag_get_default_enabled\n\n @since 1.2"] + pub fn libinput_device_config_tap_get_drag_enabled( + device: *mut libinput_device, + ) -> libinput_config_drag_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Return whether tap-and-drag is enabled or disabled by default on this\n device.\n\n @param device The device to check\n @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled by\n default\n @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is\n disabled by default\n\n @see libinput_device_config_tap_drag_set_enabled\n @see libinput_device_config_tap_drag_get_enabled\n\n @since 1.2"] + pub fn libinput_device_config_tap_get_default_drag_enabled( + device: *mut libinput_device, + ) -> libinput_config_drag_state; +} +#[doc = " Drag lock is to be disabled, or is currently disabled"] +pub const libinput_config_drag_lock_state_LIBINPUT_CONFIG_DRAG_LOCK_DISABLED: + libinput_config_drag_lock_state = 0; +#[doc = " Drag lock is to be enabled, or is currently disabled"] +pub const libinput_config_drag_lock_state_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED: + libinput_config_drag_lock_state = 1; +#[doc = " @ingroup config"] +pub type libinput_config_drag_lock_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable drag-lock during tapping on this device. When enabled,\n a finger may be lifted and put back on the touchpad within a timeout and\n the drag process continues. When disabled, lifting the finger during a\n tap-and-drag will immediately stop the drag. See the libinput\n documentation for more details.\n\n Enabling drag lock on a device that has tapping disabled is permitted,\n but has no effect until tapping is enabled.\n\n @param device The device to configure\n @param enable @ref LIBINPUT_CONFIG_DRAG_LOCK_ENABLED to enable drag lock\n or @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED to disable drag lock\n\n @return A config status code. Disabling drag lock on a device that does not\n support tapping always succeeds.\n\n @see libinput_device_config_tap_get_drag_lock_enabled\n @see libinput_device_config_tap_get_default_drag_lock_enabled"] + pub fn libinput_device_config_tap_set_drag_lock_enabled( + device: *mut libinput_device, + enable: libinput_config_drag_lock_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if drag-lock during tapping is enabled on this device. If the\n device does not support tapping, this function always returns\n @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED.\n\n Drag lock may be enabled even when tapping is disabled.\n\n @param device The device to configure\n\n @retval LIBINPUT_CONFIG_DRAG_LOCK_ENABLED If drag lock is currently enabled\n @retval LIBINPUT_CONFIG_DRAG_LOCK_DISABLED If drag lock is currently disabled\n\n @see libinput_device_config_tap_set_drag_lock_enabled\n @see libinput_device_config_tap_get_default_drag_lock_enabled"] + pub fn libinput_device_config_tap_get_drag_lock_enabled( + device: *mut libinput_device, + ) -> libinput_config_drag_lock_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if drag-lock during tapping is enabled by default on this device.\n If the device does not support tapping, this function always returns\n @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED.\n\n Drag lock may be enabled by default even when tapping is disabled by\n default.\n\n @param device The device to configure\n\n @retval LIBINPUT_CONFIG_DRAG_LOCK_ENABLED If drag lock is enabled by\n default\n @retval LIBINPUT_CONFIG_DRAG_LOCK_DISABLED If drag lock is disabled by\n default\n\n @see libinput_device_config_tap_set_drag_lock_enabled\n @see libinput_device_config_tap_get_drag_lock_enabled"] + pub fn libinput_device_config_tap_get_default_drag_lock_enabled( + device: *mut libinput_device, + ) -> libinput_config_drag_lock_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if the device can be calibrated via a calibration matrix.\n\n @param device The device to check\n @return Non-zero if the device can be calibrated, zero otherwise.\n\n @see libinput_device_config_calibration_set_matrix\n @see libinput_device_config_calibration_get_matrix\n @see libinput_device_config_calibration_get_default_matrix"] + pub fn libinput_device_config_calibration_has_matrix( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Apply the 3x3 transformation matrix to absolute device coordinates. This\n matrix has no effect on relative events.\n\n Given a 6-element array [a, b, c, d, e, f], the matrix is applied as\n @code\n [ a b c ] [ x ]\n [ d e f ] * [ y ]\n [ 0 0 1 ] [ 1 ]\n @endcode\n\n The translation component (c, f) is expected to be normalized to the\n device coordinate range. For example, the matrix\n @code\n [ 1 0 1 ]\n [ 0 1 -1 ]\n [ 0 0 1 ]\n @endcode\n moves all coordinates by 1 device-width to the right and 1 device-height\n up.\n\n The rotation matrix for rotation around the origin is defined as\n @code\n [ cos(a) -sin(a) 0 ]\n [ sin(a) cos(a) 0 ]\n [ 0 0 1 ]\n @endcode\n Note that any rotation requires an additional translation component to\n translate the rotated coordinates back into the original device space.\n The rotation matrixes for 90, 180 and 270 degrees clockwise are:\n @code\n 90 deg cw:\t\t180 deg cw:\t\t270 deg cw:\n [ 0 -1 1]\t\t[ -1 0 1]\t\t[ 0 1 0 ]\n [ 1 0 0]\t\t[ 0 -1 1]\t\t[ -1 0 1 ]\n [ 0 0 1]\t\t[ 0 0 1]\t\t[ 0 0 1 ]\n @endcode\n\n @param device The device to configure\n @param matrix An array representing the first two rows of a 3x3 matrix as\n described above.\n\n @return A config status code.\n\n @see libinput_device_config_calibration_has_matrix\n @see libinput_device_config_calibration_get_matrix\n @see libinput_device_config_calibration_get_default_matrix"] + pub fn libinput_device_config_calibration_set_matrix( + device: *mut libinput_device, + matrix: *const f32, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Return the current calibration matrix for this device.\n\n @param device The device to configure\n @param matrix Set to the array representing the first two rows of a 3x3 matrix as\n described in libinput_device_config_calibration_set_matrix().\n\n @return 0 if no calibration is set and the returned matrix is the\n identity matrix, 1 otherwise\n\n @see libinput_device_config_calibration_has_matrix\n @see libinput_device_config_calibration_set_matrix\n @see libinput_device_config_calibration_get_default_matrix"] + pub fn libinput_device_config_calibration_get_matrix( + device: *mut libinput_device, + matrix: *mut f32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Return the default calibration matrix for this device. On most devices,\n this is the identity matrix. If the udev property\n LIBINPUT_CALIBRATION_MATRIX is set on the respective udev device,\n that property's value becomes the default matrix, see the libinput\n documentation for more details.\n\n @param device The device to configure\n @param matrix Set to the array representing the first two rows of a 3x3 matrix as\n described in libinput_device_config_calibration_set_matrix().\n\n @return 0 if no calibration is set and the returned matrix is the\n identity matrix, 1 otherwise\n\n @see libinput_device_config_calibration_has_matrix\n @see libinput_device_config_calibration_set_matrix\n @see libinput_device_config_calibration_get_matrix"] + pub fn libinput_device_config_calibration_get_default_matrix( + device: *mut libinput_device, + matrix: *mut f32, + ) -> ::std::os::raw::c_int; +} +#[doc = " Send events from this device normally. This is a placeholder\n mode only, any device detected by libinput can be enabled. Do not\n test for this value as bitmask."] +pub const libinput_config_send_events_mode_LIBINPUT_CONFIG_SEND_EVENTS_ENABLED: + libinput_config_send_events_mode = 0; +#[doc = " Do not send events through this device. Depending on the device,\n this may close all file descriptors on the device or it may leave\n the file descriptors open and route events through a different\n device.\n\n If this bit field is set, other disable modes may be\n ignored. For example, if both @ref\n LIBINPUT_CONFIG_SEND_EVENTS_DISABLED and @ref\n LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE are set,\n the device remains disabled when all external pointer devices are\n unplugged."] +pub const libinput_config_send_events_mode_LIBINPUT_CONFIG_SEND_EVENTS_DISABLED: + libinput_config_send_events_mode = 1; +#[doc = " If an external pointer device is plugged in, do not send events\n from this device. This option may be available on built-in\n touchpads."] +pub const libinput_config_send_events_mode_LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE : libinput_config_send_events_mode = 2 ; +#[doc = " @ingroup config\n\n The send-event mode of a device defines when a device may generate events\n and pass those events to the caller."] +pub type libinput_config_send_events_mode = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Return the possible send-event modes for this device. These modes define\n when a device may process and send events.\n\n @param device The device to configure\n\n @return A bitmask of possible modes.\n\n @see libinput_device_config_send_events_set_mode\n @see libinput_device_config_send_events_get_mode\n @see libinput_device_config_send_events_get_default_mode"] + pub fn libinput_device_config_send_events_get_modes(device: *mut libinput_device) -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the send-event mode for this device. The mode defines when the device\n processes and sends events to the caller.\n\n The selected mode may not take effect immediately. Events already\n received and processed from this device are unaffected and will be passed\n to the caller on the next call to libinput_get_event().\n\n If the mode is a bitmask of @ref libinput_config_send_events_mode,\n the device may wait for or generate events until it is in a neutral\n state. For example, this may include waiting for or generating button\n release events.\n\n If the device is already suspended, this function does nothing and\n returns success. Changing the send-event mode on a device that has been\n removed is permitted.\n\n @param device The device to configure\n @param mode A bitmask of send-events modes\n\n @return A config status code.\n\n @see libinput_device_config_send_events_get_modes\n @see libinput_device_config_send_events_get_mode\n @see libinput_device_config_send_events_get_default_mode"] + pub fn libinput_device_config_send_events_set_mode( + device: *mut libinput_device, + mode: u32, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the send-event mode for this device. The mode defines when the device\n processes and sends events to the caller.\n\n If a caller enables the bits for multiple modes, some of which are\n subsets of another mode libinput may drop the bits that are subsets. In\n other words, don't expect libinput_device_config_send_events_get_mode()\n to always return exactly the same bitmask as passed into\n libinput_device_config_send_events_set_mode().\n\n @param device The device to configure\n @return The current bitmask of the send-event mode for this device.\n\n @see libinput_device_config_send_events_get_modes\n @see libinput_device_config_send_events_set_mode\n @see libinput_device_config_send_events_get_default_mode"] + pub fn libinput_device_config_send_events_get_mode(device: *mut libinput_device) -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default send-event mode for this device. The mode defines when\n the device processes and sends events to the caller.\n\n @param device The device to configure\n @return The bitmask of the send-event mode for this device.\n\n @see libinput_device_config_send_events_get_modes\n @see libinput_device_config_send_events_set_mode\n @see libinput_device_config_send_events_get_mode"] + pub fn libinput_device_config_send_events_get_default_mode(device: *mut libinput_device) + -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if a device uses libinput-internal pointer-acceleration.\n\n @param device The device to configure\n\n @return 0 if the device is not accelerated, nonzero if it is accelerated\n\n @see libinput_device_config_accel_set_speed\n @see libinput_device_config_accel_get_speed\n @see libinput_device_config_accel_get_default_speed"] + pub fn libinput_device_config_accel_is_available( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the pointer acceleration speed of this pointer device within a range\n of [-1, 1], where 0 is the default acceleration for this device, -1 is\n the slowest acceleration and 1 is the maximum acceleration available on\n this device. The actual pointer acceleration mechanism is\n implementation-dependent, as is the number of steps available within the\n range. libinput picks the semantically closest acceleration step if the\n requested value does not match a discrete setting.\n\n @param device The device to configure\n @param speed The normalized speed, in a range of [-1, 1]\n\n @return A config status code\n\n @see libinput_device_config_accel_is_available\n @see libinput_device_config_accel_get_speed\n @see libinput_device_config_accel_get_default_speed"] + pub fn libinput_device_config_accel_set_speed( + device: *mut libinput_device, + speed: f64, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the current pointer acceleration setting for this pointer device. The\n returned value is normalized to a range of [-1, 1].\n See libinput_device_config_accel_set_speed() for details.\n\n If the current acceleration profile is @ref\n LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM, the behavior of the\n device will not change but future calls to\n libinput_device_config_accel_get_speed() will reflect the updated speed\n setting.\n\n @param device The device to configure\n\n @return The current speed, range -1 to 1\n\n @see libinput_device_config_accel_is_available\n @see libinput_device_config_accel_set_speed\n @see libinput_device_config_accel_get_default_speed"] + pub fn libinput_device_config_accel_get_speed(device: *mut libinput_device) -> f64; +} +extern "C" { + #[doc = " @ingroup config\n\n Return the default speed setting for this device, normalized to a range\n of [-1, 1].\n See libinput_device_config_accel_set_speed() for details.\n\n @param device The device to configure\n @return The default speed setting for this device.\n\n @see libinput_device_config_accel_is_available\n @see libinput_device_config_accel_set_speed\n @see libinput_device_config_accel_get_speed"] + pub fn libinput_device_config_accel_get_default_speed(device: *mut libinput_device) -> f64; +} +#[doc = " Placeholder for devices that don't have a configurable pointer\n acceleration profile."] +pub const libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_NONE: + libinput_config_accel_profile = 0; +#[doc = " A flat acceleration profile. Pointer motion is accelerated by a\n constant (device-specific) factor, depending on the current\n speed.\n\n @see libinput_device_config_accel_set_speed"] +pub const libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT: + libinput_config_accel_profile = 1; +#[doc = " An adaptive acceleration profile. Pointer acceleration depends\n on the input speed. This is the default profile for most devices."] +pub const libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE: + libinput_config_accel_profile = 2; +#[doc = " A custom acceleration profile. Device movement acceleration depends\n on user defined custom acceleration functions for each movement\n type.\n\n @see libinput_device_config_accel_set_points"] +pub const libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM: + libinput_config_accel_profile = 4; +#[doc = " @ingroup config\n\n @since 1.1"] +pub type libinput_config_accel_profile = ::std::os::raw::c_uint; +#[doc = " @ingroup config\n\n A handle for configuration pointer acceleration.\n\n @warning Unlike other structs pointer acceleration configuration is\n considered transient and not refcounted. Calling\n libinput_config_accel_destroy() will destroy the configuration.\n\n To configure pointer acceleration, first create a config of a desired\n acceleration profile with libinput_config_accel_create(), then\n configure the profile-specific acceleration properties.\n\n In this version of libinput, this pointer acceleration configuration\n only provides configuration for @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.\n\n For @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM use\n @ref libinput_config_accel_set_points.\n\n Once set up, apply the configuration to a device using\n libinput_device_config_accel_apply(). Once applied,\n destroy it with libinput_config_accel_destroy().\n\n @since 1.23"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct libinput_config_accel { + _unused: [u8; 0], +} +extern "C" { + #[doc = " @ingroup config\n\n Create an acceleration configuration of a given profile.\n\n Note that in this version of libinput, only the\n @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM profile provides configuration\n options. All other acceleration profiles, when applied, will merely switch\n the profile and reset any profile-specific options to the default values.\n\n @param profile The profile of the newly created acceleration configuration.\n\n @return The newly created acceleration configuration or NULL on error.\n\n @warning Unlike other structs pointer acceleration configuration is\n considered transient and not refcounted. Calling\n libinput_config_accel_destroy() will destroy the configuration.\n\n @see libinput_config_accel\n @since 1.23"] + pub fn libinput_config_accel_create( + profile: libinput_config_accel_profile, + ) -> *mut libinput_config_accel; +} +extern "C" { + #[doc = " @ingroup config\n\n Destroy an acceleration configuration.\n\n @warning Unlike other structs pointer acceleration configuration is\n considered transient and not refcounted. Calling\n libinput_config_accel_destroy() will destroy the configuration.\n\n @param accel_config The acceleration configuration to destroy.\n\n @see libinput_config_accel\n @since 1.23"] + pub fn libinput_config_accel_destroy(accel_config: *mut libinput_config_accel); +} +extern "C" { + #[doc = " @ingroup config\n\n Apply this pointer acceleration configuration to the device. This changes the\n device's pointer acceleration method to the method given in\n libinput_config_accel_create() and applies all other configuration settings.\n\n Once applied, call libinput_config_accel_destroy() to destroy the\n configuration struct.\n\n @param device The device to configure.\n @param accel_config The acceleration configuration.\n\n @return A config status code.\n\n @see libinput_config_accel\n @since 1.23"] + pub fn libinput_device_config_accel_apply( + device: *mut libinput_device, + accel_config: *mut libinput_config_accel, + ) -> libinput_config_status; +} +#[doc = " The default acceleration type used as a fallback when other\n acceleration types are not provided."] +pub const libinput_config_accel_type_LIBINPUT_ACCEL_TYPE_FALLBACK: libinput_config_accel_type = 0; +#[doc = " Acceleration type for regular pointer movement. This\n type is always supported."] +pub const libinput_config_accel_type_LIBINPUT_ACCEL_TYPE_MOTION: libinput_config_accel_type = 1; +#[doc = " Acceleration type for scroll movement.\n This type is supported by mouse and touchpad."] +pub const libinput_config_accel_type_LIBINPUT_ACCEL_TYPE_SCROLL: libinput_config_accel_type = 2; +#[doc = " @ingroup config\n\n Acceleration types are categories of movement by a device that may have\n specific acceleration functions applied. A device always supports the\n @ref LIBINPUT_ACCEL_TYPE_MOTION type (for regular pointer motion). Other\n types (e.g. scrolling) may be added in the future.\n\n The special type @ref LIBINPUT_ACCEL_TYPE_FALLBACK specifies the acceleration\n function to be moved for any movement produced by the device that does not\n have a specific acceleration type defined.\n\n Use to specify the acceleration function type in\n @ref libinput_config_accel_set_points\n\n Each device implements a subset of those types, see a list of supported\n devices for each movement type definition.\n\n @see LIBINPUT_ACCEL_ARG_TYPE\n @since 1.23"] +pub type libinput_config_accel_type = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Defines the acceleration function for a given movement type\n in an acceleration configuration with the profile\n @ref LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.\n\n Movement types are specific to each device, @see libinput_config_accel_type.\n\n Each custom acceleration function is defined by ``n`` points spaced uniformly\n along the x-axis starting from 0 and continuing in a constant step size.\n There by the function is defined by the following points:\n (0 * step, f[0]), (1 * step, f[1]), ..., ((n - 1) * step, f[n - 1]).\n The x-axis represents the device-speed in device units per millisecond.\n The y-axis represents the pointer-speed.\n\n It is up to the user to define those values in accordance with device DPI\n and screen DPI.\n\n @param accel_config The acceleration configuration to modify.\n @param accel_type The movement type to configure a custom function for.\n @param step The distance between each point along the x-axis.\n @param npoints The number of points of the custom acceleration function.\n @param points The points' y-values of the custom acceleration function.\n\n @return A config status code.\n\n @see libinput_config_accel\n @since 1.23"] + pub fn libinput_config_accel_set_points( + accel_config: *mut libinput_config_accel, + accel_type: libinput_config_accel_type, + step: f64, + npoints: usize, + points: *mut f64, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Returns a bitmask of the configurable acceleration modes available on\n this device.\n\n @param device The device to configure\n\n @return A bitmask of all configurable modes available on this device.\n\n @since 1.1"] + pub fn libinput_device_config_accel_get_profiles(device: *mut libinput_device) -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the pointer acceleration profile of this pointer device to the given\n mode.\n\n @param device The device to configure\n @param profile The profile to set the device to.\n\n @return A config status code\n\n @since 1.1"] + pub fn libinput_device_config_accel_set_profile( + device: *mut libinput_device, + profile: libinput_config_accel_profile, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the current pointer acceleration profile for this pointer device.\n\n @param device The device to configure\n\n @return The currently configured pointer acceleration profile.\n\n @since 1.1"] + pub fn libinput_device_config_accel_get_profile( + device: *mut libinput_device, + ) -> libinput_config_accel_profile; +} +extern "C" { + #[doc = " @ingroup config\n\n Return the default pointer acceleration profile for this pointer device.\n\n @param device The device to configure\n\n @return The default acceleration profile for this device.\n\n @since 1.1"] + pub fn libinput_device_config_accel_get_default_profile( + device: *mut libinput_device, + ) -> libinput_config_accel_profile; +} +extern "C" { + #[doc = " @ingroup config\n\n Return non-zero if the device supports \"natural scrolling\".\n\n In traditional scroll mode, the movement of fingers on a touchpad when\n scrolling matches the movement of the scroll bars. When the fingers move\n down, the scroll bar moves down, a line of text on the screen moves\n towards the upper end of the screen. This also matches scroll wheels on\n mice (wheel down, content moves up).\n\n Natural scrolling is the term coined by Apple for inverted scrolling.\n In this mode, the effect of scrolling movement of fingers on a touchpad\n resemble physical manipulation of paper. When the fingers move down, a\n line of text on the screen moves down (scrollbars move up). This is the\n opposite of scroll wheels on mice.\n\n A device supporting natural scrolling can be switched between traditional\n scroll mode and natural scroll mode.\n\n @param device The device to configure\n\n @return Zero if natural scrolling is not supported, non-zero if natural\n scrolling is supported by this device\n\n @see libinput_device_config_scroll_set_natural_scroll_enabled\n @see libinput_device_config_scroll_get_natural_scroll_enabled\n @see libinput_device_config_scroll_get_default_natural_scroll_enabled"] + pub fn libinput_device_config_scroll_has_natural_scroll( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable natural scrolling on the device.\n\n @param device The device to configure\n @param enable non-zero to enable, zero to disable natural scrolling\n\n @return A config status code\n\n @see libinput_device_config_scroll_has_natural_scroll\n @see libinput_device_config_scroll_get_natural_scroll_enabled\n @see libinput_device_config_scroll_get_default_natural_scroll_enabled"] + pub fn libinput_device_config_scroll_set_natural_scroll_enabled( + device: *mut libinput_device, + enable: ::std::os::raw::c_int, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the current mode for scrolling on this device\n\n @param device The device to configure\n\n @return Zero if natural scrolling is disabled, non-zero if enabled\n\n @see libinput_device_config_scroll_has_natural_scroll\n @see libinput_device_config_scroll_set_natural_scroll_enabled\n @see libinput_device_config_scroll_get_default_natural_scroll_enabled"] + pub fn libinput_device_config_scroll_get_natural_scroll_enabled( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default mode for scrolling on this device\n\n @param device The device to configure\n\n @return Zero if natural scrolling is disabled by default, non-zero if enabled\n\n @see libinput_device_config_scroll_has_natural_scroll\n @see libinput_device_config_scroll_set_natural_scroll_enabled\n @see libinput_device_config_scroll_get_natural_scroll_enabled"] + pub fn libinput_device_config_scroll_get_default_natural_scroll_enabled( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if a device has a configuration that supports left-handed usage.\n\n @param device The device to configure\n @return Non-zero if the device can be set to left-handed, or zero\n otherwise\n\n @see libinput_device_config_left_handed_set\n @see libinput_device_config_left_handed_get\n @see libinput_device_config_left_handed_get_default"] + pub fn libinput_device_config_left_handed_is_available( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the left-handed configuration of the device.\n\n The exact behavior is device-dependent. On a mouse and most pointing\n devices, left and right buttons are swapped but the middle button is\n unmodified. On a touchpad, physical buttons (if present) are swapped. On a\n clickpad, the top and bottom software-emulated buttons are swapped where\n present, the main area of the touchpad remains a left button. Tapping and\n clickfinger behavior is not affected by this setting.\n\n Changing the left-handed configuration of a device may not take effect\n until all buttons have been logically released.\n\n @param device The device to configure\n @param left_handed Zero to disable, non-zero to enable left-handed mode\n @return A configuration status code\n\n @see libinput_device_config_left_handed_is_available\n @see libinput_device_config_left_handed_get\n @see libinput_device_config_left_handed_get_default"] + pub fn libinput_device_config_left_handed_set( + device: *mut libinput_device, + left_handed: ::std::os::raw::c_int, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the current left-handed configuration of the device.\n\n @param device The device to configure\n @return Zero if the device is in right-handed mode, non-zero if the\n device is in left-handed mode\n\n @see libinput_device_config_left_handed_is_available\n @see libinput_device_config_left_handed_set\n @see libinput_device_config_left_handed_get_default"] + pub fn libinput_device_config_left_handed_get( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default left-handed configuration of the device.\n\n @param device The device to configure\n @return Zero if the device is in right-handed mode by default, or non-zero\n if the device is in left-handed mode by default\n\n @see libinput_device_config_left_handed_is_available\n @see libinput_device_config_left_handed_set\n @see libinput_device_config_left_handed_get"] + pub fn libinput_device_config_left_handed_get_default( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +#[doc = " Do not send software-emulated button events. This has no effect\n on events generated by physical buttons."] +pub const libinput_config_click_method_LIBINPUT_CONFIG_CLICK_METHOD_NONE: + libinput_config_click_method = 0; +#[doc = " Use software-button areas to generate button events."] +pub const libinput_config_click_method_LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS: + libinput_config_click_method = 1; +#[doc = " The number of fingers decides which button press to generate."] +pub const libinput_config_click_method_LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER: + libinput_config_click_method = 2; +#[doc = " @ingroup config\n\n The click method defines when to generate software-emulated\n buttons, usually on a device that does not have a specific physical\n button available."] +pub type libinput_config_click_method = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Check which button click methods a device supports. The button click\n method defines when to generate software-emulated buttons, usually on a\n device that does not have a specific physical button available.\n\n @param device The device to configure\n\n @return A bitmask of possible methods.\n\n @see libinput_device_config_click_get_methods\n @see libinput_device_config_click_set_method\n @see libinput_device_config_click_get_method"] + pub fn libinput_device_config_click_get_methods(device: *mut libinput_device) -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the button click method for this device. The button click\n method defines when to generate software-emulated buttons, usually on a\n device that does not have a specific physical button available.\n\n @note The selected click method may not take effect immediately. The\n device may require changing to a neutral state first before activating\n the new method.\n\n @param device The device to configure\n @param method The button click method\n\n @return A config status code\n\n @see libinput_device_config_click_get_methods\n @see libinput_device_config_click_get_method\n @see libinput_device_config_click_get_default_method"] + pub fn libinput_device_config_click_set_method( + device: *mut libinput_device, + method: libinput_config_click_method, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the button click method for this device. The button click\n method defines when to generate software-emulated buttons, usually on a\n device that does not have a specific physical button available.\n\n @param device The device to configure\n\n @return The current button click method for this device\n\n @see libinput_device_config_click_get_methods\n @see libinput_device_config_click_set_method\n @see libinput_device_config_click_get_default_method"] + pub fn libinput_device_config_click_get_method( + device: *mut libinput_device, + ) -> libinput_config_click_method; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default button click method for this device. The button click\n method defines when to generate software-emulated buttons, usually on a\n device that does not have a specific physical button available.\n\n @param device The device to configure\n\n @return The default button click method for this device\n\n @see libinput_device_config_click_get_methods\n @see libinput_device_config_click_set_method\n @see libinput_device_config_click_get_method"] + pub fn libinput_device_config_click_get_default_method( + device: *mut libinput_device, + ) -> libinput_config_click_method; +} +#[doc = " Middle mouse button emulation is to be disabled, or\n is currently disabled."] +pub const libinput_config_middle_emulation_state_LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED: + libinput_config_middle_emulation_state = 0; +#[doc = " Middle mouse button emulation is to be enabled, or\n is currently enabled."] +pub const libinput_config_middle_emulation_state_LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED: + libinput_config_middle_emulation_state = 1; +#[doc = " @ingroup config"] +pub type libinput_config_middle_emulation_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Check if middle mouse button emulation configuration is available on this\n device. See libinput_device_config_middle_emulation_set_enabled() for\n more details.\n\n @note Some devices provide middle mouse button emulation but do not allow\n enabling/disabling that emulation. These devices return zero in\n libinput_device_config_middle_emulation_is_available().\n\n @param device The device to query\n\n @return Non-zero if middle mouse button emulation is available and can be\n configured, zero otherwise.\n\n @see libinput_device_config_middle_emulation_set_enabled\n @see libinput_device_config_middle_emulation_get_enabled\n @see libinput_device_config_middle_emulation_get_default_enabled"] + pub fn libinput_device_config_middle_emulation_is_available( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable middle button emulation on this device. When enabled, a\n simultaneous press of the left and right button generates a middle mouse\n button event. Releasing the buttons generates a middle mouse button\n release, the left and right button events are discarded otherwise.\n\n See the libinput documentation for more details.\n\n @param device The device to configure\n @param enable @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED to\n disable, @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED To enable\n middle button emulation.\n\n @return A config status code. Disabling middle button emulation on a\n device that does not support middle button emulation always succeeds.\n\n @see libinput_device_config_middle_emulation_is_available\n @see libinput_device_config_middle_emulation_get_enabled\n @see libinput_device_config_middle_emulation_get_default_enabled"] + pub fn libinput_device_config_middle_emulation_set_enabled( + device: *mut libinput_device, + enable: libinput_config_middle_emulation_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if configurable middle button emulation is enabled on this device.\n See libinput_device_config_middle_emulation_set_enabled() for more\n details.\n\n If the device does not have configurable middle button emulation, this\n function returns @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.\n\n @note Some devices provide middle mouse button emulation but do not allow\n enabling/disabling that emulation. These devices always return @ref\n LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.\n\n @param device The device to configure\n @return @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED if disabled\n or not available/configurable, @ref\n LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED If enabled.\n\n @see libinput_device_config_middle_emulation_is_available\n @see libinput_device_config_middle_emulation_set_enabled\n @see libinput_device_config_middle_emulation_get_default_enabled"] + pub fn libinput_device_config_middle_emulation_get_enabled( + device: *mut libinput_device, + ) -> libinput_config_middle_emulation_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if configurable middle button emulation is enabled by default on\n this device. See libinput_device_config_middle_emulation_set_enabled()\n for more details.\n\n If the device does not have configurable middle button\n emulation, this function returns @ref\n LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.\n\n @note Some devices provide middle mouse button emulation but do not allow\n enabling/disabling that emulation. These devices always return @ref\n LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.\n\n @param device The device to configure\n @return @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED If disabled\n or not available, @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED if\n enabled.\n\n @see libinput_device_config_middle_emulation_is_available\n @see libinput_device_config_middle_emulation_set_enabled\n @see libinput_device_config_middle_emulation_get_enabled"] + pub fn libinput_device_config_middle_emulation_get_default_enabled( + device: *mut libinput_device, + ) -> libinput_config_middle_emulation_state; +} +#[doc = " Never send scroll events instead of pointer motion events.\n This has no effect on events generated by scroll wheels."] +pub const libinput_config_scroll_method_LIBINPUT_CONFIG_SCROLL_NO_SCROLL: + libinput_config_scroll_method = 0; +#[doc = " Send scroll events when two fingers are logically down on the\n device."] +pub const libinput_config_scroll_method_LIBINPUT_CONFIG_SCROLL_2FG: libinput_config_scroll_method = + 1; +#[doc = " Send scroll events when a finger moves along the bottom or\n right edge of a device."] +pub const libinput_config_scroll_method_LIBINPUT_CONFIG_SCROLL_EDGE: libinput_config_scroll_method = + 2; +#[doc = " Send scroll events when a button is down and the device moves\n along a scroll-capable axis."] +pub const libinput_config_scroll_method_LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN: + libinput_config_scroll_method = 4; +#[doc = " @ingroup config\n\n The scroll method of a device selects when to generate scroll axis events\n instead of pointer motion events."] +pub type libinput_config_scroll_method = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Check which scroll methods a device supports. The method defines when to\n generate scroll axis events instead of pointer motion events.\n\n @param device The device to configure\n\n @return A bitmask of possible methods.\n\n @see libinput_device_config_scroll_set_method\n @see libinput_device_config_scroll_get_method\n @see libinput_device_config_scroll_get_default_method\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_get_methods(device: *mut libinput_device) -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the scroll method for this device. The method defines when to\n generate scroll axis events instead of pointer motion events.\n\n @note Setting @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN enables\n the scroll method, but scrolling is only activated when the configured\n button is held down. If no button is set, i.e.\n libinput_device_config_scroll_get_button() returns 0, scrolling\n cannot activate.\n\n @param device The device to configure\n @param method The scroll method for this device.\n\n @return A config status code.\n\n @see libinput_device_config_scroll_get_methods\n @see libinput_device_config_scroll_get_method\n @see libinput_device_config_scroll_get_default_method\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_set_method( + device: *mut libinput_device, + method: libinput_config_scroll_method, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the scroll method for this device. The method defines when to\n generate scroll axis events instead of pointer motion events.\n\n @param device The device to configure\n @return The current scroll method for this device.\n\n @see libinput_device_config_scroll_get_methods\n @see libinput_device_config_scroll_set_method\n @see libinput_device_config_scroll_get_default_method\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_get_method( + device: *mut libinput_device, + ) -> libinput_config_scroll_method; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default scroll method for this device. The method defines when to\n generate scroll axis events instead of pointer motion events.\n\n @param device The device to configure\n @return The default scroll method for this device.\n\n @see libinput_device_config_scroll_get_methods\n @see libinput_device_config_scroll_set_method\n @see libinput_device_config_scroll_get_method\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_get_default_method( + device: *mut libinput_device, + ) -> libinput_config_scroll_method; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method\n for this device.\n\n When the current scroll method is set to @ref\n LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN, no button press/release events\n will be send for the configured button.\n\n When the configured button is pressed, any motion events along a\n scroll-capable axis are turned into scroll axis events.\n\n @note Setting the button does not change the scroll method. To change the\n scroll method call libinput_device_config_scroll_set_method().\n\n If the button is 0, button scrolling is effectively disabled.\n\n @param device The device to configure\n @param button The button which when pressed switches to sending scroll events\n\n @return A config status code\n @retval LIBINPUT_CONFIG_STATUS_SUCCESS On success\n @retval LIBINPUT_CONFIG_STATUS_UNSUPPORTED If @ref\n LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN is not supported\n @retval LIBINPUT_CONFIG_STATUS_INVALID The given button does not\n exist on this device\n\n @see libinput_device_config_scroll_get_methods\n @see libinput_device_config_scroll_set_method\n @see libinput_device_config_scroll_get_method\n @see libinput_device_config_scroll_get_default_method\n @see libinput_device_config_scroll_get_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_set_button( + device: *mut libinput_device, + button: u32, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method\n for this device.\n\n If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not\n supported, or no button is set, this function returns 0.\n\n @note The return value is independent of the currently selected\n scroll-method. For button scrolling to activate, a device must have the\n @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a non-zero\n button set as scroll button.\n\n @param device The device to configure\n @return The button which when pressed switches to sending scroll events\n\n @see libinput_device_config_scroll_get_methods\n @see libinput_device_config_scroll_set_method\n @see libinput_device_config_scroll_get_method\n @see libinput_device_config_scroll_get_default_method\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_get_button(device: *mut libinput_device) -> u32; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN\n method for this device.\n\n If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not supported,\n or no default button is set, this function returns 0.\n\n @param device The device to configure\n @return The default button for the @ref\n LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method\n\n @see libinput_device_config_scroll_get_methods\n @see libinput_device_config_scroll_set_method\n @see libinput_device_config_scroll_get_method\n @see libinput_device_config_scroll_get_default_method\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_button"] + pub fn libinput_device_config_scroll_get_default_button(device: *mut libinput_device) -> u32; +} +pub const libinput_config_scroll_button_lock_state_LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED: + libinput_config_scroll_button_lock_state = 0; +pub const libinput_config_scroll_button_lock_state_LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED: + libinput_config_scroll_button_lock_state = 1; +pub type libinput_config_scroll_button_lock_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Set the scroll button lock. If the state is\n @ref LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED, the button must\n physically be held down for button scrolling to work.\n If the state is\n @ref LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED, the button is considered\n logically down after the first press and release sequence, and logically\n up after the second press and release sequence.\n\n @param device The device to configure\n @param state The state to set the scroll button lock to\n\n @return A config status code. Disabling the scroll button lock on\n device that does not support button scrolling always succeeds.\n\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_get_button\n @see libinput_device_config_scroll_get_default_button"] + pub fn libinput_device_config_scroll_set_button_lock( + device: *mut libinput_device, + state: libinput_config_scroll_button_lock_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the current scroll button lock state.\n\n If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not\n supported, or no button is set, this function returns @ref\n LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED.\n\n @note The return value is independent of the currently selected\n scroll-method. For the scroll button lock to activate, a device must have\n the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a\n non-zero button set as scroll button.\n\n @param device The device to configure\n @return The scroll button lock state\n\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_set_button_lock\n @see libinput_device_config_scroll_get_button_lock\n @see libinput_device_config_scroll_get_default_button_lock"] + pub fn libinput_device_config_scroll_get_button_lock( + device: *mut libinput_device, + ) -> libinput_config_scroll_button_lock_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default scroll button lock state.\n\n If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not\n supported, or no button is set, this function returns @ref\n LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED.\n\n @param device The device to configure\n @return The default scroll button lock state\n\n @see libinput_device_config_scroll_set_button\n @see libinput_device_config_scroll_set_button_lock\n @see libinput_device_config_scroll_get_button_lock\n @see libinput_device_config_scroll_get_default_button_lock"] + pub fn libinput_device_config_scroll_get_default_button_lock( + device: *mut libinput_device, + ) -> libinput_config_scroll_button_lock_state; +} +pub const libinput_config_dwt_state_LIBINPUT_CONFIG_DWT_DISABLED: libinput_config_dwt_state = 0; +pub const libinput_config_dwt_state_LIBINPUT_CONFIG_DWT_ENABLED: libinput_config_dwt_state = 1; +#[doc = " @ingroup config\n\n Possible states for the disable-while-typing feature."] +pub type libinput_config_dwt_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Check if this device supports configurable disable-while-typing feature.\n This feature is usually available on built-in touchpads and disables the\n touchpad while typing. See the libinput documentation for details.\n\n @param device The device to configure\n @return 0 if this device does not support disable-while-typing, or 1\n otherwise.\n\n @see libinput_device_config_dwt_set_enabled\n @see libinput_device_config_dwt_get_enabled\n @see libinput_device_config_dwt_get_default_enabled"] + pub fn libinput_device_config_dwt_is_available( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable the disable-while-typing feature. When enabled, the\n device will be disabled while typing and for a short period after. See\n the libinput documentation for details.\n\n @note Enabling or disabling disable-while-typing may not take effect\n immediately.\n\n @param device The device to configure\n @param enable @ref LIBINPUT_CONFIG_DWT_DISABLED to disable\n disable-while-typing, @ref LIBINPUT_CONFIG_DWT_ENABLED to enable\n\n @return A config status code. Disabling disable-while-typing on a\n device that does not support the feature always succeeds.\n\n @see libinput_device_config_dwt_is_available\n @see libinput_device_config_dwt_get_enabled\n @see libinput_device_config_dwt_get_default_enabled"] + pub fn libinput_device_config_dwt_set_enabled( + device: *mut libinput_device, + enable: libinput_config_dwt_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if the disable-while typing feature is currently enabled on this\n device. If the device does not support disable-while-typing, this\n function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.\n\n @param device The device to configure\n @return @ref LIBINPUT_CONFIG_DWT_DISABLED if disabled, @ref\n LIBINPUT_CONFIG_DWT_ENABLED if enabled.\n\n @see libinput_device_config_dwt_is_available\n @see libinput_device_config_dwt_set_enabled\n @see libinput_device_config_dwt_get_default_enabled"] + pub fn libinput_device_config_dwt_get_enabled( + device: *mut libinput_device, + ) -> libinput_config_dwt_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if the disable-while typing feature is enabled on this device by\n default. If the device does not support disable-while-typing, this\n function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.\n\n @param device The device to configure\n @return @ref LIBINPUT_CONFIG_DWT_DISABLED if disabled, @ref\n LIBINPUT_CONFIG_DWT_ENABLED if enabled.\n\n @see libinput_device_config_dwt_is_available\n @see libinput_device_config_dwt_set_enabled\n @see libinput_device_config_dwt_get_enabled"] + pub fn libinput_device_config_dwt_get_default_enabled( + device: *mut libinput_device, + ) -> libinput_config_dwt_state; +} +pub const libinput_config_dwtp_state_LIBINPUT_CONFIG_DWTP_DISABLED: libinput_config_dwtp_state = 0; +pub const libinput_config_dwtp_state_LIBINPUT_CONFIG_DWTP_ENABLED: libinput_config_dwtp_state = 1; +#[doc = " @ingroup config\n\n Possible states for the disable-while-trackpointing feature.\n\n @since 1.21"] +pub type libinput_config_dwtp_state = ::std::os::raw::c_uint; +extern "C" { + #[doc = " @ingroup config\n\n Check if this device supports configurable disable-while-trackpointing\n feature. This feature is usually available on Thinkpads and disables the\n touchpad while using the trackpoint. See the libinput documentation for\n details.\n\n @param device The device to configure\n @return 0 if this device does not support disable-while-trackpointing, or 1\n otherwise.\n\n @see libinput_device_config_dwtp_set_enabled\n @see libinput_device_config_dwtp_get_enabled\n @see libinput_device_config_dwtp_get_default_enabled\n\n @since 1.21"] + pub fn libinput_device_config_dwtp_is_available( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Enable or disable the disable-while-trackpointing feature. When enabled, the\n device will be disabled while using the trackpoint and for a short period\n after. See the libinput documentation for details.\n\n @note Enabling or disabling disable-while-trackpointing may not take effect\n immediately.\n\n @param device The device to configure\n @param enable @ref LIBINPUT_CONFIG_DWTP_DISABLED to disable\n disable-while-trackpointing, @ref LIBINPUT_CONFIG_DWTP_ENABLED to enable\n\n @return A config status code. Disabling disable-while-trackpointing on a\n device that does not support the feature always succeeds.\n\n @see libinput_device_config_dwtp_is_available\n @see libinput_device_config_dwtp_get_enabled\n @see libinput_device_config_dwtp_get_default_enabled\n\n @since 1.21"] + pub fn libinput_device_config_dwtp_set_enabled( + device: *mut libinput_device, + enable: libinput_config_dwtp_state, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if the disable-while trackpointing feature is currently enabled on\n this device. If the device does not support disable-while-trackpointing,\n this function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.\n\n @param device The device to configure\n @return @ref LIBINPUT_CONFIG_DWTP_DISABLED if disabled, @ref\n LIBINPUT_CONFIG_DWTP_ENABLED if enabled.\n\n @see libinput_device_config_dwtp_is_available\n @see libinput_device_config_dwtp_set_enabled\n @see libinput_device_config_dwtp_get_default_enabled\n\n @since 1.21"] + pub fn libinput_device_config_dwtp_get_enabled( + device: *mut libinput_device, + ) -> libinput_config_dwtp_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Check if the disable-while trackpointing feature is enabled on this device\n by default. If the device does not support disable-while-trackpointing, this\n function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.\n\n @param device The device to configure\n @return @ref LIBINPUT_CONFIG_DWTP_DISABLED if disabled, @ref\n LIBINPUT_CONFIG_DWTP_ENABLED if enabled.\n\n @see libinput_device_config_dwtp_is_available\n @see libinput_device_config_dwtp_set_enabled\n @see libinput_device_config_dwtp_get_enabled\n\n @since 1.21"] + pub fn libinput_device_config_dwtp_get_default_enabled( + device: *mut libinput_device, + ) -> libinput_config_dwtp_state; +} +extern "C" { + #[doc = " @ingroup config\n\n Check whether a device can have a custom rotation applied.\n\n @param device The device to configure\n @return Non-zero if a device can be rotated, zero otherwise.\n\n @see libinput_device_config_rotation_set_angle\n @see libinput_device_config_rotation_get_angle\n @see libinput_device_config_rotation_get_default_angle\n\n @since 1.4"] + pub fn libinput_device_config_rotation_is_available( + device: *mut libinput_device, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " @ingroup config\n\n Set the rotation of a device in degrees clockwise off the logical neutral\n position. Any subsequent motion events are adjusted according to the\n given angle.\n\n The angle has to be in the range of [0, 360[ degrees, otherwise this\n function returns LIBINPUT_CONFIG_STATUS_INVALID. If the angle is a\n multiple of 360 or negative, the caller must ensure the correct ranging\n before calling this function.\n\n The rotation angle is applied to all motion events emitted by the device.\n Thus, rotating the device also changes the angle required or presented by\n scrolling, gestures, etc.\n\n @param device The device to configure\n @param degrees_cw The angle in degrees clockwise\n @return A config status code. Setting a rotation of 0 degrees on a\n device that does not support rotation always succeeds.\n\n @see libinput_device_config_rotation_is_available\n @see libinput_device_config_rotation_get_angle\n @see libinput_device_config_rotation_get_default_angle\n\n @since 1.4"] + pub fn libinput_device_config_rotation_set_angle( + device: *mut libinput_device, + degrees_cw: ::std::os::raw::c_uint, + ) -> libinput_config_status; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the current rotation of a device in degrees clockwise off the logical\n neutral position. If this device does not support rotation, the return\n value is always 0.\n\n @param device The device to configure\n @return The angle in degrees clockwise\n\n @see libinput_device_config_rotation_is_available\n @see libinput_device_config_rotation_set_angle\n @see libinput_device_config_rotation_get_default_angle\n\n @since 1.4"] + pub fn libinput_device_config_rotation_get_angle( + device: *mut libinput_device, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + #[doc = " @ingroup config\n\n Get the default rotation of a device in degrees clockwise off the logical\n neutral position. If this device does not support rotation, the return\n value is always 0.\n\n @param device The device to configure\n @return The default angle in degrees clockwise\n\n @see libinput_device_config_rotation_is_available\n @see libinput_device_config_rotation_set_angle\n @see libinput_device_config_rotation_get_angle\n\n @since 1.4"] + pub fn libinput_device_config_rotation_get_default_angle( + device: *mut libinput_device, + ) -> ::std::os::raw::c_uint; +} +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) + ); +} diff --git a/input-sys/src/bindings/gen_1_9.rs b/input-sys/src/bindings/gen_1_9.rs index 2edb2fd..b3c0818 100644 --- a/input-sys/src/bindings/gen_1_9.rs +++ b/input-sys/src/bindings/gen_1_9.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.2 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/src/accel_config.rs b/src/accel_config.rs new file mode 100644 index 0000000..0200b86 --- /dev/null +++ b/src/accel_config.rs @@ -0,0 +1,129 @@ +//! Pointer acceleration +use crate::{ffi, AccelProfile, DeviceConfigError, DeviceConfigResult}; +use input_sys::libinput_config_accel; + +/// A handle for configuration pointer acceleration. +/// +/// To configure pointer acceleration, first create a config of a desired +/// acceleration profile with @ref AccelConfig::new, then +/// configure the profile-specific acceleration properties. +/// +/// In this version of libinput, this pointer acceleration configuration +/// only provides configuration for @ref AccelProfile::Custom. +/// +/// For @ref AccelProfile::Custom use +/// @ref AccelConfig::set_points. +/// +/// Once set up, apply the configuration to a device using +/// @ref Device::config_accel_apply . +/// +/// @since 1.23 +#[cfg(feature = "libinput_1_23")] +pub struct AccelConfig(*mut libinput_config_accel); + +#[cfg(feature = "libinput_1_23")] +impl AccelConfig { + /// Create an acceleration configuration of a given profile. + /// + /// Note that in this version of libinput, only the + /// @ref AccelProfile::Custom profile provides configuration + /// options. All other acceleration profiles, when applied, will merely switch + /// the profile and reset any profile-specific options to the default values. + /// + /// @param AccelProfile The profile of the newly created acceleration configuration. + /// + /// @return AccelConfig + pub fn new(profile: AccelProfile) -> Self { + let profile = match profile { + AccelProfile::Flat => { + ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT + } + AccelProfile::Adaptive => { + ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + } + AccelProfile::Custom => { + ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM + } + }; + + unsafe { Self(ffi::libinput_config_accel_create(profile)) } + } + + /// Set the points for custom acceleration + pub fn set_points( + &self, + accel_type: AccelType, + step: f64, + npoints: usize, + mut points: Vec, + ) -> DeviceConfigResult { + let accel_type = match accel_type { + AccelType::Fallback => { + input_sys::libinput_config_accel_type_LIBINPUT_ACCEL_TYPE_FALLBACK + } + AccelType::Motion => input_sys::libinput_config_accel_type_LIBINPUT_ACCEL_TYPE_MOTION, + AccelType::Scroll => input_sys::libinput_config_accel_type_LIBINPUT_ACCEL_TYPE_SCROLL, + }; + match unsafe { + ffi::libinput_config_accel_set_points( + self.0, + accel_type, + step, + npoints, + points.as_mut_ptr(), + ) + } { + ffi::libinput_config_status_LIBINPUT_CONFIG_STATUS_SUCCESS => Ok(()), + ffi::libinput_config_status_LIBINPUT_CONFIG_STATUS_UNSUPPORTED => { + Err(DeviceConfigError::Unsupported) + } + ffi::libinput_config_status_LIBINPUT_CONFIG_STATUS_INVALID => { + Err(DeviceConfigError::Invalid) + } + _ => panic!("libinput returned invalid 'libinput_config_status'"), + } + } +} + +#[cfg(feature = "libinput_1_23")] +impl crate::AsRaw for AccelConfig { + fn as_raw(&self) -> *const libinput_config_accel { + self.0 + } +} + +#[cfg(feature = "libinput_1_23")] +impl std::ops::Drop for AccelConfig { + fn drop(&mut self) { + unsafe { + ffi::libinput_config_accel_destroy(self.0); + } + } +} + +/// Acceleration types are categories of movement by a device that may have +/// specific acceleration functions applied. A device always supports the +/// @ref AccelType::Motion type (for regular pointer motion). Other +/// types (e.g. scrolling) may be added in the future. +/// +/// The special type @ref AccelType specifies the acceleration +/// function to be moved for any movement produced by the device that does not +/// have a specific acceleration type defined. +/// +/// Use to specify the acceleration function type in +/// @ref AccelConfig::set_points +/// +/// Each device implements a subset of those types, see a list of supported +/// devices for each movement type definition. +#[cfg(feature = "libinput_1_23")] +pub enum AccelType { + /// The default acceleration type used as a fallback when other + /// acceleration types are not provided. + Fallback, + /// Acceleration type for regular pointer movement. This + /// type is always supported. + Motion, + /// Acceleration type for scroll movement. + /// This type is supported by mouse and touchpad. + Scroll, +} diff --git a/src/device.rs b/src/device.rs index 022af21..3b28899 100644 --- a/src/device.rs +++ b/src/device.rs @@ -8,6 +8,7 @@ )] use crate::{ + accel_config::AccelConfig, event::{switch::Switch, tablet_pad::TabletPadModeGroup}, ffi, AsRaw, FromRaw, Libinput, Seat, }; @@ -56,6 +57,10 @@ pub enum AccelProfile { /// Pointer acceleration depends on the input speed. This is the /// default profile for most devices. Adaptive, + /// A custom acceleration profile. Device movement acceleration depends + /// on user defined custom acceleration functions for each movement + /// type. + Custom, } /// The click method defines when to generate software-emulated @@ -544,6 +549,23 @@ impl Device { } } + /// Apply the acceleration configuration to the device + #[cfg(feature = "libinput_1_23")] + pub fn config_accel_apply(&self, accel_config: &AccelConfig) -> DeviceConfigResult { + match unsafe { + ffi::libinput_device_config_accel_apply(self.as_raw_mut(), accel_config.as_raw_mut()) + } { + ffi::libinput_config_status_LIBINPUT_CONFIG_STATUS_SUCCESS => Ok(()), + ffi::libinput_config_status_LIBINPUT_CONFIG_STATUS_UNSUPPORTED => { + Err(DeviceConfigError::Unsupported) + } + ffi::libinput_config_status_LIBINPUT_CONFIG_STATUS_INVALID => { + Err(DeviceConfigError::Invalid) + } + _ => panic!("libinput returned invalid 'libinput_config_status'"), + } + } + /// Return the default pointer acceleration profile for this /// pointer device. pub fn config_accel_default_profile(&self) -> Option { @@ -555,6 +577,9 @@ impl Device { ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE => { Some(AccelProfile::Adaptive) } + ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM => { + Some(AccelProfile::Custom) + } _x => { #[cfg(feature = "log")] log::warn!( @@ -577,6 +602,9 @@ impl Device { ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE => { Some(AccelProfile::Adaptive) } + ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM => { + Some(AccelProfile::Custom) + } _x => { #[cfg(feature = "log")] log::warn!( @@ -604,6 +632,11 @@ impl Device { { profiles.push(AccelProfile::Adaptive); } + if bitmask & ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM as u32 + != 0 + { + profiles.push(AccelProfile::Custom); + } profiles } @@ -620,6 +653,9 @@ impl Device { AccelProfile::Adaptive => { ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE } + AccelProfile::Custom => { + ffi::libinput_config_accel_profile_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM + } }, ) } { diff --git a/src/lib.rs b/src/lib.rs index 6809546..d5c9229 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -228,6 +228,7 @@ macro_rules! ffi_func { mod context; mod device; +pub mod accel_config; pub mod event; mod seat;