]> git.mdlowis.com Git - proto/labwc.git/commitdiff
action: Add HideCursor action
authorJens Peters <jp7677@gmail.com>
Sun, 23 Mar 2025 13:36:16 +0000 (14:36 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 24 Mar 2025 21:23:55 +0000 (21:23 +0000)
docs/labwc-actions.5.scd
src/action.c

index 6a46ea6ba01c7afa27319843a37c20b87020e71a..13170d77b5688f65d4e7f77c62d46ab6df6b07a1 100644 (file)
@@ -351,6 +351,12 @@ Actions are used in menus and keyboard/mouse bindings.
        *y* [center|value] Equivalent for the vertical warp position within the target area.
        Default is "center"
 
+*<action name="HideCursor" />*
+       Hide the pointer or stylus cursor. The cursor becomes visible again on following
+       pointer actions, stylus actions or touchpad gestures.
+       Use together with the WarpCursor action to not just hide the cursor but to
+       additionally move it away to prevent e.g. hover effects.
+
 *<action name="EnableTabletMouseEmulation" />*++
 *<action name="DisableTabletMouseEmulation" />*++
 *<action name="ToggleTabletMouseEmulation">*
index aa5d067240611d3ad2d5a1217629603041f5a85c..8643bb5e843b15970d155aae3c578a1506d3a504 100644 (file)
@@ -123,6 +123,7 @@ enum action_type {
        ACTION_TYPE_ZOOM_IN,
        ACTION_TYPE_ZOOM_OUT,
        ACTION_TYPE_WARP_CURSOR,
+       ACTION_TYPE_HIDE_CURSOR,
 };
 
 const char *action_names[] = {
@@ -188,6 +189,7 @@ const char *action_names[] = {
        "ZoomIn",
        "ZoomOut",
        "WarpCursor",
+       "HideCursor",
        NULL
 };
 
@@ -1335,6 +1337,9 @@ actions_run(struct view *activator, struct server *server,
                                warp_cursor(view, output, to, x, y);
                        }
                        break;
+               case ACTION_TYPE_HIDE_CURSOR:
+                       cursor_set_visible(&server->seat, false);
+                       break;
                case ACTION_TYPE_INVALID:
                        wlr_log(WLR_ERROR, "Not executing unknown action");
                        break;