]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: add option for forcing mouse emulation
authorJens Peters <jp7677@gmail.com>
Mon, 22 Apr 2024 15:21:55 +0000 (17:21 +0200)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 27 May 2024 20:40:50 +0000 (22:40 +0200)
Default is off. Also allow switching with reconfigure.

include/config/rcxml.h
src/config/rcxml.c
src/input/tablet.c

index 41c34c95d05de81b9395b92e32cd5f648fd40b66..1ebfddee08d962c00963f1cb07329c28e6905f1a 100644 (file)
@@ -94,6 +94,7 @@ struct rcxml {
 
        /* graphics tablet */
        struct tablet_config {
+               bool force_mouse_emulation;
                char *output_name;
                struct wlr_fbox box;
                enum rotation rotation;
index 67cbd421ed7792fb473d04b71b61fb45f83f311f..741938a9ac77eb4976d315d7d02105a273795151 100644 (file)
@@ -1020,6 +1020,8 @@ entry(xmlNode *node, char *nodename, char *content)
                } else {
                        wlr_log(WLR_ERROR, "Invalid value for <resize popupShow />");
                }
+       } else if (!strcasecmp(nodename, "mouseEmulation.tablet")) {
+               set_bool(content, &rc.tablet.force_mouse_emulation);
        } else if (!strcasecmp(nodename, "mapToOutput.tablet")) {
                rc.tablet.output_name = xstrdup(content);
        } else if (!strcasecmp(nodename, "rotate.tablet")) {
@@ -1229,6 +1231,7 @@ rcxml_init(void)
        rc.doubleclick_time = 500;
        rc.scroll_factor = 1.0;
 
+       rc.tablet.force_mouse_emulation = false;
        rc.tablet.output_name = NULL;
        rc.tablet.rotation = 0;
        rc.tablet.box = (struct wlr_fbox){0};
index 92a179141ccdd95d98dc119a98a332802ce14317..4e856a7be0e1b60294526f1f105f6a880c66204a 100644 (file)
@@ -91,7 +91,8 @@ tablet_get_coords(struct drawing_tablet *tablet, double *x, double *y)
                rc.tablet.box, x, y);
        adjust_for_rotation(rc.tablet.rotation, x, y);
 
-       if (!tablet->tablet_v2) {
+       if (rc.tablet.force_mouse_emulation
+                       || !tablet->tablet_v2) {
                return NULL;
        }
 
@@ -154,7 +155,8 @@ handle_proximity(struct wl_listener *listener, void *data)
        double x, y;
        struct wlr_surface *surface = tablet_get_coords(tablet, &x, &y);
 
-       if (tablet->seat->server->tablet_manager && !tool) {
+       if (!rc.tablet.force_mouse_emulation
+                       && tablet->seat->server->tablet_manager && !tool) {
                /*
                 * Unfortunately `wlr_tool` is only present in the events, so
                 * use proximity for creating a `wlr_tablet_v2_tablet_tool`.