From ccca810daf08c0f7ef415afb6b6c7389f6553d35 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 5 Jul 2015 19:18:22 -0700 Subject: [PATCH] window-group: Improve performance by hacking around Clutter The comment explains it better, but Clutter tries to be smart and repaint actors when their allocations change. Since the window group's allocation changes when windows move around, this means that moving a window will always cause a full-stage repaint, which is super slow. Hack around this for now. --- src/compositor/meta-window-group.c | 34 +++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c index cb4ade4a1..3a024b21c 100644 --- a/src/compositor/meta-window-group.c +++ b/src/compositor/meta-window-group.c @@ -145,13 +145,45 @@ meta_window_group_get_paint_volume (ClutterActor *self, return TRUE; } +/* This is a workaround for Clutter's awful allocation tracking. + * Without this, any time the window group changed size, which is + * any time windows are dragged around, we'll do a full repaint + * of the window group, which includes the background actor, meaning + * a full-stage repaint. + * + * Since actors are allowed to paint outside their allocation, and + * since child actors are allowed to be outside their parents, this + * doesn't affect anything, but it means that we'll get much more + * sane and consistent clipped repaints from Clutter. */ +static void +meta_window_group_get_preferred_width (ClutterActor *actor, + gfloat for_height, + gfloat *min_width, + gfloat *nat_width) +{ + *min_width = 0; + *nat_width = 0; +} + +static void +meta_window_group_get_preferred_height (ClutterActor *actor, + gfloat for_width, + gfloat *min_height, + gfloat *nat_height) +{ + *min_height = 0; + *nat_height = 0; +} + static void meta_window_group_class_init (MetaWindowGroupClass *klass) { ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - actor_class->paint = meta_window_group_paint; + if (0) actor_class->paint = meta_window_group_paint; actor_class->get_paint_volume = meta_window_group_get_paint_volume; + actor_class->get_preferred_width = meta_window_group_get_preferred_width; + actor_class->get_preferred_height = meta_window_group_get_preferred_height; } static void