From e44f0f15e945a2132912d9763cfa3e9e326e0aea Mon Sep 17 00:00:00 2001
From: "Owen W. Taylor" <otaylor@fishsoup.net>
Date: Tue, 8 Jul 2014 21:08:31 -0400
Subject: [PATCH 3/4] 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 5fa1e4e..1a59724 100644
--- a/src/core/constraints.h
+++ b/src/core/constraints.h
@@ -35,7 +35,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 60347ef..8d221e3 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1430,7 +1430,7 @@ meta_window_new_with_attrs (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,
@@ -5316,7 +5316,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->placed) &&
+ window->force_save_user_rect && !window->fullscreen)
force_save_user_window_placement (window);
else if (is_user_action)
save_user_window_placement (window);
--
1.9.3