[mutter] window: Save the buffer_rect internally
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window: Save the buffer_rect internally
- Date: Tue, 17 Jun 2014 15:17:10 +0000 (UTC)
commit b0b8f37240f2a160bc6ad9d17b1fb5416455ca16
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 17 11:03:29 2014 -0400
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.
src/core/window-private.h | 9 +++++++++
src/core/window.c | 19 +------------------
src/wayland/window-wayland.c | 2 ++
src/x11/window-x11.c | 7 +++++++
4 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 267f163..c0f7121 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 e1598b6..59efbba 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 7ee6f07..e78a356 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 ca91dab..5422b54 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]