window-actor: Adjust sync_geometry

At the end of the sync_actor_geometry function the window buffer_rect
and the WindowActor position and size are the same and consistent.

Call the virtual method at the end and let the implementations look at
either the buffer_rect or the actor position/size itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3404>
This commit is contained in:
Sebastian Wick 2023-11-16 22:53:11 +01:00 committed by Marge Bot
parent 1ce1745384
commit 90d27e7b2e
4 changed files with 10 additions and 14 deletions

View File

@ -33,8 +33,7 @@ struct _MetaWindowActorClass
void (*update_regions) (MetaWindowActor *actor);
gboolean (*can_freeze_commits) (MetaWindowActor *actor);
void (*sync_geometry) (MetaWindowActor *actor,
const MtkRectangle *actor_rect);
void (*sync_geometry) (MetaWindowActor *actor);
gboolean (*is_single_surface_actor) (MetaWindowActor *actor);
};

View File

@ -523,8 +523,7 @@ maybe_configure_black_background (MetaWindowActorWayland *self,
}
static void
meta_window_actor_wayland_sync_geometry (MetaWindowActor *actor,
const MtkRectangle *actor_rect)
meta_window_actor_wayland_sync_geometry (MetaWindowActor *actor)
{
MetaWindowActorWayland *self = META_WINDOW_ACTOR_WAYLAND (actor);
ClutterActor *surface_container = CLUTTER_ACTOR (self->surface_container);
@ -543,6 +542,7 @@ meta_window_actor_wayland_sync_geometry (MetaWindowActor *actor,
&surfaces_width, &surfaces_height,
&background_width, &background_height))
{
MtkRectangle actor_rect;
int geometry_scale;
int child_actor_width, child_actor_height;
@ -557,10 +557,11 @@ meta_window_actor_wayland_sync_geometry (MetaWindowActor *actor,
NULL);
}
meta_window_get_buffer_rect (window, &actor_rect);
geometry_scale =
meta_window_actor_get_geometry_scale (actor);
child_actor_width = actor_rect->width / geometry_scale;
child_actor_height = actor_rect->height / geometry_scale;
child_actor_width = actor_rect.width / geometry_scale;
child_actor_height = actor_rect.height / geometry_scale;
clutter_actor_set_size (self->background,
background_width, background_height);
@ -609,11 +610,8 @@ meta_window_actor_wayland_map (ClutterActor *self)
ClutterActorClass *parent_class =
CLUTTER_ACTOR_CLASS (meta_window_actor_wayland_parent_class);
MetaWindowActor *window_actor = META_WINDOW_ACTOR (self);
MetaWindow *window = meta_window_actor_get_meta_window (window_actor);
MtkRectangle actor_rect;
meta_window_get_buffer_rect (window, &actor_rect);
meta_window_actor_wayland_sync_geometry (window_actor, &actor_rect);
meta_window_actor_wayland_sync_geometry (window_actor);
parent_class->map (self);
}

View File

@ -1413,8 +1413,7 @@ meta_window_actor_x11_is_single_surface_actor (MetaWindowActor *actor)
}
static void
meta_window_actor_x11_sync_geometry (MetaWindowActor *actor,
const MtkRectangle *actor_rect)
meta_window_actor_x11_sync_geometry (MetaWindowActor *actor)
{
}

View File

@ -964,8 +964,6 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
if (meta_window_actor_is_frozen (self) && !did_placement)
return META_WINDOW_ACTOR_CHANGE_POSITION | META_WINDOW_ACTOR_CHANGE_SIZE;
META_WINDOW_ACTOR_GET_CLASS (self)->sync_geometry (self, &actor_rect);
if (clutter_actor_has_allocation (actor))
{
ClutterActorBox box;
@ -996,6 +994,8 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
if (changes & META_WINDOW_ACTOR_CHANGE_SIZE)
clutter_actor_set_size (actor, actor_rect.width, actor_rect.height);
META_WINDOW_ACTOR_GET_CLASS (self)->sync_geometry (self);
return changes;
}