From e51c3fc5d4ea09e6c763180a0d680cb9ec6bbda1 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Sat, 6 Jan 2024 17:56:32 +0100 Subject: [PATCH] config: reuse mousebind_button_from_str() --- include/config/tablet.h | 1 - src/config/rcxml.c | 2 +- src/config/tablet.c | 14 -------------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/config/tablet.h b/include/config/tablet.h index 0ba6a87b..6498b91c 100644 --- a/include/config/tablet.h +++ b/include/config/tablet.h @@ -20,7 +20,6 @@ struct button_map_entry { double tablet_get_dbl_if_positive(const char *content, const char *name); enum rotation tablet_parse_rotation(int value); uint32_t tablet_button_from_str(const char *button); -uint32_t mouse_button_from_str(const char *button); void tablet_button_mapping_add(uint32_t from, uint32_t to); void tablet_load_default_button_mappings(void); diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 54aacb9c..1ff3766f 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -868,7 +868,7 @@ entry(xmlNode *node, char *nodename, char *content) 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 = mouse_button_from_str(content); + 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); } diff --git a/src/config/tablet.c b/src/config/tablet.c index 418fefdd..8ac6a0b5 100644 --- a/src/config/tablet.c +++ b/src/config/tablet.c @@ -72,20 +72,6 @@ tablet_button_from_str(const char *button) return UINT32_MAX; } -uint32_t -mouse_button_from_str(const char *button) -{ - if (!strcasecmp(button, "Left")) { - return BTN_LEFT; - } else if (!strcasecmp(button, "Right")) { - return BTN_RIGHT; - } else if (!strcasecmp(button, "Middle")) { - return BTN_MIDDLE; - } - wlr_log(WLR_ERROR, "Invalid value for mouse button: %s", button); - return UINT32_MAX; -} - void tablet_button_mapping_add(uint32_t from, uint32_t to) {