Skip to content

Commit

Permalink
decorations: add "initial" mode
Browse files Browse the repository at this point in the history
  • Loading branch information
xi committed Apr 19, 2024
1 parent b339fca commit 6dff8b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 5 additions & 4 deletions docs/labwc-actions.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions include/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
10 changes: 9 additions & 1 deletion src/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6dff8b7

Please sign in to comment.