]> git.mdlowis.com Git - proto/labwc.git/commitdiff
actions: added query tiled=any comparison for rc.xml simplification
authorlynxy <git@lynxdev.xyz>
Wed, 2 Jul 2025 22:04:27 +0000 (00:04 +0200)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Sat, 19 Jul 2025 03:29:55 +0000 (12:29 +0900)
docs/labwc-actions.5.scd
include/view.h
src/view.c

index bf760fdb417570b1a7ec851797ea05e5b3ad2550..52a3d2fb83dd8d00c502faa28c943cf301edfc65 100644 (file)
@@ -474,7 +474,7 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
                        The "left" , "right", "left-occupied" and
                        "right-occupied" directions will not wrap.
 
-               *tiled* [up|right|down|left|center]
+               *tiled* [up|right|down|left|center|any]
                        Whether the client is tiled (snapped) along the the
                        indicated screen edge.
 
index 2ea83cd7d96b8fc613fd1059e86f4f0b402b8e2d..c48248039839c0e64a2c8757b6935d78b5208f82 100644 (file)
@@ -62,11 +62,14 @@ enum view_axis {
 enum view_edge {
        VIEW_EDGE_INVALID = 0,
 
-       VIEW_EDGE_LEFT,
-       VIEW_EDGE_RIGHT,
-       VIEW_EDGE_UP,
-       VIEW_EDGE_DOWN,
-       VIEW_EDGE_CENTER,
+       VIEW_EDGE_LEFT = (1 << 0),
+       VIEW_EDGE_RIGHT = (1 << 1),
+       VIEW_EDGE_UP = (1 << 2),
+       VIEW_EDGE_DOWN = (1 << 3),
+       VIEW_EDGE_CENTER = (1 << 4),
+
+       VIEW_EDGE_ALL = (VIEW_EDGE_LEFT | VIEW_EDGE_RIGHT |
+               VIEW_EDGE_UP | VIEW_EDGE_DOWN | VIEW_EDGE_CENTER),
 };
 
 enum view_wants_focus {
index 59c32e27a226b4ee48486e5b0de9226c1aca0a2f..1a9d92ccb2bfdcec6aea5ad996aac10ebd4a576f 100644 (file)
@@ -166,7 +166,7 @@ view_matches_query(struct view *view, struct view_query *query)
                return false;
        }
 
-       if (query->tiled != VIEW_EDGE_INVALID && query->tiled != view->tiled) {
+       if (query->tiled != VIEW_EDGE_INVALID && !(query->tiled & view->tiled)) {
                return false;
        }
 
@@ -2116,6 +2116,8 @@ view_edge_parse(const char *direction)
                return VIEW_EDGE_DOWN;
        } else if (!strcasecmp(direction, "center")) {
                return VIEW_EDGE_CENTER;
+       } else if (!strcasecmp(direction, "any")) {
+               return VIEW_EDGE_ALL;
        } else {
                return VIEW_EDGE_INVALID;
        }