]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: support tablet tool mouse buttons
authorJens Peters <jp7677@gmail.com>
Sun, 1 Jun 2025 21:09:52 +0000 (23:09 +0200)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Sat, 7 Jun 2025 20:31:23 +0000 (05:31 +0900)
Those are regular mouse buttons, but attached
to a tablet tool (which looks like a mouse).

docs/labwc-config.5.scd
src/config/tablet.c

index 9e18d76406d7bc36c9fec785f8f6e1fb9e1cfa41..90276203adbb34700bfe1f65812c098387fbf1d4 100644 (file)
@@ -916,13 +916,15 @@ extending outward from the snapped edge.
        available mouse buttons. If not specified otherwise, the tip is
        mapped to left mouse click, the first pen button (Stylus) is mapped
        to right mouse button click and the second pen button (Stylus2)
-       emulates a middle mouse button click.
+       emulates a middle mouse button click. Buttons of a tablet tool mouse
+       are by default mapped to their (regular) mouse counterparts.
 
        Supported map *buttons* for mouse emulation are:
        - Tip
        - Stylus
        - Stylus2
        - Stylus3
+       - Left..Task
        - Pad
        - Pad2..Pad9
 
index 650385d27c646dbe5d6ea928df0ee12aa99ec9f3..b7d16c2466ec6e88f8f68727a5729979f8b9b739 100644 (file)
@@ -51,6 +51,22 @@ tablet_button_from_str(const char *button)
                return BTN_STYLUS2;
        } else if (!strcasecmp(button, "Stylus3")) {
                return BTN_STYLUS3;
+       } else if (!strcasecmp(button, "Left")) {
+               return BTN_LEFT;
+       } else if (!strcasecmp(button, "Right")) {
+               return BTN_RIGHT;
+       } else if (!strcasecmp(button, "Middle")) {
+               return BTN_MIDDLE;
+       } else if (!strcasecmp(button, "Side")) {
+               return BTN_SIDE;
+       } else if (!strcasecmp(button, "Extra")) {
+               return BTN_EXTRA;
+       } else if (!strcasecmp(button, "Forward")) {
+               return BTN_FORWARD;
+       } else if (!strcasecmp(button, "Back")) {
+               return BTN_BACK;
+       } else if (!strcasecmp(button, "Task")) {
+               return BTN_TASK;
        } else if (!strcasecmp(button, "Pad")) {
                return LAB_BTN_PAD;
        } else if (!strcasecmp(button, "Pad2")) {
@@ -109,6 +125,16 @@ tablet_load_default_button_mappings(void)
 
        tablet_button_mapping_add(BTN_STYLUS, BTN_RIGHT);
        tablet_button_mapping_add(BTN_STYLUS2, BTN_MIDDLE);
+
+       /* pass-through buttons of a tablet tool mouse */
+       tablet_button_mapping_add(BTN_LEFT, BTN_LEFT);
+       tablet_button_mapping_add(BTN_RIGHT, BTN_RIGHT);
+       tablet_button_mapping_add(BTN_MIDDLE, BTN_MIDDLE);
+       tablet_button_mapping_add(BTN_SIDE, BTN_SIDE);
+       tablet_button_mapping_add(BTN_EXTRA, BTN_EXTRA);
+       tablet_button_mapping_add(BTN_FORWARD, BTN_FORWARD);
+       tablet_button_mapping_add(BTN_BACK, BTN_BACK);
+       tablet_button_mapping_add(BTN_TASK, BTN_TASK);
 }
 
 uint32_t