]> git.mdlowis.com Git - proto/labwc.git/commitdiff
mousebind: support `Border` context
authortokyo4j <hrak1529@gmail.com>
Mon, 1 Sep 2025 23:32:23 +0000 (08:32 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 2 Sep 2025 20:29:10 +0000 (21:29 +0100)
This new context includes `Top`...`BRCorner` and makes it easier to modify
the mousebinds bound to them.

docs/labwc-config.5.scd
docs/rc.xml.all
include/config/default-bindings.h
include/ssd.h
src/config/mousebind.c
src/ssd/ssd.c

index 1dc59a8c4e1663c78c5c85208a01155666da10c2..95600d3b0b72e96fa8298e9c4a87cb90d7b1aba4 100644 (file)
@@ -747,6 +747,7 @@ extending outward from the snapped edge.
        - AllDesktops: A button that, by default, toggles omnipresence of a
          window.
        - Close: A button that, by default, closses a window.
+       - Border: The window's border including Top...BRCorner below.
        - Top: The top edge of the window's border.
        - Bottom: The bottom edge of the window's border.
        - Left: The left edge of the window's border.
index 940b2f96698800a920148202f303f18e02d35ba6..f91985c352c15ec3c145c5fdf7e06705e925faae 100644 (file)
       </mousebind>
     </context>
 
-    <context name="Top">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="Left">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="Right">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="Bottom">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="TRCorner">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="BRCorner">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="TLCorner">
-      <mousebind button="Left" action="Drag">
-        <action name="Resize" />
-      </mousebind>
-    </context>
-    <context name="BLCorner">
+    <context name="Border">
       <mousebind button="Left" action="Drag">
         <action name="Resize" />
       </mousebind>
index 98c0b206166476acc53ecaf7b739dae6d39c0b91..12ec5c4c9b6179bcb74bb9657b2e79a2183e25cd 100644 (file)
@@ -143,42 +143,7 @@ static struct mouse_combos {
                const char *name, *value;
        } attributes[2];
 } mouse_combos[] = { {
-               .context = "Left",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "Top",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "Bottom",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "Right",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "TLCorner",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "TRCorner",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "BRCorner",
-               .button = "Left",
-               .event = "Drag",
-               .action = "Resize",
-       }, {
-               .context = "BLCorner",
+               .context = "Border",
                .button = "Left",
                .event = "Drag",
                .action = "Resize",
index f3597f3180d0682bb39b72a59209e02a106e59a5..f1e038431d0069c93186bd4b307cf28922dc787f 100644 (file)
@@ -53,6 +53,7 @@ enum ssd_part_type {
        LAB_SSD_PART_RIGHT,
        LAB_SSD_PART_BOTTOM,
        LAB_SSD_PART_LEFT,
+       LAB_SSD_PART_BORDER,
 
        LAB_SSD_CLIENT,
        LAB_SSD_FRAME,
index 0f49b6a516cd7a629baa885ffb492a898e0d734f..ad7f6712af57e67401df95c84708c704730663a2 100644 (file)
@@ -132,6 +132,8 @@ context_from_str(const char *str)
                return LAB_SSD_PART_CORNER_BOTTOM_RIGHT;
        } else if (!strcasecmp(str, "BLCorner")) {
                return LAB_SSD_PART_CORNER_BOTTOM_LEFT;
+       } else if (!strcasecmp(str, "Border")) {
+               return LAB_SSD_PART_BORDER;
        } else if (!strcasecmp(str, "Top")) {
                return LAB_SSD_PART_TOP;
        } else if (!strcasecmp(str, "Right")) {
index adf7c2cbc2c92b65a6fadb7a734b1a8e9db8d86f..d0603d5e214253a2f190c0b133b05c7e55986d0b 100644 (file)
@@ -328,6 +328,10 @@ ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate)
                return candidate >= LAB_SSD_BUTTON_CLOSE
                        && candidate <= LAB_SSD_CLIENT;
        }
+       if (whole == LAB_SSD_PART_BORDER) {
+               return candidate >= LAB_SSD_PART_CORNER_TOP_LEFT
+                       && candidate <= LAB_SSD_PART_LEFT;
+       }
        if (whole == LAB_SSD_PART_TOP) {
                return candidate == LAB_SSD_PART_CORNER_TOP_LEFT
                        || candidate == LAB_SSD_PART_CORNER_TOP_RIGHT;