From a73b8661290b17bc028ff90ea0eb0dc4518c6316 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Sun, 1 Jun 2025 23:09:52 +0200 Subject: [PATCH] config: support tablet tool mouse buttons Those are regular mouse buttons, but attached to a tablet tool (which looks like a mouse). --- docs/labwc-config.5.scd | 4 +++- src/config/tablet.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 9e18d764..90276203 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -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 diff --git a/src/config/tablet.c b/src/config/tablet.c index 650385d2..b7d16c24 100644 --- a/src/config/tablet.c +++ b/src/config/tablet.c @@ -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 -- 2.52.0