summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Majerech <majerech.o@gmail.com>2014-09-13 16:35:45 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-15 11:22:05 +0300
commitb2c18647775732da740946eb199b1f2b46ba950b (patch)
treecb35eccd871d31fcb6c024ca870753a1450a719b
parentf1d2cc0d149cb84006dc26fddd0142b7180f7c34 (diff)
downloadweston-b2c18647775732da740946eb199b1f2b46ba950b.tar.gz
window: Don't needlessly sync parent and geometry
When a toytoolkit client redraws, the toolkit syncs the parent and geometry. If a client redraws often (such as the terminal drawing a huge amount of output), this can spam the compositor with requests and may result in the client's eventual being killed. We don't need to send requests for changing the geometry or parent if these haven't changed. So remember the last geometry and parent, and update them only if needed. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83297 Signed-off-by: Ondřej Majerech <majerech.o@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--clients/window.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clients/window.c b/clients/window.c
index 9c48155d..e44d65c9 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -217,6 +217,7 @@ struct window {
struct rectangle saved_allocation;
struct rectangle min_allocation;
struct rectangle pending_allocation;
+ struct rectangle last_geometry;
int x, y;
int redraw_needed;
int redraw_task_scheduled;
@@ -246,6 +247,7 @@ struct window {
struct xdg_popup *xdg_popup;
struct window *parent;
+ struct wl_surface *last_parent_surface;
struct window_frame *frame;
@@ -3993,7 +3995,11 @@ window_sync_parent(struct window *window)
else
parent_surface = NULL;
+ if (parent_surface == window->last_parent_surface)
+ return;
+
xdg_surface_set_parent(window->xdg_surface, parent_surface);
+ window->last_parent_surface = parent_surface;
}
static void
@@ -4018,12 +4024,18 @@ window_sync_geometry(struct window *window)
return;
window_get_geometry(window, &geometry);
+ if (geometry.x == window->last_geometry.x &&
+ geometry.y == window->last_geometry.y &&
+ geometry.width == window->last_geometry.width &&
+ geometry.height == window->last_geometry.height)
+ return;
xdg_surface_set_window_geometry(window->xdg_surface,
geometry.x,
geometry.y,
geometry.width,
geometry.height);
+ window->last_geometry = geometry;
}
static void