Fix windows walking up the screen on restart

When a window is initially created, we need to save it's user rect
after any adjustments for gravity. Otherwise, the next time the window is
queued for a resize, it will jump back to it's initial position.

We did that for newly created windows, but on restart, when windows
were already placed, the logic skipped saving the position. Use an
explicit flag so that we always save the position for newly created
MetaWindows.
This commit is contained in:
Owen W. Taylor 2014-07-08 21:08:31 -04:00
parent 14d2f8fddc
commit 8e5bb17750
2 changed files with 6 additions and 3 deletions

View File

@ -33,7 +33,9 @@ typedef enum
META_DO_GRAVITY_ADJUST = 1 << 1,
META_IS_USER_ACTION = 1 << 2,
META_IS_MOVE_ACTION = 1 << 3,
META_IS_RESIZE_ACTION = 1 << 4
META_IS_RESIZE_ACTION = 1 << 4,
META_FORCE_STATIC_GRAVITY = 1 << 5,
META_IS_INITIAL_RESIZE = 1 << 6
} MetaMoveResizeFlags;
void meta_window_constrain (MetaWindow *window,

View File

@ -1439,7 +1439,7 @@ meta_window_new (MetaDisplay *display,
* initial map is handled same as configure request
*/
flags =
META_IS_CONFIGURE_REQUEST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
META_IS_CONFIGURE_REQUEST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION | META_IS_INITIAL_RESIZE;
if (!window->override_redirect)
meta_window_move_resize_internal (window,
flags,
@ -5180,7 +5180,8 @@ meta_window_move_resize_internal (MetaWindow *window,
if (need_configure_notify)
send_configure_notify (window);
if (!window->placed && window->force_save_user_rect && !window->fullscreen)
if ((flags & META_IS_INITIAL_RESIZE) != 0 &&
window->force_save_user_rect && !window->fullscreen)
force_save_user_window_placement (window);
else if (is_user_action)
save_user_window_placement (window);