From bbec8abb68577eae6fb05cb0a46d6ba29cea3979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 13 Mar 2019 13:27:25 +0100 Subject: [PATCH] wayland/surface: Rename MetaWaylandPendingState to MetaWaylandSurfaceState The name didn't communicate it was about surface state, and it somewhat confusingly had the name "pending" in it, which could be confused with the fact that while it's used to collect pending state, it's also used to cache previously committed pending state. https://gitlab.gnome.org/GNOME/mutter/merge_requests/907 --- src/wayland/meta-wayland-actor-surface.c | 4 +- src/wayland/meta-wayland-actor-surface.h | 2 +- src/wayland/meta-wayland-cursor-surface.c | 4 +- src/wayland/meta-wayland-dnd-surface.c | 2 +- src/wayland/meta-wayland-legacy-xdg-shell.c | 14 +- .../meta-wayland-pointer-constraints.c | 12 +- src/wayland/meta-wayland-shell-surface.c | 2 +- src/wayland/meta-wayland-subsurface.c | 6 +- src/wayland/meta-wayland-surface.c | 176 +++++++++--------- src/wayland/meta-wayland-surface.h | 32 ++-- src/wayland/meta-wayland-viewporter.c | 6 +- src/wayland/meta-wayland-wl-shell.c | 2 +- src/wayland/meta-wayland-xdg-shell.c | 14 +- 13 files changed, 137 insertions(+), 139 deletions(-) diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c index bf93f9564..f4fe0f548 100644 --- a/src/wayland/meta-wayland-actor-surface.c +++ b/src/wayland/meta-wayland-actor-surface.c @@ -109,7 +109,7 @@ meta_wayland_actor_surface_assigned (MetaWaylandSurfaceRole *surface_role) void meta_wayland_actor_surface_queue_frame_callbacks (MetaWaylandActorSurface *actor_surface, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandActorSurfacePrivate *priv = meta_wayland_actor_surface_get_instance_private (actor_surface); @@ -240,7 +240,7 @@ meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor_surf static void meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandActorSurface *actor_surface = META_WAYLAND_ACTOR_SURFACE (surface_role); diff --git a/src/wayland/meta-wayland-actor-surface.h b/src/wayland/meta-wayland-actor-surface.h index 255141f43..dc315ce02 100644 --- a/src/wayland/meta-wayland-actor-surface.h +++ b/src/wayland/meta-wayland-actor-surface.h @@ -43,6 +43,6 @@ MetaSurfaceActor * meta_wayland_actor_surface_get_actor (MetaWaylandActorSurface void meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface); void meta_wayland_actor_surface_queue_frame_callbacks (MetaWaylandActorSurface *actor_surface, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); #endif /* META_WAYLAND_ACTOR_SURFACE_H */ diff --git a/src/wayland/meta-wayland-cursor-surface.c b/src/wayland/meta-wayland-cursor-surface.c index 87cb10fb0..1d61d20bc 100644 --- a/src/wayland/meta-wayland-cursor-surface.c +++ b/src/wayland/meta-wayland-cursor-surface.c @@ -130,7 +130,7 @@ meta_wayland_cursor_surface_assigned (MetaWaylandSurfaceRole *surface_role) static void meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandCursorSurface *cursor_surface = META_WAYLAND_CURSOR_SURFACE (surface_role); @@ -148,7 +148,7 @@ meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role, static void meta_wayland_cursor_surface_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandCursorSurface *cursor_surface = META_WAYLAND_CURSOR_SURFACE (surface_role); diff --git a/src/wayland/meta-wayland-dnd-surface.c b/src/wayland/meta-wayland-dnd-surface.c index bcb5317a2..9169cf625 100644 --- a/src/wayland/meta-wayland-dnd-surface.c +++ b/src/wayland/meta-wayland-dnd-surface.c @@ -47,7 +47,7 @@ dnd_surface_assigned (MetaWaylandSurfaceRole *surface_role) static void dnd_surface_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (surface_role); diff --git a/src/wayland/meta-wayland-legacy-xdg-shell.c b/src/wayland/meta-wayland-legacy-xdg-shell.c index d26c1b348..81a71bba0 100644 --- a/src/wayland/meta-wayland-legacy-xdg-shell.c +++ b/src/wayland/meta-wayland-legacy-xdg-shell.c @@ -340,7 +340,7 @@ zxdg_toplevel_v6_set_max_size (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource); - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; MetaWindow *window; window = surface->window; @@ -369,7 +369,7 @@ zxdg_toplevel_v6_set_min_size (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource); - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; MetaWindow *window; window = surface->window; @@ -623,7 +623,7 @@ meta_wayland_zxdg_toplevel_v6_send_configure (MetaWaylandZxdgToplevelV6 *xdg_top static gboolean is_new_size_hints_valid (MetaWindow *window, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { int new_min_width, new_min_height; int new_max_width, new_max_height; @@ -654,7 +654,7 @@ is_new_size_hints_valid (MetaWindow *window, static void meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandZxdgToplevelV6 *xdg_toplevel = META_WAYLAND_ZXDG_TOPLEVEL_V6 (surface_role); @@ -971,7 +971,7 @@ finish_popup_setup (MetaWaylandZxdgPopupV6 *xdg_popup) static void meta_wayland_zxdg_popup_v6_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandZxdgPopupV6 *xdg_popup = META_WAYLAND_ZXDG_POPUP_V6 (surface_role); MetaWaylandZxdgSurfaceV6 *xdg_surface = @@ -1292,7 +1292,7 @@ zxdg_surface_v6_set_window_geometry (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; pending = meta_wayland_surface_get_pending_state (surface); pending->has_new_geometry = TRUE; @@ -1337,7 +1337,7 @@ meta_wayland_zxdg_surface_v6_finalize (GObject *object) static void meta_wayland_zxdg_surface_v6_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandZxdgSurfaceV6 *xdg_surface = META_WAYLAND_ZXDG_SURFACE_V6 (surface_role); diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c index a6f07761e..d0cc92d31 100644 --- a/src/wayland/meta-wayland-pointer-constraints.c +++ b/src/wayland/meta-wayland-pointer-constraints.c @@ -661,7 +661,7 @@ pending_constraint_state_free (MetaWaylandPendingConstraintState *constraint_pen } static MetaWaylandPendingConstraintStateContainer * -get_pending_constraint_state_container (MetaWaylandPendingState *pending) +get_pending_constraint_state_container (MetaWaylandSurfaceState *pending) { return g_object_get_qdata (G_OBJECT (pending), quark_pending_constraint_state); @@ -670,7 +670,7 @@ get_pending_constraint_state_container (MetaWaylandPendingState *pending) static MetaWaylandPendingConstraintState * get_pending_constraint_state (MetaWaylandPointerConstraint *constraint) { - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; MetaWaylandPendingConstraintStateContainer *container; GList *l; @@ -696,7 +696,7 @@ pending_constraint_state_container_free (MetaWaylandPendingConstraintStateContai } static MetaWaylandPendingConstraintStateContainer * -ensure_pending_constraint_state_container (MetaWaylandPendingState *pending) +ensure_pending_constraint_state_container (MetaWaylandSurfaceState *pending) { MetaWaylandPendingConstraintStateContainer *container; @@ -716,7 +716,7 @@ ensure_pending_constraint_state_container (MetaWaylandPendingState *pending) static void remove_pending_constraint_state (MetaWaylandPointerConstraint *constraint, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandPendingConstraintStateContainer *container; GList *l; @@ -736,7 +736,7 @@ remove_pending_constraint_state (MetaWaylandPointerConstraint *constraint, } static void -pending_constraint_state_applied (MetaWaylandPendingState *pending, +pending_constraint_state_applied (MetaWaylandSurfaceState *pending, MetaWaylandPendingConstraintState *constraint_pending) { MetaWaylandPointerConstraint *constraint = constraint_pending->constraint; @@ -766,7 +766,7 @@ pending_constraint_state_applied (MetaWaylandPendingState *pending, static MetaWaylandPendingConstraintState * ensure_pending_constraint_state (MetaWaylandPointerConstraint *constraint) { - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; MetaWaylandPendingConstraintStateContainer *container; MetaWaylandPendingConstraintState *constraint_pending; diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c index 7a9a804b6..f0af47c50 100644 --- a/src/wayland/meta-wayland-shell-surface.c +++ b/src/wayland/meta-wayland-shell-surface.c @@ -149,7 +149,7 @@ meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface, static void meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandActorSurface *actor_surface = META_WAYLAND_ACTOR_SURFACE (surface_role); diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c index b8ef41fe1..a33c8ef89 100644 --- a/src/wayland/meta-wayland-subsurface.c +++ b/src/wayland/meta-wayland-subsurface.c @@ -189,7 +189,7 @@ meta_wayland_subsurface_parent_state_applied (MetaWaylandSubsurface *subsurface) } if (is_surface_effectively_synchronized (surface)) - meta_wayland_surface_apply_pending_state (surface, surface->sub.pending); + meta_wayland_surface_apply_state (surface, surface->sub.pending); meta_wayland_actor_surface_sync_actor_state (actor_surface); } @@ -485,7 +485,7 @@ wl_subsurface_set_desync (struct wl_client *client, if (was_effectively_synchronized && !is_surface_effectively_synchronized (surface)) - meta_wayland_surface_apply_pending_state (surface, surface->sub.pending); + meta_wayland_surface_apply_state (surface, surface->sub.pending); } static const struct wl_subsurface_interface meta_wayland_wl_subsurface_interface = { @@ -561,7 +561,7 @@ wl_subcompositor_get_subsurface (struct wl_client *client, surface, wl_subsurface_destructor); - surface->sub.pending = g_object_new (META_TYPE_WAYLAND_PENDING_STATE, NULL); + surface->sub.pending = g_object_new (META_TYPE_WAYLAND_SURFACE_STATE, NULL); surface->sub.synchronous = TRUE; surface->sub.parent = parent; surface->sub.parent_destroy_listener.notify = diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 7bc19a5c5..09d83a31d 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -59,9 +59,9 @@ enum { - PENDING_STATE_SIGNAL_APPLIED, + SURFACE_STATE_SIGNAL_APPLIED, - PENDING_STATE_SIGNAL_LAST_SIGNAL + SURFACE_STATE_SIGNAL_N_SIGNALS }; enum @@ -71,7 +71,7 @@ enum SURFACE_ROLE_PROP_SURFACE, }; -static guint pending_state_signals[PENDING_STATE_SIGNAL_LAST_SIGNAL]; +static guint surface_state_signals[SURFACE_STATE_SIGNAL_N_SIGNALS]; typedef struct _MetaWaylandSurfaceRolePrivate { @@ -84,9 +84,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaWaylandSurfaceRole, meta_wayland_surface_role, G_TYPE_OBJECT) -G_DEFINE_TYPE (MetaWaylandPendingState, - meta_wayland_pending_state, - G_TYPE_OBJECT); +G_DEFINE_TYPE (MetaWaylandSurfaceState, + meta_wayland_surface_state, + G_TYPE_OBJECT) enum { @@ -107,11 +107,11 @@ meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role); static void meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); static void meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); static gboolean meta_wayland_surface_role_is_on_logical_monitor (MetaWaylandSurfaceRole *surface_role, @@ -361,7 +361,7 @@ surface_process_damage (MetaWaylandSurface *surface, void meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface *surface, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { wl_list_insert_list (&surface->compositor->frame_callbacks, &pending->frame_callback_list); @@ -400,14 +400,14 @@ meta_wayland_surface_unref_buffer_use_count (MetaWaylandSurface *surface) static void pending_buffer_resource_destroyed (MetaWaylandBuffer *buffer, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { g_clear_signal_handler (&pending->buffer_destroy_handler_id, buffer); pending->buffer = NULL; } static void -pending_state_init (MetaWaylandPendingState *state) +meta_wayland_surface_state_set_default (MetaWaylandSurfaceState *state) { state->newly_attached = FALSE; state->buffer = NULL; @@ -435,7 +435,7 @@ pending_state_init (MetaWaylandPendingState *state) } static void -pending_state_destroy (MetaWaylandPendingState *state) +meta_wayland_surface_state_clear (MetaWaylandSurfaceState *state) { MetaWaylandFrameCallback *cb, *next; @@ -452,15 +452,15 @@ pending_state_destroy (MetaWaylandPendingState *state) } static void -pending_state_reset (MetaWaylandPendingState *state) +meta_wayland_surface_state_reset (MetaWaylandSurfaceState *state) { - pending_state_destroy (state); - pending_state_init (state); + meta_wayland_surface_state_clear (state); + meta_wayland_surface_state_set_default (state); } static void -merge_pending_state (MetaWaylandPendingState *from, - MetaWaylandPendingState *to) +meta_wayland_surface_state_merge_into (MetaWaylandSurfaceState *from, + MetaWaylandSurfaceState *to) { if (from->newly_attached) { @@ -558,33 +558,33 @@ merge_pending_state (MetaWaylandPendingState *from, to); } - pending_state_init (from); + meta_wayland_surface_state_set_default (from); } static void -meta_wayland_pending_state_finalize (GObject *object) +meta_wayland_surface_state_finalize (GObject *object) { - MetaWaylandPendingState *state = META_WAYLAND_PENDING_STATE (object); + MetaWaylandSurfaceState *state = META_WAYLAND_SURFACE_STATE (object); - pending_state_destroy (state); + meta_wayland_surface_state_clear (state); - G_OBJECT_CLASS (meta_wayland_pending_state_parent_class)->finalize (object); + G_OBJECT_CLASS (meta_wayland_surface_state_parent_class)->finalize (object); } static void -meta_wayland_pending_state_init (MetaWaylandPendingState *state) +meta_wayland_surface_state_init (MetaWaylandSurfaceState *state) { - pending_state_init (state); + meta_wayland_surface_state_set_default (state); } static void -meta_wayland_pending_state_class_init (MetaWaylandPendingStateClass *klass) +meta_wayland_surface_state_class_init (MetaWaylandSurfaceStateClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->finalize = meta_wayland_pending_state_finalize; + object_class->finalize = meta_wayland_surface_state_finalize; - pending_state_signals[PENDING_STATE_SIGNAL_APPLIED] = + surface_state_signals[SURFACE_STATE_SIGNAL_APPLIED] = g_signal_new ("applied", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -609,7 +609,7 @@ parent_surface_state_applied (GNode *subsurface_node, void meta_wayland_surface_cache_pending_frame_callbacks (MetaWaylandSurface *surface, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { wl_list_insert_list (&surface->pending_frame_callback_list, &pending->frame_callback_list); @@ -617,8 +617,8 @@ meta_wayland_surface_cache_pending_frame_callbacks (MetaWaylandSurface *sur } void -meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface, - MetaWaylandPendingState *pending) +meta_wayland_surface_apply_state (MetaWaylandSurface *surface, + MetaWaylandSurfaceState *state) { gboolean had_damage = FALSE; @@ -626,18 +626,18 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface, if (surface->role) { - meta_wayland_surface_role_pre_commit (surface->role, pending); + meta_wayland_surface_role_pre_commit (surface->role, state); } else { - if (pending->newly_attached && surface->unassigned.buffer) + if (state->newly_attached && surface->unassigned.buffer) { meta_wayland_surface_unref_buffer_use_count (surface); g_clear_object (&surface->unassigned.buffer); } } - if (pending->newly_attached) + if (state->newly_attached) { if (!surface->buffer_ref.buffer && surface->window) meta_window_queue (surface->window, META_QUEUE_CALC_SHOWING); @@ -650,17 +650,17 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface, if (surface->buffer_held) meta_wayland_surface_unref_buffer_use_count (surface); - g_set_object (&surface->buffer_ref.buffer, pending->buffer); + g_set_object (&surface->buffer_ref.buffer, state->buffer); - if (pending->buffer) + if (state->buffer) meta_wayland_surface_ref_buffer_use_count (surface); - if (pending->buffer) + if (state->buffer) { GError *error = NULL; gboolean changed_texture; - if (!meta_wayland_buffer_attach (pending->buffer, + if (!meta_wayland_buffer_attach (state->buffer, &surface->texture, &changed_texture, &error)) @@ -683,8 +683,8 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface, stex = meta_surface_actor_get_texture (meta_wayland_surface_get_actor (surface)); texture = surface->texture; - snippet = meta_wayland_buffer_create_snippet (pending->buffer); - is_y_inverted = meta_wayland_buffer_is_y_inverted (pending->buffer); + snippet = meta_wayland_buffer_create_snippet (state->buffer); + is_y_inverted = meta_wayland_buffer_is_y_inverted (state->buffer); meta_shaped_texture_set_texture (stex, texture); meta_shaped_texture_set_snippet (stex, snippet); @@ -702,74 +702,74 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface, * it until is replaced by a subsequent wl_surface.commit or when the * wl_surface is destroyed. */ - surface->buffer_held = (pending->buffer && - !wl_shm_buffer_get (pending->buffer->resource)); + surface->buffer_held = (state->buffer && + !wl_shm_buffer_get (state->buffer->resource)); } - if (pending->scale > 0) - surface->scale = pending->scale; + if (state->scale > 0) + surface->scale = state->scale; - if (pending->has_new_buffer_transform) - surface->buffer_transform = pending->buffer_transform; + if (state->has_new_buffer_transform) + surface->buffer_transform = state->buffer_transform; - if (pending->has_new_viewport_src_rect) + if (state->has_new_viewport_src_rect) { - surface->viewport.src_rect.origin.x = pending->viewport_src_rect.origin.x; - surface->viewport.src_rect.origin.y = pending->viewport_src_rect.origin.y; - surface->viewport.src_rect.size.width = pending->viewport_src_rect.size.width; - surface->viewport.src_rect.size.height = pending->viewport_src_rect.size.height; + surface->viewport.src_rect.origin.x = state->viewport_src_rect.origin.x; + surface->viewport.src_rect.origin.y = state->viewport_src_rect.origin.y; + surface->viewport.src_rect.size.width = state->viewport_src_rect.size.width; + surface->viewport.src_rect.size.height = state->viewport_src_rect.size.height; surface->viewport.has_src_rect = surface->viewport.src_rect.size.width > 0; } - if (pending->has_new_viewport_dst_size) + if (state->has_new_viewport_dst_size) { - surface->viewport.dst_width = pending->viewport_dst_width; - surface->viewport.dst_height = pending->viewport_dst_height; + surface->viewport.dst_width = state->viewport_dst_width; + surface->viewport.dst_height = state->viewport_dst_height; surface->viewport.has_dst_size = surface->viewport.dst_width > 0; } - if (!cairo_region_is_empty (pending->surface_damage) || - !cairo_region_is_empty (pending->buffer_damage)) + if (!cairo_region_is_empty (state->surface_damage) || + !cairo_region_is_empty (state->buffer_damage)) { surface_process_damage (surface, - pending->surface_damage, - pending->buffer_damage); + state->surface_damage, + state->buffer_damage); had_damage = TRUE; } - surface->offset_x += pending->dx; - surface->offset_y += pending->dy; + surface->offset_x += state->dx; + surface->offset_y += state->dy; - if (pending->opaque_region_set) + if (state->opaque_region_set) { if (surface->opaque_region) cairo_region_destroy (surface->opaque_region); - if (pending->opaque_region) - surface->opaque_region = cairo_region_reference (pending->opaque_region); + if (state->opaque_region) + surface->opaque_region = cairo_region_reference (state->opaque_region); else surface->opaque_region = NULL; } - if (pending->input_region_set) + if (state->input_region_set) { if (surface->input_region) cairo_region_destroy (surface->input_region); - if (pending->input_region) - surface->input_region = cairo_region_reference (pending->input_region); + if (state->input_region) + surface->input_region = cairo_region_reference (state->input_region); else surface->input_region = NULL; } if (surface->role) { - meta_wayland_surface_role_commit (surface->role, pending); - g_assert (wl_list_empty (&pending->frame_callback_list)); + meta_wayland_surface_role_commit (surface->role, state); + g_assert (wl_list_empty (&state->frame_callback_list)); } else { - meta_wayland_surface_cache_pending_frame_callbacks (surface, pending); + meta_wayland_surface_cache_pending_frame_callbacks (surface, state); - if (pending->newly_attached) + if (state->newly_attached) { /* The need to keep the wl_buffer from being released depends on what * role the surface is given. That means we need to also keep a use @@ -785,15 +785,15 @@ cleanup: /* If we have a buffer that we are not using, decrease the use count so it may * be released if no-one else has a use-reference to it. */ - if (pending->newly_attached && + if (state->newly_attached && !surface->buffer_held && surface->buffer_ref.buffer) meta_wayland_surface_unref_buffer_use_count (surface); - g_signal_emit (pending, - pending_state_signals[PENDING_STATE_SIGNAL_APPLIED], + g_signal_emit (state, + surface_state_signals[SURFACE_STATE_SIGNAL_APPLIED], 0); - pending_state_reset (pending); + meta_wayland_surface_state_reset (state); g_node_children_foreach (surface->subsurface_branch_node, G_TRAVERSE_ALL, @@ -817,7 +817,7 @@ cleanup: } } -MetaWaylandPendingState * +MetaWaylandSurfaceState * meta_wayland_surface_get_pending_state (MetaWaylandSurface *surface) { return surface->pending_state; @@ -826,7 +826,7 @@ meta_wayland_surface_get_pending_state (MetaWaylandSurface *surface) static void meta_wayland_surface_commit (MetaWaylandSurface *surface) { - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; COGL_TRACE_BEGIN_SCOPED (MetaWaylandSurfaceCommit, "WaylandSurface (commit)"); @@ -844,9 +844,9 @@ meta_wayland_surface_commit (MetaWaylandSurface *surface) * surface is in effective desynchronized mode. */ if (meta_wayland_surface_should_cache_state (surface)) - merge_pending_state (pending, surface->sub.pending); + meta_wayland_surface_state_merge_into (pending, surface->sub.pending); else - meta_wayland_surface_apply_pending_state (surface, pending); + meta_wayland_surface_apply_state (surface, surface->pending_state); } static void @@ -864,7 +864,7 @@ wl_surface_attach (struct wl_client *client, { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; MetaWaylandBuffer *buffer; /* X11 unmanaged window */ @@ -905,7 +905,7 @@ wl_surface_damage (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; cairo_rectangle_int_t rectangle; /* X11 unmanaged window */ @@ -938,7 +938,7 @@ wl_surface_frame (struct wl_client *client, { MetaWaylandFrameCallback *callback; MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; /* X11 unmanaged window */ if (!surface) @@ -962,7 +962,7 @@ wl_surface_set_opaque_region (struct wl_client *client, struct wl_resource *region_resource) { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; /* X11 unmanaged window */ if (!surface) @@ -984,7 +984,7 @@ wl_surface_set_input_region (struct wl_client *client, struct wl_resource *region_resource) { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; /* X11 unmanaged window */ if (!surface) @@ -1047,7 +1047,7 @@ wl_surface_set_buffer_transform (struct wl_client *client, int32_t transform) { MetaWaylandSurface *surface = wl_resource_get_user_data (resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; MetaMonitorTransform buffer_transform; buffer_transform = transform_from_wl_output_transform (transform); @@ -1071,7 +1071,7 @@ wl_surface_set_buffer_scale (struct wl_client *client, int scale) { MetaWaylandSurface *surface = wl_resource_get_user_data (resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; if (scale <= 0) { @@ -1094,7 +1094,7 @@ wl_surface_damage_buffer (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); - MetaWaylandPendingState *pending = surface->pending_state; + MetaWaylandSurfaceState *pending = surface->pending_state; cairo_rectangle_int_t rectangle; /* X11 unmanaged window */ @@ -1647,7 +1647,7 @@ meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface, static void meta_wayland_surface_init (MetaWaylandSurface *surface) { - surface->pending_state = g_object_new (META_TYPE_WAYLAND_PENDING_STATE, NULL); + surface->pending_state = g_object_new (META_TYPE_WAYLAND_SURFACE_STATE, NULL); surface->subsurface_branch_node = g_node_new (surface); surface->subsurface_leaf_node = g_node_prepend_data (surface->subsurface_branch_node, surface); @@ -1791,7 +1791,7 @@ meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role) static void meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandSurfaceRoleClass *klass; @@ -1802,7 +1802,7 @@ meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role, static void meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role)->commit (surface_role, pending); diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index a164dcd18..9a8c8f793 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -33,8 +33,6 @@ #include "wayland/meta-wayland-pointer-constraints.h" #include "wayland/meta-wayland-types.h" -typedef struct _MetaWaylandPendingState MetaWaylandPendingState; - #define META_TYPE_WAYLAND_SURFACE (meta_wayland_surface_get_type ()) G_DECLARE_FINAL_TYPE (MetaWaylandSurface, meta_wayland_surface, @@ -45,11 +43,11 @@ G_DECLARE_FINAL_TYPE (MetaWaylandSurface, G_DECLARE_DERIVABLE_TYPE (MetaWaylandSurfaceRole, meta_wayland_surface_role, META, WAYLAND_SURFACE_ROLE, GObject); -#define META_TYPE_WAYLAND_PENDING_STATE (meta_wayland_pending_state_get_type ()) -G_DECLARE_FINAL_TYPE (MetaWaylandPendingState, - meta_wayland_pending_state, - META, WAYLAND_PENDING_STATE, - GObject); +#define META_TYPE_WAYLAND_SURFACE_STATE (meta_wayland_surface_state_get_type ()) +G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceState, + meta_wayland_surface_state, + META, WAYLAND_SURFACE_STATE, + GObject) struct _MetaWaylandSurfaceRoleClass { @@ -57,9 +55,9 @@ struct _MetaWaylandSurfaceRoleClass void (*assigned) (MetaWaylandSurfaceRole *surface_role); void (*pre_commit) (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); void (*commit) (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); gboolean (*is_on_logical_monitor) (MetaWaylandSurfaceRole *surface_role, MetaLogicalMonitor *logical_monitor); MetaWaylandSurface * (*get_toplevel) (MetaWaylandSurfaceRole *surface_role); @@ -71,7 +69,7 @@ struct _MetaWaylandSerial { uint32_t value; }; -struct _MetaWaylandPendingState +struct _MetaWaylandSurfaceState { GObject parent; @@ -177,7 +175,7 @@ struct _MetaWaylandSurface } dnd; /* All the pending state that wl_surface.commit will apply. */ - MetaWaylandPendingState *pending_state; + MetaWaylandSurfaceState *pending_state; /* Extension resources. */ struct wl_resource *wl_subsurface; @@ -199,7 +197,7 @@ struct _MetaWaylandSurface * state here. */ gboolean synchronous; - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; int32_t pending_x; int32_t pending_y; @@ -231,11 +229,11 @@ MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *composit struct wl_resource *compositor_resource, guint32 id); -MetaWaylandPendingState * +MetaWaylandSurfaceState * meta_wayland_surface_get_pending_state (MetaWaylandSurface *surface); -void meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface, - MetaWaylandPendingState *pending); +void meta_wayland_surface_apply_state (MetaWaylandSurface *surface, + MetaWaylandSurfaceState *state); gboolean meta_wayland_surface_is_effectively_synchronized (MetaWaylandSurface *surface); @@ -282,12 +280,12 @@ gboolean meta_wayland_surface_should_cache_state (MetaWaylandSurface MetaWindow * meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface); void meta_wayland_surface_cache_pending_frame_callbacks (MetaWaylandSurface *surface, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); void meta_wayland_surface_queue_pending_frame_callbacks (MetaWaylandSurface *surface); void meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface *surface, - MetaWaylandPendingState *pending); + MetaWaylandSurfaceState *pending); void meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface, float abs_x, diff --git a/src/wayland/meta-wayland-viewporter.c b/src/wayland/meta-wayland-viewporter.c index b3f31ee8e..619f3177c 100644 --- a/src/wayland/meta-wayland-viewporter.c +++ b/src/wayland/meta-wayland-viewporter.c @@ -37,7 +37,7 @@ static void wp_viewport_destructor (struct wl_resource *resource) { MetaWaylandSurface *surface; - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; surface = wl_resource_get_user_data (resource); if (!surface) @@ -100,7 +100,7 @@ wp_viewport_set_source (struct wl_client *client, (new_x == -1 && new_y == -1 && new_width == -1 && new_height == -1)) { - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; pending = meta_wayland_surface_get_pending_state (surface); pending->viewport_src_rect.origin.x = new_x; @@ -139,7 +139,7 @@ wp_viewport_set_destination (struct wl_client *client, if ((dst_width > 0 && dst_height > 0) || (dst_width == -1 && dst_height == -1)) { - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; pending = meta_wayland_surface_get_pending_state (surface); pending->viewport_dst_width = dst_width; diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c index 65ebb9609..6ab29ce64 100644 --- a/src/wayland/meta-wayland-wl-shell.c +++ b/src/wayland/meta-wayland-wl-shell.c @@ -563,7 +563,7 @@ bind_wl_shell (struct wl_client *client, static void wl_shell_surface_role_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandWlShellSurface *wl_shell_surface = META_WAYLAND_WL_SHELL_SURFACE (surface_role); diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 285914ba7..39673fa44 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -346,7 +346,7 @@ xdg_toplevel_set_max_size (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource); - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; if (width < 0 || height < 0) { @@ -371,7 +371,7 @@ xdg_toplevel_set_min_size (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource); - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; if (width < 0 || height < 0) { @@ -650,7 +650,7 @@ meta_wayland_xdg_toplevel_send_configure (MetaWaylandXdgToplevel *xdg_toplevel, static gboolean is_new_size_hints_valid (MetaWindow *window, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { int new_min_width, new_min_height; int new_max_width, new_max_height; @@ -681,7 +681,7 @@ is_new_size_hints_valid (MetaWindow *window, static void meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandXdgToplevel *xdg_toplevel = META_WAYLAND_XDG_TOPLEVEL (surface_role); MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_toplevel); @@ -1037,7 +1037,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup) static void meta_wayland_xdg_popup_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (surface_role); MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role); @@ -1383,7 +1383,7 @@ xdg_surface_set_window_geometry (struct wl_client *client, int32_t height) { MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); - MetaWaylandPendingState *pending; + MetaWaylandSurfaceState *pending; pending = meta_wayland_surface_get_pending_state (surface); pending->has_new_geometry = TRUE; @@ -1440,7 +1440,7 @@ meta_wayland_xdg_surface_real_reset (MetaWaylandXdgSurface *xdg_surface) static void meta_wayland_xdg_surface_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) + MetaWaylandSurfaceState *pending) { MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role); MetaWaylandShellSurface *shell_surface =