#include "common/font.h"
#include "config/touch.h"
#include "config/tablet.h"
+#include "config/tablet-tool.h"
#include "config/libinput.h"
#include "resize-indicator.h"
#include "theme.h"
uint16_t button_map_count;
struct button_map_entry button_map[BUTTON_MAP_MAX];
} tablet;
+ struct tablet_tool_config {
+ enum motion motion;
+ } tablet_tool;
/* libinput */
struct wl_list libinput_categories;
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef LABWC_TABLET_TOOL_CONFIG_H
+#define LABWC_TABLET_TOOL_CONFIG_H
+
+#include <stdint.h>
+
+enum motion {
+ LAB_TABLET_MOTION_ABSOLUTE = 0,
+ LAB_TABLET_MOTION_RELATIVE,
+};
+
+enum motion tablet_parse_motion(const char *name);
+
+#endif /* LABWC_TABLET_TOOL_CONFIG_H */
struct wlr_device;
struct wlr_input_device;
-enum lab_tablet_motion_mode {
- LAB_TABLET_MOTION_ABSOLUTE = 0,
- LAB_TABLET_MOTION_RELATIVE,
-};
-
struct drawing_tablet {
struct wlr_input_device *wlr_input_device;
struct seat *seat;
struct wlr_tablet *tablet;
struct wlr_tablet_v2_tablet *tablet_v2;
- enum lab_tablet_motion_mode motion_mode;
+ enum motion motion_mode;
double x, y, dx, dy;
double distance;
double pressure;
'mousebind.c',
'touch.c',
'tablet.c',
+ 'tablet-tool.c',
'libinput.c',
)
} else {
wlr_log(WLR_ERROR, "Missing 'button' argument for tablet button mapping");
}
+ } else if (!strcasecmp(nodename, "motion.tabletTool")) {
+ rc.tablet_tool.motion = tablet_parse_motion(content);
} else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
rc.menu_ignore_button_release_period = atoi(content);
} else if (!strcasecmp(nodename, "width.magnifier")) {
rc.tablet.rotation = 0;
rc.tablet.box = (struct wlr_fbox){0};
tablet_load_default_button_mappings();
+ rc.tablet_tool.motion = LAB_TABLET_MOTION_ABSOLUTE;
rc.repeat_rate = 25;
rc.repeat_delay = 600;
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0-only
+#define _POSIX_C_SOURCE 200809L
+#include <strings.h>
+#include <wlr/util/log.h>
+#include "config/tablet-tool.h"
+
+enum motion
+tablet_parse_motion(const char *name)
+{
+ if (!strcasecmp(name, "Absolute")) {
+ return LAB_TABLET_MOTION_ABSOLUTE;
+ } else if (!strcasecmp(name, "Relative")) {
+ return LAB_TABLET_MOTION_RELATIVE;
+ }
+ wlr_log(WLR_ERROR, "Invalid value for tablet motion: %s", name);
+ return LAB_TABLET_MOTION_ABSOLUTE;
+}
#include "idle.h"
#include "action.h"
-static enum lab_tablet_motion_mode
+static enum motion
tool_motion_mode(struct wlr_tablet_tool *tool)
{
/*