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.
This commit is contained in:
parent
188e4e1b92
commit
b0b8f37240
@ -421,6 +421,15 @@ struct _MetaWindow
|
|||||||
*/
|
*/
|
||||||
MetaRectangle unconstrained_rect;
|
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 */
|
/* Cached net_wm_icon_geometry */
|
||||||
MetaRectangle icon_geometry;
|
MetaRectangle icon_geometry;
|
||||||
|
|
||||||
|
@ -4052,24 +4052,7 @@ void
|
|||||||
meta_window_get_buffer_rect (const MetaWindow *window,
|
meta_window_get_buffer_rect (const MetaWindow *window,
|
||||||
MetaRectangle *rect)
|
MetaRectangle *rect)
|
||||||
{
|
{
|
||||||
if (window->frame)
|
*rect = window->buffer_rect;
|
||||||
*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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -361,6 +361,8 @@ meta_window_wayland_move_resize (MetaWindow *window,
|
|||||||
rect.width = width;
|
rect.width = width;
|
||||||
rect.height = height;
|
rect.height = height;
|
||||||
|
|
||||||
|
window->buffer_rect = rect;
|
||||||
|
|
||||||
if (rect.width != window->rect.width || rect.height != window->rect.height)
|
if (rect.width != window->rect.width || rect.height != window->rect.height)
|
||||||
flags |= META_IS_RESIZE_ACTION;
|
flags |= META_IS_RESIZE_ACTION;
|
||||||
|
|
||||||
|
@ -550,6 +550,7 @@ meta_window_x11_manage (MetaWindow *window)
|
|||||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||||
|
|
||||||
priv->client_rect = window->rect;
|
priv->client_rect = window->rect;
|
||||||
|
window->buffer_rect = window->rect;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1257,6 +1258,11 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||||||
gravity,
|
gravity,
|
||||||
need_move_frame, need_resize_frame);
|
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)
|
if (need_configure_notify)
|
||||||
send_configure_notify (window);
|
send_configure_notify (window);
|
||||||
|
|
||||||
@ -3265,6 +3271,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
|
|||||||
window->rect.height = event->height;
|
window->rect.height = event->height;
|
||||||
|
|
||||||
priv->client_rect = window->rect;
|
priv->client_rect = window->rect;
|
||||||
|
window->buffer_rect = window->rect;
|
||||||
|
|
||||||
meta_window_update_monitor (window);
|
meta_window_update_monitor (window);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user