interactive: reset tiled state when dragging out of snapped position

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.
This commit is contained in:
Andrew J. Hesford 2024-01-22 19:04:16 -05:00
parent c1a2dd3e27
commit 9f51384b6a

View 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);
}
}