From b7cce58f56e6de22511cb2f192f036332ab67a80 Mon Sep 17 00:00:00 2001 From: bi4k8 Date: Sun, 19 Sep 2021 22:16:56 +0000 Subject: [PATCH] implement ToggleDecorations and ToggleFullscreen actions --- include/labwc.h | 2 ++ src/action.c | 10 ++++++++++ src/view.c | 13 +++++++++++++ 3 files changed, 25 insertions(+) diff --git a/include/labwc.h b/include/labwc.h index 141b0749..a0284e14 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -317,6 +317,8 @@ void view_maximize(struct view *view, bool maximize); void view_set_fullscreen(struct view *view, bool fullscreen, struct wlr_output *wlr_output); void view_toggle_maximize(struct view *view); +void view_toggle_decorations(struct view *view); +void view_toggle_fullscreen(struct view *view); void view_for_each_surface(struct view *view, wlr_surface_iterator_func_t iterator, void *user_data); void view_for_each_popup_surface(struct view *view, diff --git a/src/action.c b/src/action.c index 87e8a3a5..80ce4eae 100644 --- a/src/action.c +++ b/src/action.c @@ -54,6 +54,16 @@ action(struct server *server, const char *action, const char *command) if (view) { view_toggle_maximize(view); } + } else if (!strcasecmp(action, "ToggleFullscreen")) { + struct view *view = topmost_mapped_view(server); + if (view) { + view_toggle_fullscreen(view); + } + } else if (!strcasecmp(action, "ToggleDecorations")) { + struct view *view = topmost_mapped_view(server); + if (view) { + view_toggle_decorations(view); + } } else { wlr_log(WLR_ERROR, "action (%s) not supported", action); } diff --git a/src/view.c b/src/view.c index a338e889..0c657020 100644 --- a/src/view.c +++ b/src/view.c @@ -107,6 +107,19 @@ view_toggle_maximize(struct view *view) view_maximize(view, !view->maximized); } +void +view_toggle_decorations(struct view *view) +{ + view->ssd.enabled = !view->ssd.enabled; + ssd_update_geometry(view, true); +} + +void +view_toggle_fullscreen(struct view *view) +{ + view_set_fullscreen(view, !view->fullscreen, NULL); +} + void view_set_fullscreen(struct view *view, bool fullscreen, struct wlr_output *wlr_output)