surface-actor/wayland: Implement stable size and position rounding
Implement the stable rounding algorithm as described in the discussions for the fractional-scale-v1 protocol. This adds an override of the ClutterActor::apply_transform vfunc for MetaSurfaceActorWayland that ensures the size and position of the contents of the surface are rounded according to the stable rounding algorithm. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
This commit is contained in:
@ -37,6 +37,7 @@ typedef struct _MetaWaylandShellSurfacePrivate
|
||||
MetaWindow *window;
|
||||
|
||||
gulong unmanaging_handler_id;
|
||||
gulong highest_scale_monitor_handler_id;
|
||||
} MetaWaylandShellSurfacePrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaWaylandShellSurface,
|
||||
@ -106,6 +107,8 @@ clear_window (MetaWaylandShellSurface *shell_surface)
|
||||
|
||||
g_clear_signal_handler (&priv->unmanaging_handler_id,
|
||||
priv->window);
|
||||
g_clear_signal_handler (&priv->highest_scale_monitor_handler_id,
|
||||
priv->window);
|
||||
priv->window = NULL;
|
||||
|
||||
surface_actor = meta_wayland_surface_get_actor (surface);
|
||||
@ -138,6 +141,12 @@ meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
||||
|
||||
priv->window = window;
|
||||
|
||||
priv->highest_scale_monitor_handler_id =
|
||||
g_signal_connect_swapped (window, "highest-scale-monitor-changed",
|
||||
G_CALLBACK (meta_wayland_surface_notify_highest_scale_monitor),
|
||||
surface);
|
||||
meta_wayland_surface_notify_highest_scale_monitor (surface);
|
||||
|
||||
surface_actor = meta_wayland_surface_get_actor (surface);
|
||||
if (surface_actor)
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (surface_actor), TRUE);
|
||||
|
@ -90,6 +90,8 @@ sync_actor_subsurface_state (MetaWaylandSurface *surface)
|
||||
clutter_actor_show (actor);
|
||||
else
|
||||
clutter_actor_hide (actor);
|
||||
|
||||
clutter_actor_notify_transform_invalid (actor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -555,6 +557,8 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
|
||||
surface->sub.synchronous = TRUE;
|
||||
surface->protocol_state.parent = parent;
|
||||
|
||||
meta_wayland_surface_notify_highest_scale_monitor (surface);
|
||||
|
||||
reference =
|
||||
g_node_last_child (parent->protocol_state.subsurface_branch_node)->data;
|
||||
queue_subsurface_placement (surface, reference,
|
||||
|
@ -2410,3 +2410,23 @@ meta_wayland_surface_is_xwayland (MetaWaylandSurface *surface)
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
output_state_handle_highest_scale_monitor (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandSurface *subsurface_surface;
|
||||
MetaSurfaceActor *actor = meta_wayland_surface_get_actor (surface);
|
||||
|
||||
if (actor)
|
||||
clutter_actor_notify_transform_invalid (CLUTTER_ACTOR (actor));
|
||||
|
||||
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (&surface->output_state,
|
||||
subsurface_surface)
|
||||
output_state_handle_highest_scale_monitor (subsurface_surface);
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_surface_notify_highest_scale_monitor (MetaWaylandSurface *surface)
|
||||
{
|
||||
output_state_handle_highest_scale_monitor (surface);
|
||||
}
|
||||
|
@ -414,6 +414,8 @@ struct wl_resource * meta_wayland_surface_get_resource (MetaWaylandSurface *surf
|
||||
|
||||
MetaWaylandCompositor * meta_wayland_surface_get_compositor (MetaWaylandSurface *surface);
|
||||
|
||||
void meta_wayland_surface_notify_highest_scale_monitor (MetaWaylandSurface *surface);
|
||||
|
||||
static inline MetaWaylandSurfaceState *
|
||||
meta_wayland_surface_state_new (void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user