}
}
+static void
+fill_tablet_button_map(xmlNode *node)
+{
+ uint32_t map_from;
+ uint32_t map_to;
+ char buf[256];
+
+ if (lab_xml_get_string(node, "button", buf, sizeof(buf))) {
+ map_from = tablet_button_from_str(buf);
+ } else {
+ wlr_log(WLR_ERROR, "Invalid 'button' argument for tablet button mapping");
+ return;
+ }
+
+ if (lab_xml_get_string(node, "to", buf, sizeof(buf))) {
+ map_to = mousebind_button_from_str(buf, NULL);
+ } else {
+ wlr_log(WLR_ERROR, "Invalid 'to' argument for tablet button mapping");
+ return;
+ }
+
+ tablet_button_mapping_add(map_from, map_to);
+}
+
static int
get_accel_profile(const char *s)
{
static void
entry(xmlNode *node, char *nodename, char *content, struct parser_state *state)
{
- static uint32_t button_map_from;
-
if (!nodename) {
return;
}
fill_font(node);
return;
}
+ if (!strcasecmp(nodename, "map.tablet")) {
+ fill_tablet_button_map(node);
+ return;
+ }
/* handle nodes without content, e.g. <keyboard><default /> */
if (!strcmp(nodename, "default.keyboard")) {
return;
}
- if (!strcasecmp(nodename, "map.tablet")) {
- button_map_from = UINT32_MAX;
- return;
- }
-
if (!strcasecmp(nodename, "prefix.desktops")) {
xstrdup_replace(rc.workspace_config.prefix, content ? content : "");
return;
rc.tablet.box.width = tablet_get_dbl_if_positive(content, "width");
} else if (!strcasecmp(nodename, "height.area.tablet")) {
rc.tablet.box.height = tablet_get_dbl_if_positive(content, "height");
- } else if (!strcasecmp(nodename, "button.map.tablet")) {
- button_map_from = tablet_button_from_str(content);
- } else if (!strcasecmp(nodename, "to.map.tablet")) {
- if (button_map_from != UINT32_MAX) {
- uint32_t button_map_to = mousebind_button_from_str(content, NULL);
- if (button_map_to != UINT32_MAX) {
- tablet_button_mapping_add(button_map_from, button_map_to);
- }
- } 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, "relativeMotionSensitivity.tabletTool")) {