Blame SOURCES/0003-Fix-windows-walking-up-the-screen-on-restart.patch

68333f
From e44f0f15e945a2132912d9763cfa3e9e326e0aea Mon Sep 17 00:00:00 2001
68333f
From: "Owen W. Taylor" <otaylor@fishsoup.net>
68333f
Date: Tue, 8 Jul 2014 21:08:31 -0400
68333f
Subject: [PATCH 3/4] Fix windows walking up the screen on restart
68333f
68333f
When a window is initially created, we need to save it's user rect
68333f
after any adjustments for gravity. Otherwise, the next time the window is
68333f
queued for a resize, it will jump back to it's initial position.
68333f
68333f
We did that for newly created windows, but on restart, when windows
68333f
were already placed, the logic skipped saving the position. Use an
68333f
explicit flag so that we always save the position for newly created
68333f
MetaWindows.
68333f
---
68333f
 src/core/constraints.h | 4 +++-
68333f
 src/core/window.c      | 5 +++--
68333f
 2 files changed, 6 insertions(+), 3 deletions(-)
68333f
68333f
diff --git a/src/core/constraints.h b/src/core/constraints.h
68333f
index 5fa1e4e..1a59724 100644
68333f
--- a/src/core/constraints.h
68333f
+++ b/src/core/constraints.h
68333f
@@ -35,7 +35,9 @@ typedef enum
68333f
   META_DO_GRAVITY_ADJUST    = 1 << 1,
68333f
   META_IS_USER_ACTION       = 1 << 2,
68333f
   META_IS_MOVE_ACTION       = 1 << 3,
68333f
-  META_IS_RESIZE_ACTION     = 1 << 4
68333f
+  META_IS_RESIZE_ACTION     = 1 << 4,
68333f
+  META_FORCE_STATIC_GRAVITY = 1 << 5,
68333f
+  META_IS_INITIAL_RESIZE    = 1 << 6
68333f
 } MetaMoveResizeFlags;
68333f
 
68333f
 void meta_window_constrain (MetaWindow          *window,
68333f
diff --git a/src/core/window.c b/src/core/window.c
68333f
index 60347ef..8d221e3 100644
68333f
--- a/src/core/window.c
68333f
+++ b/src/core/window.c
68333f
@@ -1430,7 +1430,7 @@ meta_window_new_with_attrs (MetaDisplay       *display,
68333f
    * initial map is handled same as configure request
68333f
    */
68333f
   flags =
68333f
-    META_IS_CONFIGURE_REQUEST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
68333f
+    META_IS_CONFIGURE_REQUEST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION | META_IS_INITIAL_RESIZE;
68333f
   if (!window->override_redirect)
68333f
     meta_window_move_resize_internal (window,
68333f
                                       flags,
68333f
@@ -5316,7 +5316,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
68333f
   if (need_configure_notify)
68333f
     send_configure_notify (window);
68333f
 
68333f
-  if (!window->placed && window->force_save_user_rect && !window->fullscreen)
68333f
+  if (((flags & META_IS_INITIAL_RESIZE) != 0 || !window->placed) &&
68333f
+      window->force_save_user_rect && !window->fullscreen)
68333f
     force_save_user_window_placement (window);
68333f
   else if (is_user_action)
68333f
     save_user_window_placement (window);
68333f
-- 
68333f
1.9.3
68333f