On 4/06/2014 18:40 , Hans de Goede wrote:
Hi,

On 06/03/2014 07:34 AM, Peter Hutterer wrote:
Provide an interface to enable/disable tapping, with a default mapping of
1/2/3 fingers mapping to L/R/M button events, respectively.

Signed-off-by: Peter Hutterer <[email protected]>
---
  src/libinput-private.h | 13 +++++++++
  src/libinput.c         | 33 +++++++++++++++++++++++
  src/libinput.h         | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-
  3 files changed, 118 insertions(+), 1 deletion(-)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 61cdc79..020167e 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -69,12 +69,25 @@ struct libinput_seat {
        uint32_t button_count[KEY_CNT];
  };

+struct libinput_device_config_tap {
+       int (*count)(struct libinput_device *device);
+       enum libinput_config_status (*enable)(struct libinput_device *device,
+                                             int enable);
+       int (*is_enabled)(struct libinput_device *device);
+       void (*reset)(struct libinput_device *device);
+};
+
+struct libinput_device_config {
+       struct libinput_device_config_tap *tap;
+};
+
  struct libinput_device {
        struct libinput_seat *seat;
        struct list link;
        void *user_data;
        int terminated;
        int refcount;
+       struct libinput_device_config config;
  };

  typedef void (*libinput_source_dispatch_t)(void *data);
diff --git a/src/libinput.c b/src/libinput.c
index 6b7e8b8..6a713bb 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1182,3 +1182,36 @@ libinput_event_touch_get_base_event(struct 
libinput_event_touch *event)
  {
        return &event->base;
  }
+
+LIBINPUT_EXPORT int
+libinput_device_config_tap_get_finger_count(struct libinput_device *device)
+{
+       return device->config.tap ? device->config.tap->count(device) : 0;
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_tap_enable(struct libinput_device *device,
+                                 int enable)
+{
+       if (enable &&
+           libinput_device_config_tap_get_finger_count(device) == 0)
+               return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
+
+       return device->config.tap->enable(device, enable);
+}
+
+LIBINPUT_EXPORT int
+libinput_device_config_tap_is_enabled(struct libinput_device *device)
+{
+       if (libinput_device_config_tap_get_finger_count(device) == 0)
+               return 0;
+
+       return device->config.tap->is_enabled(device);
+}
+
+LIBINPUT_EXPORT void
+libinput_device_config_tap_reset(struct libinput_device *device)
+{
+       if (device->config.tap)
+               device->config.tap->reset(device);
+}

Didn't we agree in an off-list discussion to add a get_default instead,
so to that ie a cmdline app for querying config info can not only display
the current value but also the device default value for a config option ?

This get_default would replace the reset, apps can simple implement that
functionality themselves through the get_default.

huh, yes, now I remember. I knew something was missing. I'll fix this series up with this in mind, sorry about that.

Cheers,
  Peter
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to