]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: Add view_set_untiled()
authorJohn Lindgren <john@jlindgren.net>
Mon, 21 Nov 2022 18:17:14 +0000 (13:17 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 22 Nov 2022 08:17:33 +0000 (09:17 +0100)
include/view.h
src/interactive.c
src/view.c

index 69d3f9336e01fb7974c6d9d1bedbe6900fb25e74..f94e76dac85d40abcc3952d9c5a7adfed10fd248 100644 (file)
@@ -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,
index dcfe061a6a85588a6094c1186811d3aefb9da817..f21c915eb0563091dd47bab6ebd7622f63353345 100644 (file)
@@ -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 */
index ca67a6221a351b3eb9d4860d954a328e967d2400..6f53cbc0c030fdcaec9539a2e35096dc8418e35d 100644 (file)
@@ -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)
 {