From 83a0be1b9c1af1e7dd9163ccaa5c205efbc8e565 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Thu, 22 Dec 2022 03:22:34 +0100 Subject: [PATCH] src/view.c: Allow snapping to the same edge Reported-by: @Flrian via IRC Debugged-by: @Flrian Tested-by: @Flrian --- src/view.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/view.c b/src/view.c index f520b3e6..db326c3e 100644 --- a/src/view.c +++ b/src/view.c @@ -855,7 +855,22 @@ view_snap_to_edge(struct view *view, const char *direction, edge = view_edge_invert(edge); output = output_from_wlr_output(view->server, new_output); } else { - /* No more output to move to */ + /* + * No more output to move to + * + * We re-apply the tiled geometry without changing any + * state because the window might have been moved away + * (and thus got untiled) and then snapped back to the + * original edge. + * + * TODO: The described pattern will cause another bug + * in multi monitor setups: it will snap the + * window to the inverted edge of the nearest + * output. This is the desired behavior when + * caused by a keybind but doesn't make sense + * when caused by mouse movement. + */ + view_apply_tiled_geometry(view, output); return; } }