]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: don't use bitset for VIEW_EDGE_ALL
authortokyo4j <hrak1529@gmail.com>
Sat, 2 Aug 2025 12:11:12 +0000 (21:11 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 4 Aug 2025 20:24:12 +0000 (21:24 +0100)
We will use bitset for views snapped to corner (e.g. top-left = TOP|LEFT)

include/view.h
src/view.c

index 6b2ccdb654e1e81c2c8f20fbbd7bf92fa11077e3..240d1f7dab951fced55204010c04c175d1a96752 100644 (file)
@@ -72,9 +72,7 @@ enum view_edge {
        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),
+       VIEW_EDGE_ANY = (1 << 5),
 };
 
 enum view_wants_focus {
index f1ffa85c02959850c0a8e7ba70a39d29ae1de150..4f9345d5a0f7838b16fd38c8772bbaf5e568c5b6 100644 (file)
@@ -169,8 +169,14 @@ view_matches_query(struct view *view, struct view_query *query)
                return false;
        }
 
-       if (query->tiled != VIEW_EDGE_INVALID && !(query->tiled & view->tiled)) {
-               return false;
+       if (query->tiled == VIEW_EDGE_ANY) {
+               if (!view->tiled) {
+                       return false;
+               }
+       } else if (query->tiled != VIEW_EDGE_INVALID) {
+               if (query->tiled != view->tiled) {
+                       return false;
+               }
        }
 
        const char *tiled_region =
@@ -2136,7 +2142,7 @@ view_edge_parse(const char *direction, bool tiled, bool any)
 
        if (any) {
                if (!strcasecmp(direction, "any")) {
-                       return VIEW_EDGE_ALL;
+                       return VIEW_EDGE_ANY;
                }
        }