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:
msizanoen1
2022-11-26 18:33:46 +07:00
committed by Marge Bot
parent ed90c78872
commit e94b527777
5 changed files with 139 additions and 0 deletions

View File

@ -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);