[mutter] window-actor: Make culling of opaque windows X11 only
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-actor: Make culling of opaque windows X11 only
- Date: Thu, 20 Feb 2020 16:18:29 +0000 (UTC)
commit f5a28aa9e4d3f288d1139429cda7ff83376fae46
Author: Robert Mader <robert mader posteo de>
Date: Sun Feb 16 19:40:48 2020 +0100
window-actor: Make culling of opaque windows X11 only
It is only useful for clients that do not set an opaque region but
still can be detected as being opaque. This is helpful for X11 clients
as opaque regions only got introduced around 2012 and only as part of EWMH
and are thus not used in many cases.
On Wayland however opaque regions have been part of the core protocol from the
beginnig and we can assume they are used more commonly.
As the current implementation in `MetaWindowActor` does not handle Wayland
subsurfaces well, instead of adding more complexity just move it to
`MetaWindowActorX11`.
While on it, take the shape region into account that is set when clients
use the X Nonrectangular Window Shape Extension Protocol, so we have exact
culling with those clients.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1058
src/compositor/meta-window-actor-x11.c | 43 +++++++++++++++++++++++++++++++++-
src/compositor/meta-window-actor.c | 29 -----------------------
2 files changed, 42 insertions(+), 30 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index 1bef22530..15cfa5fcf 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -1447,9 +1447,50 @@ meta_window_actor_x11_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
cairo_region_t *clip_region)
{
+ MetaWindowActorX11 *self = META_WINDOW_ACTOR_X11 (cullable);
+
cullable_parent_iface->cull_out (cullable, unobscured_region, clip_region);
- set_clip_region_beneath (META_WINDOW_ACTOR_X11 (cullable), clip_region);
+ if ((unobscured_region || clip_region) &&
+ meta_window_actor_is_opaque (META_WINDOW_ACTOR (self)))
+ {
+ MetaWindow *window =
+ meta_window_actor_get_meta_window (META_WINDOW_ACTOR (self));
+
+ if (window->shape_region)
+ {
+ if (unobscured_region)
+ cairo_region_subtract (unobscured_region, window->shape_region);
+ if (clip_region)
+ cairo_region_subtract (clip_region, window->shape_region);
+ }
+ else
+ {
+ cairo_region_t *region = meta_window_get_frame_bounds (window);
+
+ if (region)
+ {
+ if (unobscured_region)
+ cairo_region_subtract (unobscured_region, region);
+ if (clip_region)
+ cairo_region_subtract (clip_region, region);
+ }
+ else
+ {
+ cairo_rectangle_int_t rect;
+
+ meta_window_get_frame_rect (window, &rect);
+ rect.x = rect.y = 0;
+
+ if (unobscured_region)
+ cairo_region_subtract_rectangle (unobscured_region, &rect);
+ if (clip_region)
+ cairo_region_subtract_rectangle (clip_region, &rect);
+ }
+ }
+ }
+
+ set_clip_region_beneath (self, clip_region);
}
static void
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 1e38badd6..c4781d3b2 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -966,36 +966,7 @@ meta_window_actor_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
cairo_region_t *clip_region)
{
- MetaWindowActor *self = META_WINDOW_ACTOR (cullable);
- MetaWindowActorPrivate *priv =
- meta_window_actor_get_instance_private (self);
-
meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
-
- if ((unobscured_region || clip_region) && meta_window_actor_is_opaque (self))
- {
- cairo_region_t *region = meta_window_get_frame_bounds (priv->window);
-
- if (region)
- {
- if (unobscured_region)
- cairo_region_subtract (unobscured_region, region);
- if (clip_region)
- cairo_region_subtract (clip_region, region);
- }
- else
- {
- cairo_rectangle_int_t rect;
-
- meta_window_get_frame_rect (priv->window, &rect);
- rect.x = rect.y = 0;
-
- if (unobscured_region)
- cairo_region_subtract_rectangle (unobscured_region, &rect);
- if (clip_region)
- cairo_region_subtract_rectangle (clip_region, &rect);
- }
- }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]