wayland: Move tree updating to the shell surface role

The shell surface role is the one where subsurfaces may exist, and it
has direct relation to the MetaWindowActorWayland which currently has
the subsurface stacking logic.

Instead of directly finding the window actor when dealing with
subsurfaces, notify the parent surface that the subsurface state
changed, so that it can outsource the application of this information to
the role. For subsurface roles, this simply means forward upward to the
parent; for shell surface roles, this means regenerate the surface actor
layering.

This allows us to move away from accessing the window directly from the
surface, which in turn allows us to change the ownership structure of
windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
This commit is contained in:
Jonas Ådahl
2019-10-08 23:32:37 +02:00
committed by Robert Mader
parent ac2c870177
commit 5149e1e43a
6 changed files with 54 additions and 20 deletions

View File

@ -24,6 +24,7 @@
#include "wayland/meta-wayland-shell-surface.h"
#include "compositor/meta-surface-actor-wayland.h"
#include "compositor/meta-window-actor-wayland.h"
#include "wayland/meta-wayland-actor-surface.h"
#include "wayland/meta-wayland-buffer.h"
#include "wayland/meta-wayland-subsurface.h"
@ -165,6 +166,22 @@ meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface
meta_wayland_surface_get_height (surface) * geometry_scale;
}
static void
meta_wayland_shell_surface_notify_subsurface_state_changed (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window;
MetaWindowActor *window_actor;
window = surface->window;
if (!window)
return;
window_actor = meta_window_actor_from_window (window);
meta_window_actor_wayland_rebuild_surface_tree (window_actor);
}
static double
meta_wayland_shell_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
{
@ -246,6 +263,8 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
surface_role_class->apply_state =
meta_wayland_shell_surface_surface_apply_state;
surface_role_class->notify_subsurface_state_changed =
meta_wayland_shell_surface_notify_subsurface_state_changed;
actor_surface_class->get_geometry_scale =
meta_wayland_shell_surface_get_geometry_scale;