decorations: implement Decoration/Undecorate actions

This commit is contained in:
Tobias Bengfort 2024-04-18 10:38:50 +02:00
parent 873393a8da
commit 84452debaf
4 changed files with 21 additions and 10 deletions

View file

@ -120,6 +120,12 @@ Actions are used in menus and keyboard/mouse bindings.
*<action name="ToggleDecorations" />*
Toggle decorations of focused window.
*<action name="Decorate" />*
Enable decorations of focused window.
*<action name="Undecorate" />*
Disable decorations of focused window.
*<action name="ToggleFullscreen" />*
Toggle fullscreen state of focused window.

View file

@ -440,7 +440,6 @@ void view_maximize(struct view *view, enum view_axis axis,
bool store_natural_geometry);
void view_set_fullscreen(struct view *view, bool fullscreen);
void view_toggle_maximize(struct view *view, enum view_axis axis);
void view_toggle_decorations(struct view *view);
bool view_is_always_on_top(struct view *view);
bool view_is_always_on_bottom(struct view *view);

View file

@ -79,6 +79,8 @@ enum action_type {
ACTION_TYPE_MAXIMIZE,
ACTION_TYPE_TOGGLE_FULLSCREEN,
ACTION_TYPE_TOGGLE_DECORATIONS,
ACTION_TYPE_DECORATE,
ACTION_TYPE_UNDECORATE,
ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP,
ACTION_TYPE_TOGGLE_ALWAYS_ON_BOTTOM,
ACTION_TYPE_TOGGLE_OMNIPRESENT,
@ -132,6 +134,8 @@ const char *action_names[] = {
"Maximize",
"ToggleFullscreen",
"ToggleDecorations",
"Decorate",
"Undecorate",
"ToggleAlwaysOnTop",
"ToggleAlwaysOnBottom",
"ToggleOmnipresent",
@ -787,7 +791,17 @@ actions_run(struct view *activator, struct server *server,
break;
case ACTION_TYPE_TOGGLE_DECORATIONS:
if (view) {
view_toggle_decorations(view);
view_set_decorations(view, !view->ssd_enabled);
}
break;
case ACTION_TYPE_DECORATE:
if (view) {
view_set_decorations(view, true);
}
break;
case ACTION_TYPE_UNDECORATE:
if (view) {
view_set_decorations(view, false);
}
break;
case ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP:

View file

@ -1193,14 +1193,6 @@ view_toggle_maximize(struct view *view, enum view_axis axis)
}
}
void
view_toggle_decorations(struct view *view)
{
assert(view);
view_set_decorations(view, !view->ssd_enabled);
}
bool
view_is_always_on_top(struct view *view)
{