From: John Lindgren Date: Mon, 21 Nov 2022 18:17:14 +0000 (-0500) Subject: view: Add view_set_untiled() X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e79c95489a9ef15b0a669a7ec2553e4942c433dd;p=proto%2Flabwc.git view: Add view_set_untiled() --- diff --git a/include/view.h b/include/view.h index 69d3f933..f94e76da 100644 --- a/include/view.h +++ b/include/view.h @@ -126,6 +126,7 @@ struct wlr_output *view_wlr_output(struct view *view); void view_store_natural_geometry(struct view *view); void view_center(struct view *view); void view_restore_to(struct view *view, struct wlr_box geometry); +void view_set_untiled(struct view *view); void view_maximize(struct view *view, bool maximize, bool store_natural_geometry); void view_set_fullscreen(struct view *view, bool fullscreen, diff --git a/src/interactive.c b/src/interactive.c index dcfe061a..f21c915e 100644 --- a/src/interactive.c +++ b/src/interactive.c @@ -74,7 +74,7 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges) * Reset tiled state but keep the same geometry as the * starting point for the resize. */ - view->tiled = 0; + view_set_untiled(view); cursor_set(seat, cursor_get_from_edge(edges)); break; default: @@ -146,7 +146,7 @@ interactive_finish(struct view *view) if (mode == LAB_INPUT_STATE_MOVE) { if (!snap_to_edge(view)) { /* Reset tiled state if not snapped */ - view->tiled = 0; + view_set_untiled(view); } } /* Update focus/cursor image */ diff --git a/src/view.c b/src/view.c index ca67a622..6f53cbc0 100644 --- a/src/view.c +++ b/src/view.c @@ -447,7 +447,7 @@ set_maximized(struct view *view, bool maximized) /* * Un-maximize view and move it to specific geometry. Does not reset - * tiled state (set view->tiled = 0 manually if you want that). + * tiled state (use view_set_untiled() if you want that). */ void view_restore_to(struct view *view, struct wlr_box geometry) @@ -462,6 +462,14 @@ view_restore_to(struct view *view, struct wlr_box geometry) view_move_resize(view, geometry); } +/* Reset tiled state of view without changing geometry */ +void +view_set_untiled(struct view *view) +{ + assert(view); + view->tiled = VIEW_EDGE_INVALID; +} + void view_maximize(struct view *view, bool maximize, bool store_natural_geometry) {