This commit is contained in:
Jasper St. Pierre 2014-02-19 16:24:38 -05:00
parent 91384a32b4
commit ffe7b5e7d8
2 changed files with 20 additions and 63 deletions

View File

@ -408,12 +408,6 @@ struct _MetaWindow
*/ */
MetaRectangle rect; MetaRectangle rect;
/* The size and position we want the window to be (i.e. what we last asked
* the client to configure).
* This is only used for wayland clients.
*/
MetaRectangle expected_rect;
gboolean has_custom_frame_extents; gboolean has_custom_frame_extents;
GtkBorder custom_frame_extents; GtkBorder custom_frame_extents;

View File

@ -4596,63 +4596,28 @@ meta_window_move_resize_internal (MetaWindow *window,
root_x_nw = new_rect.x; root_x_nw = new_rect.x;
root_y_nw = new_rect.y; root_y_nw = new_rect.y;
/* First, save where we would like the client to be. This is used by the next
* attach to determine if the client is really moving/resizing or not.
*/
window->expected_rect = new_rect;
if (is_wayland_resize)
{
/* This is a call to wl_surface_commit(), ignore the new_rect and
* update the real client size to match the buffer size.
*/
window->rect.width = w;
window->rect.height = h;
}
if (new_rect.width != window->rect.width || if (new_rect.width != window->rect.width ||
new_rect.height != window->rect.height) new_rect.height != window->rect.height)
{ {
/* We need to resize the client. Resizing is in two parts: if (!is_wayland_resize)
* some of the movement happens immediately, and some happens as part meta_wayland_surface_configure_notify (window->surface,
* of the resizing (through dx/dy in wl_surface_attach). new_rect.width,
* new_rect.height);
* To do so, we need to compute the resize from the point of the view
* of the client, and then adjust the immediate resize to match.
*
* dx/dy are the values we expect from the new attach(), while deltax/
* deltay reflect the overall movement.
*/
MetaRectangle client_rect;
int dx, dy;
int deltax, deltay;
meta_rectangle_resize_with_gravity (&old_rect, meta_rectangle_resize_with_gravity (&old_rect,
&client_rect, &new_rect,
gravity, gravity,
new_rect.width, new_rect.width,
new_rect.height); new_rect.height);
deltax = new_rect.x - old_rect.x; if (window->rect.width != new_rect.width ||
deltay = new_rect.y - old_rect.y; window->rect.height != new_rect.height)
dx = client_rect.x - old_rect.x;
dy = client_rect.y - old_rect.y;
if (deltax != dx || deltay != dy)
need_move_client = TRUE;
window->rect.x += (deltax - dx);
window->rect.y += (deltay - dy);
need_resize_client = TRUE; need_resize_client = TRUE;
meta_wayland_surface_configure_notify (window->surface,
new_rect.width, window->rect.width = new_rect.width;
new_rect.height); window->rect.height = new_rect.height;
} }
else
{
/* No resize happening, we can just move the window and live with it. */
if (window->rect.x != new_rect.x || if (window->rect.x != new_rect.x ||
window->rect.y != new_rect.y) window->rect.y != new_rect.y)
need_move_client = TRUE; need_move_client = TRUE;
@ -4660,7 +4625,6 @@ meta_window_move_resize_internal (MetaWindow *window,
window->rect.x = new_rect.x; window->rect.x = new_rect.x;
window->rect.y = new_rect.y; window->rect.y = new_rect.y;
} }
}
else else
{ {
/* Everything else is the old X11 code, including weird gravities, /* Everything else is the old X11 code, including weird gravities,
@ -5071,13 +5035,12 @@ meta_window_move_resize_wayland (MetaWindow *window,
flags = META_IS_WAYLAND_RESIZE; flags = META_IS_WAYLAND_RESIZE;
meta_window_get_position (window, &x, &y); x = window->rect.x + dx;
x += dx; y += dy; y = window->rect.y + dy;
if (x != window->expected_rect.x || y != window->expected_rect.y) if (dx != 0 || dy != 0)
flags |= META_IS_MOVE_ACTION; flags |= META_IS_MOVE_ACTION;
if (width != window->expected_rect.width || if (width != window->rect.width || height != window->rect.height)
height != window->expected_rect.height)
flags |= META_IS_RESIZE_ACTION; flags |= META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window, flags, NorthWestGravity, meta_window_move_resize_internal (window, flags, NorthWestGravity,