]> git.mdlowis.com Git - proto/labwc.git/commitdiff
interactive: reset tiled state when dragging out of snapped position
authorAndrew J. Hesford <ajh@sideband.org>
Tue, 23 Jan 2024 00:04:16 +0000 (19:04 -0500)
committerAndrew J. Hesford <ajh@sideband.org>
Tue, 30 Jan 2024 12:30:07 +0000 (07:30 -0500)
This ensures that client-side decorations (and maybe other client
behaviors) behave intuitively during interative moves, but means that

    drag to snapped position -> drag to maximize -> un-maximize

will put the window back to its natural geometry (saved before the first
snap) rather than back to the snapped position. This is a change in
behavior, but a) simplifies the logic a bit, because the tiled state is
always in sync with the window geometry and b) in some sense is "more
correct", because the window has been "visually" un-tiled the minute the
window starts dragging.

Note that maximizing using an action (including the button) a window
that has been snapped and then un-maximizing the window will put the
window back to the snapped position, as it always has.

src/interactive.c

index b09ba01cd5c63ed791d9e041d3d5b7bcd10f0672..432027a6f986474d13cf8b149e225d3576130ddf 100644 (file)
@@ -69,6 +69,7 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
                                geometry.height);
 
                        view_set_shade(view, false);
+                       view_set_untiled(view);
                        view_restore_to(view, geometry);
                } else {
                        /* Store natural geometry at start of move */
@@ -201,9 +202,8 @@ interactive_finish(struct view *view)
        }
 
        if (view->server->input_mode == LAB_INPUT_STATE_MOVE) {
-               /* Reset tiled state if not snapped */
-               if (!snap_to_region(view) && !snap_to_edge(view)) {
-                       view_set_untiled(view);
+               if (!snap_to_region(view)) {
+                       snap_to_edge(view);
                }
        }