]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: reuse mousebind_button_from_str()
authorJens Peters <jp7677@gmail.com>
Sat, 6 Jan 2024 16:56:32 +0000 (17:56 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 6 Jan 2024 19:37:41 +0000 (19:37 +0000)
include/config/tablet.h
src/config/rcxml.c
src/config/tablet.c

index 0ba6a87be28df17d5974d2bfd2e9be0abc7ea5ff..6498b91cbe9ff78c2e6ce01361eb1b44d9be669b 100644 (file)
@@ -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);
 
index 54aacb9c75cec92fd72e3eb4c0ad44db06c6a9d1..1ff3766fdfce6935b9f1da0b1a54fec145beaef2 100644 (file)
@@ -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);
                        }
index 418fefdd1a3f3d7677791ea2d8d6063807e855f8..8ac6a0b5a9591187a2a2fd466cbc3110317e3a3d 100644 (file)
@@ -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)
 {