aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/interfaces/wlr_tablet_tool.h10
-rw-r--r--include/wlr/types/wlr_input_device.h2
-rw-r--r--include/wlr/types/wlr_seat.h2
-rw-r--r--include/wlr/types/wlr_tablet_pad.h25
-rw-r--r--include/wlr/types/wlr_tablet_tool.h50
-rw-r--r--include/wlr/types/wlr_tablet_v2.h171
6 files changed, 250 insertions, 10 deletions
diff --git a/include/wlr/interfaces/wlr_tablet_tool.h b/include/wlr/interfaces/wlr_tablet_tool.h
index 347a0003..12b2e32e 100644
--- a/include/wlr/interfaces/wlr_tablet_tool.h
+++ b/include/wlr/interfaces/wlr_tablet_tool.h
@@ -3,12 +3,12 @@
#include <wlr/types/wlr_tablet_tool.h>
-struct wlr_tablet_tool_impl {
- void (*destroy)(struct wlr_tablet_tool *tool);
+struct wlr_tablet_impl {
+ void (*destroy)(struct wlr_tablet *tablet);
};
-void wlr_tablet_tool_init(struct wlr_tablet_tool *tool,
- struct wlr_tablet_tool_impl *impl);
-void wlr_tablet_tool_destroy(struct wlr_tablet_tool *tool);
+void wlr_tablet_init(struct wlr_tablet *tablet,
+ struct wlr_tablet_impl *impl);
+void wlr_tablet_destroy(struct wlr_tablet *tablet);
#endif
diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h
index 5cf26b65..cce15d90 100644
--- a/include/wlr/types/wlr_input_device.h
+++ b/include/wlr/types/wlr_input_device.h
@@ -39,7 +39,7 @@ struct wlr_input_device {
struct wlr_keyboard *keyboard;
struct wlr_pointer *pointer;
struct wlr_touch *touch;
- struct wlr_tablet_tool *tablet_tool;
+ struct wlr_tablet *tablet;
struct wlr_tablet_pad *tablet_pad;
};
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index 1c7a1472..92d0a233 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -540,6 +540,4 @@ bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial);
struct wlr_seat_client *wlr_seat_client_from_resource(
struct wl_resource *resource);
-bool wlr_surface_is_pointer_cursor(struct wlr_surface *surface);
-
#endif
diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h
index 73082c56..23ac464d 100644
--- a/include/wlr/types/wlr_tablet_pad.h
+++ b/include/wlr/types/wlr_tablet_pad.h
@@ -4,6 +4,7 @@
#include <stdint.h>
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_list.h>
/*
* NOTE: the wlr tablet pad implementation does not currently support tablets
@@ -20,16 +21,40 @@ struct wlr_tablet_pad {
struct wl_signal button;
struct wl_signal ring;
struct wl_signal strip;
+ struct wl_signal attach_tablet; //struct wlr_tablet_tool
} events;
+ size_t button_count;
+ size_t ring_count;
+ size_t strip_count;
+
+ struct wl_list groups; // wlr_tablet_pad_group::link
+ struct wlr_list paths; // char *
+
void *data;
};
+struct wlr_tablet_pad_group {
+ struct wl_list link;
+
+ size_t button_count;
+ unsigned int *buttons;
+
+ size_t strip_count;
+ unsigned int *strips;
+
+ size_t ring_count;
+ unsigned int *rings;
+
+ unsigned int mode_count;
+};
+
struct wlr_event_tablet_pad_button {
uint32_t time_msec;
uint32_t button;
enum wlr_button_state state;
unsigned int mode;
+ unsigned int group;
};
enum wlr_tablet_pad_ring_source {
diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h
index 22bf2649..bfa2e1f7 100644
--- a/include/wlr/types/wlr_tablet_tool.h
+++ b/include/wlr/types/wlr_tablet_tool.h
@@ -4,11 +4,47 @@
#include <stdint.h>
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_list.h>
-struct wlr_tablet_tool_impl;
+/*
+ * Copy+Paste from libinput, but this should neither use libinput, nor
+ * tablet-unstable-v2 headers, so we can't include them
+ */
+enum wlr_tablet_tool_type {
+ WLR_TABLET_TOOL_TYPE_PEN = 1, /**< A generic pen */
+ WLR_TABLET_TOOL_TYPE_ERASER, /**< Eraser */
+ WLR_TABLET_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */
+ WLR_TABLET_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g.
+ Wacom Inking Pen */
+ WLR_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */
+ WLR_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */
+ WLR_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */
+};
struct wlr_tablet_tool {
- struct wlr_tablet_tool_impl *impl;
+ enum wlr_tablet_tool_type type;
+ uint64_t hardware_serial;
+ uint64_t hardware_wacom;
+
+ // Capabilities
+ bool tilt;
+ bool pressure;
+ bool distance;
+ bool rotation;
+ bool slider;
+ bool wheel;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+
+ void *data;
+};
+
+struct wlr_tablet_impl;
+
+struct wlr_tablet {
+ struct wlr_tablet_impl *impl;
struct {
struct wl_signal axis;
@@ -17,6 +53,9 @@ struct wlr_tablet_tool {
struct wl_signal button;
} events;
+ const char *name;
+ struct wlr_list paths; // char *
+
void *data;
};
@@ -34,10 +73,14 @@ enum wlr_tablet_tool_axes {
struct wlr_event_tablet_tool_axis {
struct wlr_input_device *device;
+ struct wlr_tablet_tool *tool;
+
uint32_t time_msec;
uint32_t updated_axes;
// From 0..1
double x, y;
+ // Relative to last event
+ double dx, dy;
double pressure;
double distance;
double tilt_x, tilt_y;
@@ -53,6 +96,7 @@ enum wlr_tablet_tool_proximity_state {
struct wlr_event_tablet_tool_proximity {
struct wlr_input_device *device;
+ struct wlr_tablet_tool *tool;
uint32_t time_msec;
// From 0..1
double x, y;
@@ -66,6 +110,7 @@ enum wlr_tablet_tool_tip_state {
struct wlr_event_tablet_tool_tip {
struct wlr_input_device *device;
+ struct wlr_tablet_tool *tool;
uint32_t time_msec;
// From 0..1
double x, y;
@@ -74,6 +119,7 @@ struct wlr_event_tablet_tool_tip {
struct wlr_event_tablet_tool_button {
struct wlr_input_device *device;
+ struct wlr_tablet_tool *tool;
uint32_t time_msec;
uint32_t button;
enum wlr_button_state state;
diff --git a/include/wlr/types/wlr_tablet_v2.h b/include/wlr/types/wlr_tablet_v2.h
new file mode 100644
index 00000000..afa74d05
--- /dev/null
+++ b/include/wlr/types/wlr_tablet_v2.h
@@ -0,0 +1,171 @@
+#ifndef WLR_TYPES_WLR_TABLET_V2_H
+#define WLR_TYPES_WLR_TABLET_V2_H
+
+#include <wayland-server.h>
+#include <wlr/types/wlr_seat.h>
+#include <wlr/types/wlr_input_device.h>
+
+#include "tablet-unstable-v2-protocol.h"
+
+/* This can probably be even lower,the tools don't have a lot of buttons */
+#define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16
+
+struct wlr_tablet_client_v2;
+struct wlr_tablet_tool_client_v2;
+struct wlr_tablet_pad_client_v2;
+
+struct wlr_tablet_manager_v2 {
+ struct wl_global *wl_global;
+ struct wl_list clients; // wlr_tablet_manager_client_v2::link
+ struct wl_list seats; // wlr_tablet_seat_v2::link
+
+ struct wl_listener display_destroy;
+
+ void *data;
+};
+
+struct wlr_tablet_v2_tablet {
+ struct wl_list link; // wlr_tablet_seat_v2::tablets
+ struct wlr_tablet *wlr_tablet;
+ struct wlr_input_device *wlr_device;
+ struct wl_list clients; // wlr_tablet_client_v2::tablet_link
+
+ struct wl_listener tool_destroy;
+
+ struct wlr_tablet_client_v2 *current_client;
+};
+
+struct wlr_tablet_v2_tablet_tool {
+ struct wl_list link; // wlr_tablet_seat_v2::tablets
+ struct wlr_tablet_tool *wlr_tool;
+ struct wl_list clients; // wlr_tablet_tool_client_v2::tool_link
+
+ struct wl_listener tool_destroy;
+
+ struct wlr_tablet_tool_client_v2 *current_client;
+ struct wlr_surface *focused_surface;
+ struct wl_listener surface_destroy;
+
+ uint32_t proximity_serial;
+ bool is_down;
+ uint32_t down_serial;
+ size_t num_buttons;
+ uint32_t pressed_buttons[WLR_TABLET_V2_TOOL_BUTTONS_CAP];
+ uint32_t pressed_serials[WLR_TABLET_V2_TOOL_BUTTONS_CAP];
+
+ struct {
+ struct wl_signal set_cursor; // struct wlr_tablet_v2_event_cursor
+ } events;
+};
+
+struct wlr_tablet_v2_tablet_pad {
+ struct wl_list link; // wlr_tablet_seat_v2::pads
+ struct wlr_tablet_pad *wlr_pad;
+ struct wlr_input_device *wlr_device;
+ struct wl_list clients; // wlr_tablet_pad_client_v2::pad_link
+
+ size_t group_count;
+ uint32_t *groups;
+
+ struct wl_listener pad_destroy;
+
+ struct wlr_tablet_pad_client_v2 *current_client;
+
+ struct {
+ struct wl_signal button_feedback; // struct wlr_tablet_v2_event_feedback
+ struct wl_signal strip_feedback; // struct wlr_tablet_v2_event_feedback
+ struct wl_signal ring_feedback; // struct wlr_tablet_v2_event_feedback
+ } events;
+};
+
+struct wlr_tablet_v2_event_cursor {
+ struct wlr_surface *surface;
+ uint32_t serial;
+ int32_t hotspot_x;
+ int32_t hotspot_y;
+ struct wlr_seat_client *seat_client;
+};
+
+struct wlr_tablet_v2_event_feedback {
+ const char *description;
+ size_t index;
+ uint32_t serial;
+};
+
+struct wlr_tablet_v2_tablet *wlr_tablet_create(
+ struct wlr_tablet_manager_v2 *manager,
+ struct wlr_seat *wlr_seat,
+ struct wlr_input_device *wlr_device);
+
+struct wlr_tablet_v2_tablet_pad *wlr_tablet_pad_create(
+ struct wlr_tablet_manager_v2 *manager,
+ struct wlr_seat *wlr_seat,
+ struct wlr_input_device *wlr_device);
+
+struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create(
+ struct wlr_tablet_manager_v2 *manager,
+ struct wlr_seat *wlr_seat,
+ struct wlr_tablet_tool *wlr_tool);
+
+struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display);
+void wlr_tablet_v2_destroy(struct wlr_tablet_manager_v2 *manager);
+
+void wlr_send_tablet_v2_tablet_tool_proximity_in(
+ struct wlr_tablet_v2_tablet_tool *tool,
+ struct wlr_tablet_v2_tablet *tablet,
+ struct wlr_surface *surface);
+
+void wlr_send_tablet_v2_tablet_tool_down(struct wlr_tablet_v2_tablet_tool *tool);
+void wlr_send_tablet_v2_tablet_tool_up(struct wlr_tablet_v2_tablet_tool *tool);
+
+void wlr_send_tablet_v2_tablet_tool_motion(
+ struct wlr_tablet_v2_tablet_tool *tool, double x, double y);
+
+void wlr_send_tablet_v2_tablet_tool_pressure(
+ struct wlr_tablet_v2_tablet_tool *tool, double pressure);
+
+void wlr_send_tablet_v2_tablet_tool_distance(
+ struct wlr_tablet_v2_tablet_tool *tool, double distance);
+
+void wlr_send_tablet_v2_tablet_tool_tilt(
+ struct wlr_tablet_v2_tablet_tool *tool, double x, double y);
+
+void wlr_send_tablet_v2_tablet_tool_rotation(
+ struct wlr_tablet_v2_tablet_tool *tool, double degrees);
+
+void wlr_send_tablet_v2_tablet_tool_slider(
+ struct wlr_tablet_v2_tablet_tool *tool, double position);
+
+void wlr_send_tablet_v2_tablet_tool_wheel(
+ struct wlr_tablet_v2_tablet_tool *tool, double degrees, int32_t clicks);
+
+void wlr_send_tablet_v2_tablet_tool_proximity_out(
+ struct wlr_tablet_v2_tablet_tool *tool);
+
+void wlr_send_tablet_v2_tablet_tool_button(
+ struct wlr_tablet_v2_tablet_tool *tool, uint32_t button,
+ enum zwp_tablet_pad_v2_button_state state);
+
+uint32_t wlr_send_tablet_v2_tablet_pad_enter(
+ struct wlr_tablet_v2_tablet_pad *pad,
+ struct wlr_tablet_v2_tablet *tablet,
+ struct wlr_surface *surface);
+
+void wlr_send_tablet_v2_tablet_pad_button(
+ struct wlr_tablet_v2_tablet_pad *pad, size_t button,
+ uint32_t time, enum zwp_tablet_pad_v2_button_state state);
+
+void wlr_send_tablet_v2_tablet_pad_strip( struct wlr_tablet_v2_tablet_pad *pad,
+ uint32_t strip, double position, bool finger, uint32_t time);
+void wlr_send_tablet_v2_tablet_pad_ring(struct wlr_tablet_v2_tablet_pad *pad,
+ uint32_t ring, double position, bool finger, uint32_t time);
+
+uint32_t wlr_send_tablet_v2_tablet_pad_leave(struct wlr_tablet_v2_tablet_pad *pad,
+ struct wlr_surface *surface);
+
+uint32_t wlr_send_tablet_v2_tablet_pad_mode(struct wlr_tablet_v2_tablet_pad *pad,
+ size_t group, uint32_t mode, uint32_t time);
+
+bool wlr_surface_accepts_tablet_v2(struct wlr_tablet_v2_tablet *tablet,
+ struct wlr_surface *surface);
+#endif /* WLR_TYPES_WLR_TABLET_V2_H */