wayland/surface-role: Rename commit() vfunc apply_state()

The vfunc is not called when a surface commits its state, but when the
state is applied. Make this clearer by changing the name to
"apply_state" (and "pre_apply_state").

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
This commit is contained in:
Jonas Ådahl 2019-07-11 11:20:44 +02:00
parent 554644f9e0
commit d02c124e1d
9 changed files with 65 additions and 63 deletions

View File

@ -239,8 +239,8 @@ meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor_surf
}
static void
meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_actor_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandActorSurface *actor_surface =
META_WAYLAND_ACTOR_SURFACE (surface_role);
@ -325,7 +325,7 @@ meta_wayland_actor_surface_class_init (MetaWaylandActorSurfaceClass *klass)
object_class->dispose = meta_wayland_actor_surface_dispose;
surface_role_class->assigned = meta_wayland_actor_surface_assigned;
surface_role_class->commit = meta_wayland_actor_surface_commit;
surface_role_class->apply_state = meta_wayland_actor_surface_apply_state;
surface_role_class->is_on_logical_monitor =
meta_wayland_actor_surface_is_on_logical_monitor;

View File

@ -129,8 +129,8 @@ meta_wayland_cursor_surface_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_cursor_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandCursorSurface *cursor_surface =
META_WAYLAND_CURSOR_SURFACE (surface_role);
@ -147,8 +147,8 @@ meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role,
}
static void
meta_wayland_cursor_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_cursor_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandCursorSurface *cursor_surface =
META_WAYLAND_CURSOR_SURFACE (surface_role);
@ -277,8 +277,9 @@ meta_wayland_cursor_surface_class_init (MetaWaylandCursorSurfaceClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
surface_role_class->assigned = meta_wayland_cursor_surface_assigned;
surface_role_class->pre_commit = meta_wayland_cursor_surface_pre_commit;
surface_role_class->commit = meta_wayland_cursor_surface_commit;
surface_role_class->pre_apply_state =
meta_wayland_cursor_surface_pre_apply_state;
surface_role_class->apply_state = meta_wayland_cursor_surface_apply_state;
surface_role_class->is_on_logical_monitor =
meta_wayland_cursor_surface_is_on_logical_monitor;

View File

@ -46,8 +46,8 @@ dnd_surface_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
dnd_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
dnd_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
@ -61,7 +61,7 @@ dnd_surface_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_dnd->pending_offset_x = pending->dx;
surface_role_dnd->pending_offset_y = pending->dy;
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
}
static MetaLogicalMonitor *
@ -149,7 +149,7 @@ meta_wayland_surface_role_dnd_class_init (MetaWaylandSurfaceRoleDNDClass *klass)
META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
surface_role_class->assigned = dnd_surface_assigned;
surface_role_class->commit = dnd_surface_commit;
surface_role_class->apply_state = dnd_surface_apply_state;
actor_surface_class->get_geometry_scale = dnd_subsurface_get_geometry_scale;
actor_surface_class->sync_actor_state = dnd_subsurface_sync_actor_state;

View File

@ -646,8 +646,8 @@ is_new_size_hints_valid (MetaWindow *window,
}
static void
meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_zxdg_toplevel_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandZxdgToplevelV6 *xdg_toplevel =
META_WAYLAND_ZXDG_TOPLEVEL_V6 (surface_role);
@ -673,7 +673,7 @@ meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_zxdg_toplevel_v6_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
if (!xdg_surface_priv->configure_sent)
{
@ -828,7 +828,7 @@ meta_wayland_zxdg_toplevel_v6_class_init (MetaWaylandZxdgToplevelV6Class *klass)
object_class->finalize = meta_wayland_zxdg_toplevel_v6_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = meta_wayland_zxdg_toplevel_v6_commit;
surface_role_class->apply_state = meta_wayland_zxdg_toplevel_v6_apply_state;
surface_role_class->get_toplevel = meta_wayland_zxdg_toplevel_v6_get_toplevel;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
@ -955,8 +955,8 @@ finish_popup_setup (MetaWaylandZxdgPopupV6 *xdg_popup)
}
static void
meta_wayland_zxdg_popup_v6_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_zxdg_popup_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandZxdgPopupV6 *xdg_popup = META_WAYLAND_ZXDG_POPUP_V6 (surface_role);
MetaWaylandZxdgSurfaceV6 *xdg_surface =
@ -970,7 +970,7 @@ meta_wayland_zxdg_popup_v6_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_zxdg_popup_v6_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
/* If the window disappeared the surface is not coming back. */
if (!surface->window)
@ -1155,7 +1155,7 @@ meta_wayland_zxdg_popup_v6_class_init (MetaWaylandZxdgPopupV6Class *klass)
object_class->finalize = meta_wayland_zxdg_popup_v6_role_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = meta_wayland_zxdg_popup_v6_commit;
surface_role_class->apply_state = meta_wayland_zxdg_popup_v6_apply_state;
surface_role_class->get_toplevel = meta_wayland_zxdg_popup_v6_get_toplevel;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
@ -1317,8 +1317,8 @@ meta_wayland_zxdg_surface_v6_finalize (GObject *object)
}
static void
meta_wayland_zxdg_surface_v6_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_zxdg_surface_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandZxdgSurfaceV6 *xdg_surface =
META_WAYLAND_ZXDG_SURFACE_V6 (surface_role);
@ -1333,7 +1333,7 @@ meta_wayland_zxdg_surface_v6_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_zxdg_surface_v6_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
/* Ignore commits when unassigned. */
if (!priv->resource)
@ -1516,7 +1516,7 @@ meta_wayland_zxdg_surface_v6_class_init (MetaWaylandZxdgSurfaceV6Class *klass)
object_class->get_property = meta_wayland_zxdg_surface_v6_get_property;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = meta_wayland_zxdg_surface_v6_commit;
surface_role_class->apply_state = meta_wayland_zxdg_surface_v6_apply_state;
surface_role_class->assigned = meta_wayland_zxdg_surface_v6_assigned;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);

View File

@ -139,8 +139,8 @@ meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface,
}
static void
meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandActorSurface *actor_surface =
META_WAYLAND_ACTOR_SURFACE (surface_role);
@ -153,7 +153,7 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
buffer = surface->buffer_ref.buffer;
if (!buffer)
@ -250,7 +250,8 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
object_class->finalize = meta_wayland_shell_surface_finalize;
surface_role_class->commit = meta_wayland_shell_surface_surface_commit;
surface_role_class->apply_state =
meta_wayland_shell_surface_surface_apply_state;
actor_surface_class->get_geometry_scale =
meta_wayland_shell_surface_get_geometry_scale;

View File

@ -106,12 +106,12 @@ static void
meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role);
static void
meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
meta_wayland_surface_role_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
static void
meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
meta_wayland_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
static gboolean
meta_wayland_surface_role_is_on_logical_monitor (MetaWaylandSurfaceRole *surface_role,
@ -633,7 +633,7 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
if (surface->role)
{
meta_wayland_surface_role_pre_commit (surface->role, state);
meta_wayland_surface_role_pre_apply_state (surface->role, state);
}
else
{
@ -769,7 +769,7 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
if (surface->role)
{
meta_wayland_surface_role_commit (surface->role, state);
meta_wayland_surface_role_apply_state (surface->role, state);
g_assert (wl_list_empty (&state->frame_callback_list));
}
else
@ -1816,22 +1816,22 @@ meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_surface_role_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurfaceRoleClass *klass;
klass = META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role);
if (klass->pre_commit)
klass->pre_commit (surface_role, pending);
if (klass->pre_apply_state)
klass->pre_apply_state (surface_role, pending);
}
static void
meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role)->commit (surface_role,
pending);
META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role)->apply_state (surface_role,
pending);
}
static gboolean

View File

@ -54,10 +54,10 @@ struct _MetaWaylandSurfaceRoleClass
GObjectClass parent_class;
void (*assigned) (MetaWaylandSurfaceRole *surface_role);
void (*pre_commit) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
void (*commit) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
void (*pre_apply_state) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
void (*apply_state) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
gboolean (*is_on_logical_monitor) (MetaWaylandSurfaceRole *surface_role,
MetaLogicalMonitor *logical_monitor);
MetaWaylandSurface * (*get_toplevel) (MetaWaylandSurfaceRole *surface_role);

View File

@ -565,8 +565,8 @@ bind_wl_shell (struct wl_client *client,
}
static void
wl_shell_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
wl_shell_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface_role);
@ -581,7 +581,7 @@ wl_shell_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_wl_shell_surface_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
/* For wl_shell, it's equivalent to an unmap. Semantics
* are poorly defined, so we can choose some that are
@ -749,7 +749,7 @@ meta_wayland_wl_shell_surface_class_init (MetaWaylandWlShellSurfaceClass *klass)
object_class->finalize = wl_shell_surface_role_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = wl_shell_surface_role_commit;
surface_role_class->apply_state = wl_shell_surface_role_apply_state;
surface_role_class->get_toplevel = wl_shell_surface_role_get_toplevel;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);

View File

@ -673,8 +673,8 @@ is_new_size_hints_valid (MetaWindow *window,
}
static void
meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandXdgToplevel *xdg_toplevel = META_WAYLAND_XDG_TOPLEVEL (surface_role);
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_toplevel);
@ -709,7 +709,7 @@ meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_toplevel_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
if (!xdg_surface_priv->configure_sent)
{
@ -879,7 +879,7 @@ meta_wayland_xdg_toplevel_class_init (MetaWaylandXdgToplevelClass *klass)
object_class->finalize = meta_wayland_xdg_toplevel_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = meta_wayland_xdg_toplevel_commit;
surface_role_class->apply_state = meta_wayland_xdg_toplevel_apply_state;
surface_role_class->get_toplevel = meta_wayland_xdg_toplevel_get_toplevel;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
@ -1020,8 +1020,8 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
}
static void
meta_wayland_xdg_popup_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (surface_role);
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
@ -1044,7 +1044,7 @@ meta_wayland_xdg_popup_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_popup_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
if (xdg_popup->dismissed_by_client && surface->buffer_ref.buffer)
{
@ -1244,7 +1244,7 @@ meta_wayland_xdg_popup_class_init (MetaWaylandXdgPopupClass *klass)
object_class->finalize = meta_wayland_xdg_popup_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = meta_wayland_xdg_popup_commit;
surface_role_class->apply_state = meta_wayland_xdg_popup_apply_state;
surface_role_class->get_toplevel = meta_wayland_xdg_popup_get_toplevel;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);
@ -1419,8 +1419,8 @@ meta_wayland_xdg_surface_real_reset (MetaWaylandXdgSurface *xdg_surface)
}
static void
meta_wayland_xdg_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
meta_wayland_xdg_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
MetaWaylandShellSurface *shell_surface =
@ -1434,7 +1434,7 @@ meta_wayland_xdg_surface_commit (MetaWaylandSurfaceRole *surface_role,
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_surface_parent_class);
surface_role_class->commit (surface_role, pending);
surface_role_class->apply_state (surface_role, pending);
/* Ignore commits when unassigned. */
if (!priv->resource)
@ -1598,7 +1598,7 @@ meta_wayland_xdg_surface_class_init (MetaWaylandXdgSurfaceClass *klass)
object_class->get_property = meta_wayland_xdg_surface_get_property;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = meta_wayland_xdg_surface_commit;
surface_role_class->apply_state = meta_wayland_xdg_surface_apply_state;
surface_role_class->assigned = meta_wayland_xdg_surface_assigned;
shell_surface_class = META_WAYLAND_SHELL_SURFACE_CLASS (klass);