interactive: Refactor natural_geometry/tiled state handling

Currently, snapping to a screen edge and then snapping to maximize
results in both the natural_geometry and tiled state of the view
getting messed up. After unmaximize, the view ends up in a weird
state (tiled location but natural/untiled size).

There are also a couple of sketchy things going on in the code:

- interactive_begin() pokes its own values into view->natural_geometry
  to force view_maximize() to set a particular geometry.

- interactive_end() "fixes" view->natural_geometry after calling
  view_maximize() to save the original geometry from the start of the
  interactive move/resize.

To fix all this:

- Adjust/expand the API of view.c so that the interactive.c can
  avoid this "back door" of overwriting view->natural_geometry
  directly.

- Save the natural geometry and the tiled state of the view in
  interactive_begin() when starting to move the view.  When done,
  interactive_end() will update the tiled state if appropriate but
  *not* overwrite the natural geometry.
This commit is contained in:
John Lindgren 2022-11-19 12:58:52 -05:00 committed by Johan Malm
parent 636b38561b
commit 9021020f6e
7 changed files with 192 additions and 120 deletions

View file

@ -254,7 +254,8 @@ actions_run(struct view *activator, struct server *server,
break;
case ACTION_TYPE_SNAP_TO_EDGE:
if (arg) {
view_snap_to_edge(view, action_str_from_arg(arg));
view_snap_to_edge(view, action_str_from_arg(arg),
/*store_natural_geometry*/ true);
} else {
wlr_log(WLR_ERROR, "Missing argument for SnapToEdge");
}