mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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
This commit is contained in:
parent
6206511846
commit
f5a28aa9e4
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user