Actually, more to the point, it sounds like the client is unable to
distinguish the BTN_LEFT produced by the pointer from the BTN_LEFT
produced by the pad.
If in fact it *can* be distinguished then there should be some very
similar api to this "has" function. For instance if there is some
sub-device id sent with the events then this function should take that
same sub-device id.
On 02/13/2015 10:45 AM, Bill Spitzak wrote:
Why not just say that is what libinput_device_has_button does in case
there is an ambiguity?
On 02/12/2015 08:43 PM, Peter Hutterer wrote:
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 <[email protected]>
---
src/libinput.c | 10 ++++++++--
src/libinput.h | 10 +++++++++-
src/libinput.sym | 2 ++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/libinput.c b/src/libinput.c
index 81862d5..b903caa 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 857b3fa..0fdca7b 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 cf13789..644e910 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;
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel