mousebind: support Border context

This new context includes `Top`...`BRCorner` and makes it easier to modify
the mousebinds bound to them.
This commit is contained in:
tokyo4j 2025-09-02 08:32:23 +09:00 committed by Johan Malm
parent b5b257092d
commit 02be24bf59
6 changed files with 10 additions and 72 deletions

View 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.

View file

@ -375,42 +375,7 @@
</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>

View 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",

View 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,

View 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")) {

View 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;