summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-04-28 16:07:49 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2014-04-28 16:11:10 -0400
commite6b0525c709def2e9de792bb09c6c42391777468 (patch)
treeae011ff2c1b963fce5948d8890cb2a33b9fbd3f0
parent23ae11043f298fc8489c5f1436ff613b39c61072 (diff)
downloadmutter-e6b0525c709def2e9de792bb09c6c42391777468.tar.gz
window-wayland: Make sure to save where the position for server-initiated resizes
For the server-initiated resize case, like unmaximize or some forms of tiling, we dropped the x/y of the server-assigned rectangle on the floor, which meant the surface didn't move to where it needed to be in that case. Now, save it internally, and combine it with the dx/dy passed in during attaches to figure out where we actually need to be. This fixes incorrect surface placement after unmaximization.
-rw-r--r--src/wayland/window-wayland.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 8e13cc2bd..1cbf0e92e 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -34,6 +34,9 @@
struct _MetaWindowWayland
{
MetaWindow parent;
+
+ int saved_x;
+ int saved_y;
};
struct _MetaWindowWaylandClass
@@ -119,8 +122,10 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags,
MetaMoveResizeResultFlags *result)
{
+ MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
gboolean should_move = FALSE;
gboolean is_wayland_resize = FALSE;
+ int new_x, new_y;
g_assert (window->frame == NULL);
@@ -138,6 +143,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
if (is_wayland_resize)
{
+ int dx, dy;
+
/* This is a call to wl_surface_commit(), ignore the constrained_rect and
* update the real client size to match the buffer size.
*/
@@ -149,11 +156,21 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
/* This is a commit of an attach. We should move the window to match the
* new position the client wants. */
should_move = TRUE;
+
+ /* The dx/dy that the client asked for. */
+ dx = requested_rect.x - window->rect.x;
+ dy = requested_rect.y - window->rect.y;
+
+ new_x = wl_window->saved_x + dx;
+ new_y = wl_window->saved_y + dy;
}
if (constrained_rect.width != window->rect.width ||
constrained_rect.height != window->rect.height)
{
+ wl_window->saved_x = constrained_rect.x;
+ wl_window->saved_y = constrained_rect.y;
+
meta_wayland_surface_configure_notify (window->surface,
constrained_rect.width,
constrained_rect.height);
@@ -163,13 +180,13 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
/* We're just moving the window, so we don't need to wait for a configure
* and then ack to simply move the window. */
should_move = TRUE;
+
+ new_x = constrained_rect.x;
+ new_y = constrained_rect.y;
}
if (should_move)
{
- int new_x = constrained_rect.x;
- int new_y = constrained_rect.y;
-
if (new_x != window->rect.x || new_y != window->rect.y)
{
*result |= META_MOVE_RESIZE_RESULT_MOVED;