diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-02-26 03:17:59 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-02-26 03:17:59 +0000 |
commit | c76b4bdc77c8e1c01b7c79db78f8974dc8d7f0ef (patch) | |
tree | 1c22a915f383fc1cf93c7c8f1209a2717a32f764 | |
parent | 62fe4eae1682838d17a4a3230ad4c553717e1829 (diff) | |
parent | 99a40de8adebb809e8175a5c8b8a54fffcefbbff (diff) | |
download | gtk+-c76b4bdc77c8e1c01b7c79db78f8974dc8d7f0ef.tar.gz |
Merge branch 'wip/chergert/macos-add-window-accessor' into 'main'
macos: add getter for NSWindow with macOS windowing
See merge request GNOME/gtk!4509
-rw-r--r-- | gdk/macos/gdkmacossurface.c | 26 | ||||
-rw-r--r-- | gdk/macos/gdkmacossurface.h | 4 |
2 files changed, 29 insertions, 1 deletions
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c index 5998c4162f..f837e2c650 100644 --- a/gdk/macos/gdkmacossurface.c +++ b/gdk/macos/gdkmacossurface.c @@ -526,6 +526,11 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass) surface_class->set_input_region = gdk_macos_surface_set_input_region; surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region; + /** + * GdkMacosSurface:native: (attributes org.gtk.Property.get=gdk_macos_surface_get_native_window) + * + * The "native" property contains the underlying NSWindow. + */ properties [PROP_NATIVE] = g_param_spec_pointer ("native", "Native", @@ -686,6 +691,27 @@ _gdk_macos_surface_get_native (GdkMacosSurface *self) return (NSWindow *)self->window; } +/** + * gdk_macos_surface_get_native_window: (attributes org.gtk.Method.get_property=native) + * @self: a #GdkMacosSurface + * + * Gets the underlying NSWindow used by the surface. + * + * The NSWindow's contentView is an implementation detail and may change + * between releases of GTK. + * + * Returns: (nullable): a #NSWindow or %NULL + * + * Since: 4.8 + */ +gpointer +gdk_macos_surface_get_native_window (GdkMacosSurface *self) +{ + g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), NULL); + + return _gdk_macos_surface_get_native (self); +} + void _gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self, const GdkGeometry *geometry, diff --git a/gdk/macos/gdkmacossurface.h b/gdk/macos/gdkmacossurface.h index 470287202e..64ea4c733d 100644 --- a/gdk/macos/gdkmacossurface.h +++ b/gdk/macos/gdkmacossurface.h @@ -36,7 +36,9 @@ typedef struct _GdkMacosSurfaceClass GdkMacosSurfaceClass; #define GDK_IS_MACOS_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_SURFACE)) GDK_AVAILABLE_IN_ALL -GType gdk_macos_surface_get_type (void); +GType gdk_macos_surface_get_type (void); +GDK_AVAILABLE_IN_4_8 +gpointer gdk_macos_surface_get_native_window (GdkMacosSurface *self); G_END_DECLS |