decorations: add "initial" mode

This commit is contained in:
Tobias Bengfort 2024-04-19 13:59:05 +02:00
parent 85e1b454ff
commit abdfc921d2
3 changed files with 15 additions and 5 deletions

View file

@ -131,10 +131,11 @@ Actions are used in menus and keyboard/mouse bindings.
*<action name="Decorate" mode="value" />*
Enable decorations of focused window.
*mode* [yes|no|full|border|none] "full", "border" and "none" are the
three modes described in 'ToggleDecorations'. "yes" and "no"
automatically select an appropriate mode based on 'keepBorder' and
whether the window has client side decorations. Default is yes.
*mode* [yes|no|initial|full|border|none] "full", "border" and "none"
are the three modes described in 'ToggleDecorations'. "yes", "no", and
"initial" automatically select an appropriate mode based on
'keepBorder' and whether the window has client side decorations.
Default is yes.
*<action name="Undecorate" />*
Disable decorations of focused window.

View file

@ -34,6 +34,7 @@ enum ssd_mode {
LAB_SSD_MODE_NONE,
LAB_SSD_MODE_BORDER,
LAB_SSD_MODE_FULL,
LAB_SSD_MODE_INITIAL,
LAB_SSD_MODE_YES,
LAB_SSD_MODE_NO
};

View file

@ -1292,7 +1292,13 @@ resolve_ssd_mode(struct view *view, enum ssd_mode mode)
{
assert(view);
if (mode == LAB_SSD_MODE_YES) {
if (mode == LAB_SSD_MODE_INITIAL) {
if (has_ssd(view)) {
return LAB_SSD_MODE_FULL;
} else {
return LAB_SSD_MODE_NONE;
}
} else if (mode == LAB_SSD_MODE_YES) {
return LAB_SSD_MODE_FULL;
} else if (mode == LAB_SSD_MODE_NO) {
if (rc.ssd_keep_border && has_ssd(view)) {
@ -1875,6 +1881,8 @@ ssd_mode_parse(const char *mode)
return LAB_SSD_MODE_BORDER;
} else if (!strcasecmp(mode, "none")) {
return LAB_SSD_MODE_NONE;
} else if (!strcasecmp(mode, "initial")) {
return LAB_SSD_MODE_INITIAL;
} else if (!strcasecmp(mode, "yes")) {
return LAB_SSD_MODE_YES;
} else {