summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-06-17 11:03:29 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2014-06-17 11:15:32 -0400
commitb0b8f37240f2a160bc6ad9d17b1fb5416455ca16 (patch)
tree1294f1051684f962eef02a9ac7110ba1d84b0171
parent188e4e1b92ebee4eb95f4c522f42999e996e4cd6 (diff)
downloadmutter-b0b8f37240f2a160bc6ad9d17b1fb5416455ca16.tar.gz
window: Save the buffer_rect internally
Rather than calculate it speculatively with the current properties which may be too new or too out of date, make sure it always fits with the proper definition. We update it when we update the toplevel window for X11, and when a Wayland surface is committed with a newly attached buffer.
-rw-r--r--src/core/window-private.h9
-rw-r--r--src/core/window.c19
-rw-r--r--src/wayland/window-wayland.c2
-rw-r--r--src/x11/window-x11.c7
4 files changed, 19 insertions, 18 deletions
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 267f163e8..c0f71212a 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -421,6 +421,15 @@ struct _MetaWindow
*/
MetaRectangle unconstrained_rect;
+ /* The rectangle of the "server-side" geometry of the buffer,
+ * in root coordinates.
+ *
+ * For X11 windows, this matches XGetGeometry of the toplevel.
+ *
+ * For Wayland windows, this matches the buffer size and where
+ * the surface actor is positioned. */
+ MetaRectangle buffer_rect;
+
/* Cached net_wm_icon_geometry */
MetaRectangle icon_geometry;
diff --git a/src/core/window.c b/src/core/window.c
index e1598b612..59efbba6d 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4052,24 +4052,7 @@ void
meta_window_get_buffer_rect (const MetaWindow *window,
MetaRectangle *rect)
{
- if (window->frame)
- *rect = window->frame->rect;
- else if (window->xwindow != None)
- {
- XWindowAttributes xwa;
-
- XGetWindowAttributes (window->display->xdisplay, window->xwindow, &xwa);
-
- rect->x = xwa.x;
- rect->y = xwa.y;
- rect->width = xwa.width;
- rect->height = xwa.height;
- }
- else
- {
- *rect = window->rect;
- meta_window_frame_rect_to_client_rect ((MetaWindow *) window, rect, rect);
- }
+ *rect = window->buffer_rect;
}
/**
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 7ee6f07d3..e78a35682 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -361,6 +361,8 @@ meta_window_wayland_move_resize (MetaWindow *window,
rect.width = width;
rect.height = height;
+ window->buffer_rect = rect;
+
if (rect.width != window->rect.width || rect.height != window->rect.height)
flags |= META_IS_RESIZE_ACTION;
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index ca91dab24..5422b542a 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -550,6 +550,7 @@ meta_window_x11_manage (MetaWindow *window)
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
priv->client_rect = window->rect;
+ window->buffer_rect = window->rect;
}
else
{
@@ -1257,6 +1258,11 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
gravity,
need_move_frame, need_resize_frame);
+ if (window->frame)
+ window->buffer_rect = window->frame->rect;
+ else
+ window->buffer_rect = client_rect;
+
if (need_configure_notify)
send_configure_notify (window);
@@ -3265,6 +3271,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
window->rect.height = event->height;
priv->client_rect = window->rect;
+ window->buffer_rect = window->rect;
meta_window_update_monitor (window);