mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland: Ensure that opaque / input regions are set at commit time
The protocol specification says that opaque / input regions should be considered pending state and should only be actually swapped out when the surface is committed, so it can be set atomically.
This commit is contained in:
parent
ad4053ab84
commit
b1206ceb66
@ -89,6 +89,9 @@ struct _MetaWaylandSurface
|
||||
/* wl_surface.damage */
|
||||
cairo_region_t *damage;
|
||||
|
||||
cairo_region_t *input_region;
|
||||
cairo_region_t *opaque_region;
|
||||
|
||||
/* wl_surface.frame */
|
||||
struct wl_list frame_callback_list;
|
||||
} pending;
|
||||
|
@ -335,8 +335,8 @@ meta_wayland_surface_set_opaque_region (struct wl_client *client,
|
||||
if (!surface)
|
||||
return;
|
||||
|
||||
if (surface->window)
|
||||
meta_window_set_opaque_region (surface->window, cairo_region_copy (region->region));
|
||||
g_clear_pointer (&surface->pending.opaque_region, cairo_region_destroy);
|
||||
surface->pending.opaque_region = cairo_region_copy (region->region);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -351,8 +351,8 @@ meta_wayland_surface_set_input_region (struct wl_client *client,
|
||||
if (!surface)
|
||||
return;
|
||||
|
||||
if (surface->window)
|
||||
meta_window_set_input_region (surface->window, cairo_region_copy (region->region));
|
||||
g_clear_pointer (&surface->pending.input_region, cairo_region_destroy);
|
||||
surface->pending.input_region = cairo_region_copy (region->region);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -420,6 +420,15 @@ meta_wayland_surface_commit (struct wl_client *client,
|
||||
surface->pending.sy = 0;
|
||||
surface->pending.newly_attached = FALSE;
|
||||
|
||||
if (surface->window)
|
||||
{
|
||||
meta_window_set_opaque_region (surface->window, surface->pending.opaque_region);
|
||||
g_clear_pointer (&surface->pending.opaque_region, cairo_region_destroy);
|
||||
|
||||
meta_window_set_input_region (surface->window, surface->pending.input_region);
|
||||
g_clear_pointer (&surface->pending.input_region, cairo_region_destroy);
|
||||
}
|
||||
|
||||
surface_process_damage (surface, surface->pending.damage);
|
||||
empty_region (surface->pending.damage);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user