From 90d27e7b2ebd4979d9c622752d184dc8b80edecf Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Thu, 16 Nov 2023 22:53:11 +0100 Subject: [PATCH] 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: --- src/compositor/meta-window-actor-private.h | 3 +-- src/compositor/meta-window-actor-wayland.c | 14 ++++++-------- src/compositor/meta-window-actor-x11.c | 3 +-- src/compositor/meta-window-actor.c | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h index e79910d72..efd335f57 100644 --- a/src/compositor/meta-window-actor-private.h +++ b/src/compositor/meta-window-actor-private.h @@ -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); }; diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c index 2f2e08432..5f938da21 100644 --- a/src/compositor/meta-window-actor-wayland.c +++ b/src/compositor/meta-window-actor-wayland.c @@ -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); } diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index 24f2a50ed..cf208b995 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -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) { } diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index c1794e37a..0c4b6e970 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -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; }