[gtk/wip/chergert/macos-add-window-accessor] macos: add getter for NSWindow with macOS windowing
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/macos-add-window-accessor] macos: add getter for NSWindow with macOS windowing
- Date: Tue, 22 Feb 2022 18:22:18 +0000 (UTC)
commit 2734fa2f3fd6ff54bf0b0b0c1302fd39c50ab435
Author: Christian Hergert <christian hergert me>
Date: Tue Feb 22 10:21:46 2022 -0800
macos: add getter for NSWindow with macOS windowing
There may be various reasons that an application could need access to the
underlying NSWindow that is being used to display the GdkMacosSurface
contents. This provides a minimal API to do that without exposing our
implementation details through public API.
As our rendering system is likely to change over time, we very much want
to keep GdkMacosView, GdkMacosLayer, GdkMacosTile, and GdkMacosWindow all
private implementation details which are subject to change.
As this is public API, we are a bit long-winded with the name so it is
clear what is being accessed without polluting symbol names with things
like "ns" as we used to.
gdk/macos/gdkmacossurface.c | 16 ++++++++++++++++
gdk/macos/gdkmacossurface.h | 5 ++++-
2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index ded5c19189..af75290493 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -667,6 +667,22 @@ _gdk_macos_surface_get_native (GdkMacosSurface *self)
return (NSWindow *)self->window;
}
+/**
+ * gdk_macos_surface_get_native_window:
+ * @self: a #GdkMacosSurface
+ *
+ * Gets the underlying NSWindow used by the surface.
+ *
+ * Returns: (nullable): a #NSWindow or %NULL
+ *
+ * Since: 4.8
+ */
+NSWindow *
+gdk_macos_surface_get_native_window (GdkMacosSurface *self)
+{
+ 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..c9e49ac415 100644
--- a/gdk/macos/gdkmacossurface.h
+++ b/gdk/macos/gdkmacossurface.h
@@ -24,6 +24,7 @@
#error "Only <gdk/macos/gdkmacos.h> can be included directly."
#endif
+#include <AppKit/AppKit.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
@@ -36,7 +37,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
+NSWindow *gdk_macos_surface_get_native_window (GdkMacosSurface *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]