]> git.mdlowis.com Git - proto/labwc.git/commitdiff
implement ToggleDecorations and ToggleFullscreen actions
authorbi4k8 <bi4k8@github>
Sun, 19 Sep 2021 22:16:56 +0000 (22:16 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 20 Sep 2021 20:14:24 +0000 (21:14 +0100)
include/labwc.h
src/action.c
src/view.c

index 141b0749b5a68b0b6a1f5edc3f4377f8bbb98c24..a0284e143ae6511e52a3ef8ac7db77d1c9868d89 100644 (file)
@@ -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,
index 87e8a3a5572dca6211a1ac8a992949c78c4fdfc1..80ce4eaeed5a04820f613c05801bfe91176cb9ec 100644 (file)
@@ -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);
        }
index a338e889e3f769445552e871eccf052b457406e5..0c657020e9bb4f1c422ec3325f20b625e2272ce5 100644 (file)
@@ -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)