window: Replace the user_rect with the unconstrained_rect

Realistically, the user rect contains the unconstrained window
rectangle coordinates that we want to be displaying, in case
something in the constraints change.

Rename it to the "unconstrained_rect", and change the code to always
save it, regardless of current state.

When metacity was originally being built, the purpose of the user
rect was a lot less clear. The code only saved it on user actions,
with various other calls to save_user_window_placement() and a force
mechanism sprinkled in to avoid windows being snapped back to odd
places when constraints changed.

This could lead to odd bugs. For instance, if the user uses some
extension which automatically tiles windows and didn't pass
user_action=TRUE, and then the struts changed, the window would be
placed back at the last place a user moved it to, rather than where
the window was tiled to.

The META_IS_USER_ACTION flag is still used in the constraints code
to determine whether we should allow shoving windows offscreen, so
we can't remove it completely, but we should think about splitting
out the constrainment policies it commands for a bit more
fine-grained control.

https://bugzilla.gnome.org/show_bug.cgi?id=726714
This commit is contained in:
Jasper St. Pierre
2014-03-18 10:53:00 -04:00
parent 4a7939268c
commit 2c0ad5bef7
5 changed files with 29 additions and 114 deletions

View File

@@ -302,9 +302,6 @@ struct _MetaWindow
/* Have we placed this window? */
guint placed : 1;
/* Must we force_save_user_window_placement? */
guint force_save_user_rect : 1;
/* Is this not a transient of the focus window which is being denied focus? */
guint denied_focus_and_not_transient : 1;
@@ -422,17 +419,16 @@ struct _MetaWindow
*/
MetaRectangle saved_rect;
/* This is the geometry the window had after the last user-initiated
* move/resize operations. We use this whenever we are moving the
* implicitly (for example, if we move to avoid a panel, we can snap
* back to this position if the panel moves again). Note that this
* gives the position and size of the client window (i.e. ignoring
* the frame).
/* This is the geometry the window will have if no constraints have
* applied. We use this whenever we are moving implicitly (for example,
* if we move to avoid a panel, we can snap back to this position if
* the panel moves again). Note that this gives the position and size
* of the client window (i.e. ignoring the frame).
*
* Position always in root coords, unlike window->rect.
*/
MetaRectangle user_rect;
MetaRectangle unconstrained_rect;
/* Cached net_wm_icon_geometry */
MetaRectangle icon_geometry;
@@ -742,7 +738,6 @@ void meta_window_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags,
int gravity,
MetaRectangle client_rect);
void meta_window_save_user_window_placement (MetaWindow *window);
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);
void meta_window_grab_op_ended (MetaWindow *window, MetaGrabOp op);