[mutter/wip/tablet-protocol-v2: 42/48] wayland: Implement wp_tablet_pad.modes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/tablet-protocol-v2: 42/48] wayland: Implement wp_tablet_pad.modes
- Date: Fri, 13 May 2016 18:11:00 +0000 (UTC)
commit efc64f8b296bc6a1dff4974a252aa1633a35faca
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 13 13:55:31 2016 +0200
wayland: Implement wp_tablet_pad.modes
Lookup this information from the WacomDevice.
src/wayland/meta-wayland-tablet-pad.c | 41 ++++++++++++++++++++++++++++++++-
src/wayland/meta-wayland-tablet-pad.h | 3 ++
2 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-tablet-pad.c b/src/wayland/meta-wayland-tablet-pad.c
index 35df7ab..bc7c5d1 100644
--- a/src/wayland/meta-wayland-tablet-pad.c
+++ b/src/wayland/meta-wayland-tablet-pad.c
@@ -29,6 +29,7 @@
#include <wayland-server.h>
#include "tablet-unstable-v2-server-protocol.h"
+#include "backends/meta-input-settings-private.h"
#include "meta-surface-actor-wayland.h"
#include "meta-wayland-private.h"
@@ -58,6 +59,39 @@ pad_handle_focus_surface_destroy (struct wl_listener *listener,
meta_wayland_tablet_pad_set_focus (pad, NULL);
}
+#ifdef HAVE_LIBWACOM
+static void
+meta_wayland_tablet_pad_fill_wacom_info (MetaWaylandTabletPad *pad)
+{
+ MetaInputSettings *input_settings;
+ WacomDevice *wacom_device;
+ gint n_modes = 0, mode_switch_button = -1;
+
+ input_settings = meta_input_settings_get ();
+ wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
+ pad->device);
+ if (!wacom_device)
+ return;
+
+ if (libwacom_get_ring_num_modes (wacom_device) > n_modes)
+ {
+ n_modes = libwacom_get_ring_num_modes (wacom_device);
+ }
+
+ if (libwacom_get_ring2_num_modes (wacom_device))
+ {
+ n_modes = libwacom_get_ring2_num_modes (wacom_device);
+ }
+
+ if (libwacom_get_strips_num_modes (wacom_device))
+ {
+ n_modes = libwacom_get_strips_num_modes (wacom_device);
+ }
+
+ pad->n_modes = n_modes;
+}
+#endif
+
MetaWaylandTabletPad *
meta_wayland_tablet_pad_new (ClutterInputDevice *device,
MetaWaylandTabletSeat *tablet_seat)
@@ -88,6 +122,10 @@ meta_wayland_tablet_pad_new (ClutterInputDevice *device,
meta_wayland_tablet_pad_strip_new (pad));
}
+#ifdef HAVE_LIBWACOM
+ meta_wayland_tablet_pad_fill_wacom_info (pad);
+#endif
+
return pad;
}
@@ -182,7 +220,8 @@ meta_wayland_tablet_pad_notify (MetaWaylandTabletPad *pad,
zwp_tablet_pad_v2_send_strip (resource, strip_resource);
}
- /* FIXME: zwp_tablet_pad_v2.modes */
+ if (pad->n_modes > 0)
+ zwp_tablet_pad_v2_send_modes (resource, pad->n_modes);
zwp_tablet_pad_v2_send_done (resource);
}
diff --git a/src/wayland/meta-wayland-tablet-pad.h b/src/wayland/meta-wayland-tablet-pad.h
index b416139..c3c173c 100644
--- a/src/wayland/meta-wayland-tablet-pad.h
+++ b/src/wayland/meta-wayland-tablet-pad.h
@@ -41,6 +41,9 @@ struct _MetaWaylandTabletPad
struct wl_listener focus_surface_listener;
uint32_t focus_serial;
+ uint32_t n_modes;
+ uint32_t current_mode;
+
GList *strips;
GList *rings;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]