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,7 +239,7 @@ meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor_surf
}
static void
meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_actor_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandActorSurface *actor_surface =
@ -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,7 +129,7 @@ meta_wayland_cursor_surface_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_cursor_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandCursorSurface *cursor_surface =
@ -147,7 +147,7 @@ meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role,
}
static void
meta_wayland_cursor_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_cursor_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandCursorSurface *cursor_surface =
@ -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,7 +46,7 @@ dnd_surface_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
dnd_surface_commit (MetaWaylandSurfaceRole *surface_role,
dnd_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurface *surface =
@ -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,7 +646,7 @@ is_new_size_hints_valid (MetaWindow *window,
}
static void
meta_wayland_zxdg_toplevel_v6_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_zxdg_toplevel_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandZxdgToplevelV6 *xdg_toplevel =
@ -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,7 +955,7 @@ finish_popup_setup (MetaWaylandZxdgPopupV6 *xdg_popup)
}
static void
meta_wayland_zxdg_popup_v6_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_zxdg_popup_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandZxdgPopupV6 *xdg_popup = META_WAYLAND_ZXDG_POPUP_V6 (surface_role);
@ -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,7 +1317,7 @@ meta_wayland_zxdg_surface_v6_finalize (GObject *object)
}
static void
meta_wayland_zxdg_surface_v6_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_zxdg_surface_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandZxdgSurfaceV6 *xdg_surface =
@ -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,7 +139,7 @@ meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface,
}
static void
meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandActorSurface *actor_surface =
@ -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,11 +106,11 @@ static void
meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role);
static void
meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_surface_role_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
static void
meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending);
static gboolean
@ -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,21 +1816,21 @@ meta_wayland_surface_role_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
meta_wayland_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role,
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,
meta_wayland_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role)->commit (surface_role,
META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role)->apply_state (surface_role,
pending);
}

View File

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

View File

@ -565,7 +565,7 @@ bind_wl_shell (struct wl_client *client,
}
static void
wl_shell_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
wl_shell_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandWlShellSurface *wl_shell_surface =
@ -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,7 +673,7 @@ is_new_size_hints_valid (MetaWindow *window,
}
static void
meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandXdgToplevel *xdg_toplevel = META_WAYLAND_XDG_TOPLEVEL (surface_role);
@ -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,7 +1020,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
}
static void
meta_wayland_xdg_popup_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (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,7 +1419,7 @@ meta_wayland_xdg_surface_real_reset (MetaWaylandXdgSurface *xdg_surface)
}
static void
meta_wayland_xdg_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_xdg_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
@ -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);