view: Anchor right/bottom edge only when resizing via top/left edge

Currently, we anchor the right/bottom edge of the view whenever the top/
left edge is moving (current.x/y != pending.x/y). Doing so doesn't make
much sense when the right/bottom edge is also moving. In that case it's
probably best to move the view (or at least its top/left corner)
directly to its final position.

The most noticeable effect of this change is with views that don't
accept their requested size exactly when tiled or maximized (examples:
havoc, xfce4-terminal). Previously, their right-bottom corner would be
aligned with the screen edge, leaving gaps on the left and top. Now the
top-left corner will be aligned and the gaps will be on the right and
bottom. This is still not ideal, but IMHO less surprising to the user.
This commit is contained in:
John Lindgren 2023-02-25 12:05:22 -05:00 committed by Johan Malm
parent 9f00087a82
commit 0b34b9f69f
4 changed files with 77 additions and 35 deletions

View file

@ -7,8 +7,16 @@
* Please note: only xdg-shell-toplevel-view and xwayland-view view_impl
* functions should call these functions.
*/
struct view;
void view_impl_move_to_front(struct view *view);
void view_impl_map(struct view *view);
/*
* Updates view geometry at commit based on current position/size,
* pending move/resize, and committed surface size. The computed
* position may not match pending.x/y exactly in some cases.
*/
void view_impl_apply_geometry(struct view *view, int w, int h);
#endif /* __LABWC_VIEW_IMPL_COMMON_H */