mirror of
https://github.com/labwc/labwc.git
synced 2026-02-11 04:27:51 -05:00
view: combine natural_geometry and last_layout_geometry
The logic around last_layout_geometry seems unnecessarily complicated. As far as I can see, it's basically just a copy of the natural_geometry with some special semantics, specifically: 1. it's copied *from* the natural geometry (or equivalently, the pending geometry if floating) at the first layout change after a user-initiated move or resize, and 2. it's copied *back to* the natural geometry at subsequent layout changes and used as the "original" position to restore. I don't see the point of the copying back and forth. Unless I'm missing something, we can achieve the same semantics in a lot less code by just updating/using the natural_geometry itself at the appropriate times. The only additional data needed is a single bool to track whether a layout change has occurred since the last user-initiated move/resize. No functional change intended, but I may be missing some subtleties as I found the existing code (and comments) quite difficult to follow.
This commit is contained in:
parent
25be8b3757
commit
e11600da9e
3 changed files with 34 additions and 126 deletions
|
|
@ -209,17 +209,16 @@ struct view {
|
|||
/*
|
||||
* Saved geometry which will be restored when the view returns
|
||||
* to normal/floating state after being maximized/fullscreen/
|
||||
* tiled. Values are undefined/out-of-date when the view is not
|
||||
* maximized/fullscreen/tiled.
|
||||
* tiled. The natural geometry is also saved prior to relocating
|
||||
* the view due to an output layout change, so that the view can
|
||||
* be restored to its original location later.
|
||||
*/
|
||||
struct wlr_box natural_geometry;
|
||||
/*
|
||||
* Whenever an output layout change triggers a view relocation, the
|
||||
* last pending position (or natural geometry) will be saved so the
|
||||
* view may be restored to its original location on a subsequent layout
|
||||
* change.
|
||||
* True if the most recent move/resize of the view was due to a
|
||||
* layout change. False if it was due to user-initiated action.
|
||||
*/
|
||||
struct wlr_box last_layout_geometry;
|
||||
bool adjusted_for_layout_change;
|
||||
|
||||
/* used by xdg-shell views */
|
||||
uint32_t pending_configure_serial;
|
||||
|
|
@ -533,7 +532,6 @@ bool view_titlebar_visible(struct view *view);
|
|||
void view_set_ssd_mode(struct view *view, enum lab_ssd_mode mode);
|
||||
void view_set_decorations(struct view *view, enum lab_ssd_mode mode, bool force_ssd);
|
||||
void view_toggle_fullscreen(struct view *view);
|
||||
void view_invalidate_last_layout_geometry(struct view *view);
|
||||
void view_adjust_for_layout_change(struct view *view);
|
||||
void view_move_to_edge(struct view *view, enum lab_edge direction, bool snap_to_windows);
|
||||
void view_grow_to_edge(struct view *view, enum lab_edge direction);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue