config: add configuration for tablet tool motion

This commit is contained in:
Jens Peters 2024-07-05 06:17:29 +02:00 committed by Johan Malm
parent 8501a1281c
commit a2f25bea1a
7 changed files with 41 additions and 7 deletions

View file

@ -5,5 +5,6 @@ labwc_sources += files(
'mousebind.c',
'touch.c',
'tablet.c',
'tablet-tool.c',
'libinput.c',
)

View file

@ -1061,6 +1061,8 @@ entry(xmlNode *node, char *nodename, char *content)
} 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")) {
@ -1258,6 +1260,7 @@ rcxml_init(void)
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;

17
src/config/tablet-tool.c Normal file
View file

@ -0,0 +1,17 @@
// 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;
}

View file

@ -19,7 +19,7 @@
#include "idle.h"
#include "action.h"
static enum lab_tablet_motion_mode
static enum motion
tool_motion_mode(struct wlr_tablet_tool *tool)
{
/*