2017-09-23 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_TABLET_TOOL_H
|
|
|
|
#define WLR_TYPES_TABLET_TOOL_H
|
|
|
|
|
2017-06-20 00:41:02 +02:00
|
|
|
#include <stdint.h>
|
2018-02-12 21:29:23 +01:00
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wlr/types/wlr_input_device.h>
|
2018-05-15 16:16:19 +02:00
|
|
|
#include <wlr/types/wlr_list.h>
|
2017-06-20 00:41:02 +02:00
|
|
|
|
2018-04-17 19:09:42 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
2018-06-16 11:19:48 +02:00
|
|
|
Wacom Inking Pen */
|
2018-04-17 19:09:42 +02:00
|
|
|
WLR_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */
|
|
|
|
WLR_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */
|
2018-04-24 08:10:45 +02:00
|
|
|
WLR_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */
|
2018-04-17 19:09:42 +02:00
|
|
|
};
|
|
|
|
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet_tool {
|
2018-04-17 19:09:42 +02:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet_impl;
|
2017-06-20 00:41:02 +02:00
|
|
|
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet {
|
|
|
|
struct wlr_tablet_impl *impl;
|
2017-06-20 00:41:02 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal axis;
|
|
|
|
struct wl_signal proximity;
|
|
|
|
struct wl_signal tip;
|
|
|
|
struct wl_signal button;
|
|
|
|
} events;
|
2017-08-11 20:23:53 +02:00
|
|
|
|
2018-04-23 08:55:49 +02:00
|
|
|
const char *name;
|
2018-05-15 16:16:19 +02:00
|
|
|
struct wlr_list paths; // char *
|
2018-04-23 08:55:49 +02:00
|
|
|
|
2017-08-11 20:23:53 +02:00
|
|
|
void *data;
|
2017-06-20 00:41:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum wlr_tablet_tool_axes {
|
|
|
|
WLR_TABLET_TOOL_AXIS_X = 1,
|
|
|
|
WLR_TABLET_TOOL_AXIS_Y = 2,
|
|
|
|
WLR_TABLET_TOOL_AXIS_DISTANCE = 4,
|
|
|
|
WLR_TABLET_TOOL_AXIS_PRESSURE = 8,
|
|
|
|
WLR_TABLET_TOOL_AXIS_TILT_X = 16,
|
|
|
|
WLR_TABLET_TOOL_AXIS_TILT_Y = 32,
|
|
|
|
WLR_TABLET_TOOL_AXIS_ROTATION = 64,
|
|
|
|
WLR_TABLET_TOOL_AXIS_SLIDER = 128,
|
|
|
|
WLR_TABLET_TOOL_AXIS_WHEEL = 256,
|
|
|
|
};
|
|
|
|
|
2017-06-21 20:07:09 +02:00
|
|
|
struct wlr_event_tablet_tool_axis {
|
2017-08-28 14:42:39 +02:00
|
|
|
struct wlr_input_device *device;
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet_tool *tool;
|
2018-04-17 19:09:42 +02:00
|
|
|
|
2017-10-30 11:40:06 +01:00
|
|
|
uint32_t time_msec;
|
2017-06-20 00:41:02 +02:00
|
|
|
uint32_t updated_axes;
|
2018-03-28 17:40:35 +02:00
|
|
|
// From 0..1
|
|
|
|
double x, y;
|
2018-05-25 10:04:25 +02:00
|
|
|
// Relative to last event
|
|
|
|
double dx, dy;
|
2017-06-20 00:41:02 +02:00
|
|
|
double pressure;
|
|
|
|
double distance;
|
|
|
|
double tilt_x, tilt_y;
|
|
|
|
double rotation;
|
|
|
|
double slider;
|
|
|
|
double wheel_delta;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wlr_tablet_tool_proximity_state {
|
|
|
|
WLR_TABLET_TOOL_PROXIMITY_OUT,
|
|
|
|
WLR_TABLET_TOOL_PROXIMITY_IN,
|
|
|
|
};
|
|
|
|
|
2017-06-21 20:07:09 +02:00
|
|
|
struct wlr_event_tablet_tool_proximity {
|
2017-08-28 14:42:39 +02:00
|
|
|
struct wlr_input_device *device;
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet_tool *tool;
|
2017-10-30 11:40:06 +01:00
|
|
|
uint32_t time_msec;
|
2018-03-28 17:40:35 +02:00
|
|
|
// From 0..1
|
|
|
|
double x, y;
|
2017-06-20 00:41:02 +02:00
|
|
|
enum wlr_tablet_tool_proximity_state state;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wlr_tablet_tool_tip_state {
|
|
|
|
WLR_TABLET_TOOL_TIP_UP,
|
|
|
|
WLR_TABLET_TOOL_TIP_DOWN,
|
|
|
|
};
|
|
|
|
|
2017-06-21 20:07:09 +02:00
|
|
|
struct wlr_event_tablet_tool_tip {
|
2017-08-28 14:42:39 +02:00
|
|
|
struct wlr_input_device *device;
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet_tool *tool;
|
2017-10-30 11:40:06 +01:00
|
|
|
uint32_t time_msec;
|
2018-03-28 17:40:35 +02:00
|
|
|
// From 0..1
|
|
|
|
double x, y;
|
2017-06-20 00:41:02 +02:00
|
|
|
enum wlr_tablet_tool_tip_state state;
|
|
|
|
};
|
|
|
|
|
2017-06-21 20:07:09 +02:00
|
|
|
struct wlr_event_tablet_tool_button {
|
2017-08-28 14:42:39 +02:00
|
|
|
struct wlr_input_device *device;
|
2018-06-16 11:19:48 +02:00
|
|
|
struct wlr_tablet_tool *tool;
|
2017-10-30 11:40:06 +01:00
|
|
|
uint32_t time_msec;
|
2017-06-20 00:41:02 +02:00
|
|
|
uint32_t button;
|
|
|
|
enum wlr_button_state state;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|