]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: add user names for pad butttons
authorJens Peters <jp7677@gmail.com>
Tue, 2 Jan 2024 19:31:17 +0000 (20:31 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 2 Jan 2024 21:28:42 +0000 (21:28 +0000)
docs/rc.xml.all
include/input/tablet_pad.h
src/config/tablet.c

index 9cc6dd0a18414986f7bd5aca68b5f10e30322711..44397af8d23cd01a917d66499686584ace094a2f 100644 (file)
     after applying tablet area transformation.
 
     Tablet buttons emulate regular mouse buttons. The tablet *button* can
-    be set to any of [tip|stylus|stylus2|stylus3]. Valid *to* mouse buttons
-    are [left|right|middle].
+    be set to any of [tip|stylus|stylus2|stylus3|pad|pad2|pad3|..|pad9].
+    Valid *to* mouse buttons are [left|right|middle].
   -->
   <tablet rotate="0">
     <!-- Active area dimensions are in mm -->
index 144bec7d6e81cc86cc4c15c423771875176209da..20256b52795352b63313ff1f35b7f1ba6cf977dc 100644 (file)
@@ -7,6 +7,16 @@ struct seat;
 struct wlr_device;
 struct wlr_input_device;
 
+#define LAB_BTN_PAD 0x0
+#define LAB_BTN_PAD2 0x1
+#define LAB_BTN_PAD3 0x2
+#define LAB_BTN_PAD4 0x3
+#define LAB_BTN_PAD5 0x4
+#define LAB_BTN_PAD6 0x5
+#define LAB_BTN_PAD7 0x6
+#define LAB_BTN_PAD8 0x7
+#define LAB_BTN_PAD9 0x8
+
 struct drawing_tablet_pad {
        struct seat *seat;
        struct wlr_tablet_pad *tablet;
index 7c6ee2f1fae5191ee5d0125cd48bb34195fe1813..418fefdd1a3f3d7677791ea2d8d6063807e855f8 100644 (file)
@@ -6,6 +6,7 @@
 #include <wlr/util/log.h>
 #include "config/tablet.h"
 #include "config/rcxml.h"
+#include "input/tablet_pad.h"
 
 double
 tablet_get_dbl_if_positive(const char *content, const char *name)
@@ -48,6 +49,24 @@ tablet_button_from_str(const char *button)
                return BTN_STYLUS2;
        } else if (!strcasecmp(button, "Stylus3")) {
                return BTN_STYLUS3;
+       } else if (!strcasecmp(button, "Pad")) {
+               return LAB_BTN_PAD;
+       } else if (!strcasecmp(button, "Pad2")) {
+               return LAB_BTN_PAD2;
+       } else if (!strcasecmp(button, "Pad3")) {
+               return LAB_BTN_PAD3;
+       } else if (!strcasecmp(button, "Pad4")) {
+               return LAB_BTN_PAD4;
+       } else if (!strcasecmp(button, "Pad5")) {
+               return LAB_BTN_PAD5;
+       } else if (!strcasecmp(button, "Pad6")) {
+               return LAB_BTN_PAD6;
+       } else if (!strcasecmp(button, "Pad7")) {
+               return LAB_BTN_PAD7;
+       } else if (!strcasecmp(button, "Pad8")) {
+               return LAB_BTN_PAD8;
+       } else if (!strcasecmp(button, "Pad9")) {
+               return LAB_BTN_PAD9;
        }
        wlr_log(WLR_ERROR, "Invalid value for tablet button: %s", button);
        return UINT32_MAX;