Add libinput_device_pointer_has_button over the plain has_button
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 13 Feb 2015 04:36:56 +0000 (14:36 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 13 Feb 2015 04:36:56 +0000 (14:36 +1000)
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>
src/libinput.c
src/libinput.h
src/libinput.sym

index 81862d56de0f0250d781d85644ba6abc0e9f9be0..b903caa621b69d8a84d1758289204d1ae8716c9c 100644 (file)
@@ -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) &
index 857b3fa84ec5124978f4b1f647181ddbcf595077..0fdca7b78f33e11eaf47e165841af884cabca677 100644 (file)
@@ -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
index cf13789f8e6ba019e292ccc50a83551787d639dc..644e910551c8515737c976b44643d92aa12e4500 100644 (file)
@@ -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;