wayland/surface: Expose the MetaWindow of the MetaWaylandSurface as a property

This allows Mutter users to have access to the window without having to expose
the whole MetaWaylandSurface class.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3298>
This commit is contained in:
Corentin Noël 2023-09-27 16:30:44 +02:00
parent c4b9431bb2
commit 9886dcc001

View File

@ -82,6 +82,7 @@ enum
PROP_0, PROP_0,
PROP_SCANOUT_CANDIDATE, PROP_SCANOUT_CANDIDATE,
PROP_WINDOW,
N_PROPS N_PROPS
}; };
@ -1776,6 +1777,9 @@ meta_wayland_surface_get_property (GObject *object,
case PROP_SCANOUT_CANDIDATE: case PROP_SCANOUT_CANDIDATE:
g_value_set_object (value, surface->scanout_candidate); g_value_set_object (value, surface->scanout_candidate);
break; break;
case PROP_WINDOW:
g_value_set_object (value, meta_wayland_surface_get_window (surface));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -1795,6 +1799,12 @@ meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass)
META_TYPE_CRTC, META_TYPE_CRTC,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS); G_PARAM_STATIC_STRINGS);
obj_props[PROP_WINDOW] =
g_param_spec_object ("window", NULL, NULL,
META_TYPE_WINDOW,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props); g_object_class_install_properties (object_class, N_PROPS, obj_props);
surface_signals[SURFACE_DESTROY] = surface_signals[SURFACE_DESTROY] =