wayland-surface: Rework flow control for wl_surface_commit
This commit is contained in:
parent
4780f74a40
commit
0ccef81789
@ -262,46 +262,38 @@ ensure_buffer_texture (MetaWaylandBuffer *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_surface_commit (struct wl_client *client,
|
cursor_surface_commit (MetaWaylandSurface *surface)
|
||||||
struct wl_resource *resource)
|
|
||||||
{
|
{
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
|
||||||
MetaWaylandCompositor *compositor;
|
|
||||||
|
|
||||||
/* X11 unmanaged window */
|
|
||||||
if (!surface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
compositor = surface->compositor;
|
|
||||||
|
|
||||||
/* wl_surface.attach */
|
|
||||||
if (surface->pending.newly_attached &&
|
|
||||||
surface->buffer_ref.buffer != surface->pending.buffer)
|
|
||||||
{
|
|
||||||
MetaWaylandBuffer *buffer = surface->pending.buffer;
|
MetaWaylandBuffer *buffer = surface->pending.buffer;
|
||||||
|
|
||||||
/* Note: we set this before informing any window-actor since the
|
if (surface->pending.newly_attached && buffer != surface->buffer_ref.buffer)
|
||||||
* window actor will expect to find the new buffer within the
|
{
|
||||||
* surface. */
|
|
||||||
ensure_buffer_texture (buffer);
|
ensure_buffer_texture (buffer);
|
||||||
meta_wayland_buffer_reference (&surface->buffer_ref, buffer);
|
meta_wayland_buffer_reference (&surface->buffer_ref, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface == compositor->seat->sprite)
|
meta_wayland_seat_update_sprite (surface->compositor->seat);
|
||||||
meta_wayland_seat_update_sprite (compositor->seat);
|
}
|
||||||
else if (surface->window)
|
|
||||||
{
|
static void
|
||||||
|
toplevel_surface_commit (MetaWaylandSurface *surface)
|
||||||
|
{
|
||||||
MetaWindow *window = surface->window;
|
MetaWindow *window = surface->window;
|
||||||
|
|
||||||
meta_window_set_surface_mapped (window, surface->pending.buffer != NULL);
|
|
||||||
|
|
||||||
if (surface->pending.buffer)
|
|
||||||
{
|
|
||||||
MetaWaylandBuffer *buffer = surface->pending.buffer;
|
MetaWaylandBuffer *buffer = surface->pending.buffer;
|
||||||
|
|
||||||
|
/* wl_surface.attach */
|
||||||
|
if (surface->pending.newly_attached && buffer != surface->buffer_ref.buffer)
|
||||||
|
{
|
||||||
|
ensure_buffer_texture (buffer);
|
||||||
|
meta_wayland_buffer_reference (&surface->buffer_ref, buffer);
|
||||||
|
|
||||||
|
meta_window_set_surface_mapped (window, buffer != NULL);
|
||||||
|
|
||||||
|
if (buffer != NULL)
|
||||||
|
{
|
||||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||||
|
|
||||||
meta_window_actor_attach_wayland_buffer (window_actor, buffer);
|
meta_window_actor_attach_wayland_buffer (window_actor, buffer);
|
||||||
}
|
|
||||||
|
|
||||||
/* We resize X based surfaces according to X events */
|
/* We resize X based surfaces according to X events */
|
||||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
|
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
|
||||||
@ -315,17 +307,37 @@ meta_wayland_surface_commit (struct wl_client *client,
|
|||||||
new_height != window->rect.height ||
|
new_height != window->rect.height ||
|
||||||
surface->pending.dx != 0 ||
|
surface->pending.dx != 0 ||
|
||||||
surface->pending.dy != 0)
|
surface->pending.dy != 0)
|
||||||
meta_window_move_resize_wayland (surface->window, new_width, new_height,
|
meta_window_move_resize_wayland (window, new_width, new_height,
|
||||||
surface->pending.dx, surface->pending.dy);
|
surface->pending.dx, surface->pending.dy);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (surface->pending.opaque_region)
|
}
|
||||||
meta_window_set_opaque_region (surface->window, surface->pending.opaque_region);
|
|
||||||
if (surface->pending.input_region)
|
|
||||||
meta_window_set_input_region (surface->window, surface->pending.input_region);
|
|
||||||
|
|
||||||
surface_process_damage (surface, surface->pending.damage);
|
surface_process_damage (surface, surface->pending.damage);
|
||||||
}
|
|
||||||
|
if (surface->pending.opaque_region)
|
||||||
|
meta_window_set_opaque_region (window, surface->pending.opaque_region);
|
||||||
|
if (surface->pending.input_region)
|
||||||
|
meta_window_set_input_region (window, surface->pending.input_region);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_surface_commit (struct wl_client *client,
|
||||||
|
struct wl_resource *resource)
|
||||||
|
{
|
||||||
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
MetaWaylandCompositor *compositor;
|
||||||
|
|
||||||
|
/* X11 unmanaged window */
|
||||||
|
if (!surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
compositor = surface->compositor;
|
||||||
|
|
||||||
|
if (surface == compositor->seat->sprite)
|
||||||
|
cursor_surface_commit (surface);
|
||||||
|
else if (surface->window)
|
||||||
|
toplevel_surface_commit (surface);
|
||||||
|
|
||||||
if (surface->pending.buffer)
|
if (surface->pending.buffer)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user