From 8e5bb177508ff167018462eb8cc6996816690706 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 8 Jul 2014 21:08:31 -0400 Subject: [PATCH] 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. --- src/core/constraints.h | 4 +++- src/core/window.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/constraints.h b/src/core/constraints.h index e5d29ca55..e421e5f10 100644 --- a/src/core/constraints.h +++ b/src/core/constraints.h @@ -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, diff --git a/src/core/window.c b/src/core/window.c index e3a5b4e2f..af52a3a9d 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -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);