mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 05:50:26 +01:00
Add libinput_device_pointer_has_button over the plain has_button
If a device has multiple capabilities, has_button is imprecise. A device with tablet and pointer capability for example may have BTN_LEFT on the pointer interface but not on the tablet interface. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a9f216ab47
commit
761baeb6e6
3 changed files with 19 additions and 3 deletions
|
|
@ -1364,11 +1364,17 @@ libinput_device_get_size(struct libinput_device *device,
|
|||
}
|
||||
|
||||
LIBINPUT_EXPORT int
|
||||
libinput_device_has_button(struct libinput_device *device, uint32_t code)
|
||||
libinput_device_pointer_has_button(struct libinput_device *device, uint32_t code)
|
||||
{
|
||||
return evdev_device_has_button((struct evdev_device *)device, code);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT int
|
||||
libinput_device_has_button(struct libinput_device *device, uint32_t code)
|
||||
{
|
||||
return libinput_device_pointer_has_button(device, code);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT struct libinput_event *
|
||||
libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event)
|
||||
{
|
||||
|
|
@ -1805,7 +1811,7 @@ LIBINPUT_EXPORT enum libinput_config_status
|
|||
libinput_device_config_scroll_set_button(struct libinput_device *device,
|
||||
uint32_t button)
|
||||
{
|
||||
if (button && !libinput_device_has_button(device, button))
|
||||
if (button && !libinput_device_pointer_has_button(device, button))
|
||||
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||
|
||||
if ((libinput_device_config_scroll_get_methods(device) &
|
||||
|
|
|
|||
|
|
@ -1661,7 +1661,15 @@ libinput_device_get_size(struct libinput_device *device,
|
|||
* on error.
|
||||
*/
|
||||
int
|
||||
libinput_device_has_button(struct libinput_device *device, uint32_t code);
|
||||
libinput_device_pointer_has_button(struct libinput_device *device, uint32_t code);
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
* @deprecated Use libinput_device_pointer_has_button() instead.
|
||||
*/
|
||||
int
|
||||
libinput_device_has_button(struct libinput_device *device, uint32_t code) LIBINPUT_ATTRIBUTE_DEPRECATED;
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
|
|
|
|||
|
|
@ -133,4 +133,6 @@ LIBINPUT_0.11.0 {
|
|||
libinput_device_group_ref;
|
||||
libinput_device_group_set_user_data;
|
||||
libinput_device_group_unref;
|
||||
|
||||
libinput_device_pointer_has_button;
|
||||
} LIBINPUT_0.9.0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue