diff options
author | Robert Mader <robert.mader@collabora.com> | 2022-11-02 19:35:35 +0100 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2023-03-19 21:45:14 +0000 |
commit | 774521cb9e3e0c11a760930f3509ce26c5136c52 (patch) | |
tree | 2dec8f5700c1e9664ab6725302122b07113ab855 | |
parent | 70a1ab6af5b2d94d54ec3299288d07a9a6d53561 (diff) | |
download | mutter-774521cb9e3e0c11a760930f3509ce26c5136c52.tar.gz |
wayland/subsurface: Implement meta_wayland_surface_get_window()
Subsurfaces are special regarding windows as they don't have a window,
but usually have an ancestor which does. All current users of
`get_window()` are either used for known surface roles, such as xdg-*
ones, or, as is the case for pointer constrains, would actually want to
get the ancestors window.
Thus implement `get_window()` to allow pointer constrains to work.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2223
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2717>
(cherry picked from commit 8af356c2c791a236977bbcc347e8d4378b6587ea)
-rw-r--r-- | src/wayland/meta-wayland-subsurface.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c index 92490332f..83a06c269 100644 --- a/src/wayland/meta-wayland-subsurface.c +++ b/src/wayland/meta-wayland-subsurface.c @@ -199,6 +199,20 @@ meta_wayland_subsurface_get_toplevel (MetaWaylandSurfaceRole *surface_role) return NULL; } +static MetaWindow * +meta_wayland_subsurface_get_window (MetaWaylandSurfaceRole *surface_role) +{ + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + MetaWaylandSurface *parent; + + parent = surface->sub.parent; + if (parent) + return meta_wayland_surface_get_window (parent); + else + return NULL; +} + static gboolean meta_wayland_subsurface_should_cache_state (MetaWaylandSurfaceRole *surface_role) { @@ -282,6 +296,7 @@ meta_wayland_subsurface_class_init (MetaWaylandSubsurfaceClass *klass) surface_role_class->assigned = meta_wayland_subsurface_assigned; surface_role_class->get_toplevel = meta_wayland_subsurface_get_toplevel; + surface_role_class->get_window = meta_wayland_subsurface_get_window; surface_role_class->should_cache_state = meta_wayland_subsurface_should_cache_state; surface_role_class->notify_subsurface_state_changed = meta_wayland_subsurface_notify_subsurface_state_changed; |