From 02be24bf59188b2b1cb4fa4a1890952f15619e8e Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Tue, 2 Sep 2025 08:32:23 +0900 Subject: [PATCH] mousebind: support `Border` context This new context includes `Top`...`BRCorner` and makes it easier to modify the mousebinds bound to them. --- docs/labwc-config.5.scd | 1 + docs/rc.xml.all | 37 +------------------------------ include/config/default-bindings.h | 37 +------------------------------ include/ssd.h | 1 + src/config/mousebind.c | 2 ++ src/ssd/ssd.c | 4 ++++ 6 files changed, 10 insertions(+), 72 deletions(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 1dc59a8c..95600d3b 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -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. diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 940b2f96..f91985c3 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -375,42 +375,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/include/config/default-bindings.h b/include/config/default-bindings.h index 98c0b206..12ec5c4c 100644 --- a/include/config/default-bindings.h +++ b/include/config/default-bindings.h @@ -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", diff --git a/include/ssd.h b/include/ssd.h index f3597f31..f1e03843 100644 --- a/include/ssd.h +++ b/include/ssd.h @@ -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, diff --git a/src/config/mousebind.c b/src/config/mousebind.c index 0f49b6a5..ad7f6712 100644 --- a/src/config/mousebind.c +++ b/src/config/mousebind.c @@ -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")) { diff --git a/src/ssd/ssd.c b/src/ssd/ssd.c index adf7c2cb..d0603d5e 100644 --- a/src/ssd/ssd.c +++ b/src/ssd/ssd.c @@ -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; -- 2.52.0