From: Peter Hutterer Date: Fri, 13 Feb 2015 04:36:56 +0000 (+1000) Subject: Add libinput_device_pointer_has_button over the plain has_button X-Git-Tag: 0.11.0~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=761baeb6e608a73bbcb464d998ca24ba09d282de;p=platform%2Fupstream%2Flibinput.git 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 --- diff --git a/src/libinput.c b/src/libinput.c index 81862d56..b903caa6 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -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) & diff --git a/src/libinput.h b/src/libinput.h index 857b3fa8..0fdca7b7 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -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 diff --git a/src/libinput.sym b/src/libinput.sym index cf13789f..644e9105 100644 --- a/src/libinput.sym +++ b/src/libinput.sym @@ -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;