[gtk/wip/chergert/quartz4u] build: stub out macOS backend
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u] build: stub out macOS backend
- Date: Fri, 24 Apr 2020 17:41:16 +0000 (UTC)
commit 4b954d4da3de7bc23798ac6088328aaba2c58895
Author: Christian Hergert <chergert redhat com>
Date: Thu Apr 23 16:36:46 2020 -0700
build: stub out macOS backend
gdk/gdkconfig.h.meson | 1 +
gdk/gdkdisplaymanager.c | 7 ++
gdk/macos/gdkmacos-private.h | 30 +++++++
gdk/macos/gdkmacos.h | 27 ++++++
gdk/macos/gdkmacosdisplay-private.h | 43 +++++++++
gdk/macos/gdkmacosdisplay.c | 168 ++++++++++++++++++++++++++++++++++++
gdk/macos/gdkmacosdisplay.h | 47 ++++++++++
gdk/macos/gdkmacosmonitor-private.h | 47 ++++++++++
gdk/macos/gdkmacosmonitor.c | 58 +++++++++++++
gdk/macos/gdkmacosmonitor.h | 43 +++++++++
gdk/macos/meson.build | 41 +++++++++
gdk/meson.build | 3 +-
meson.build | 8 +-
meson_options.txt | 2 +
14 files changed, 522 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkconfig.h.meson b/gdk/gdkconfig.h.meson
index 80666b25f0..867b430e43 100644
--- a/gdk/gdkconfig.h.meson
+++ b/gdk/gdkconfig.h.meson
@@ -12,6 +12,7 @@ G_BEGIN_DECLS
#mesondefine GDK_WINDOWING_X11
#mesondefine GDK_WINDOWING_BROADWAY
+#mesondefine GDK_WINDOWING_MACOS
#mesondefine GDK_WINDOWING_WAYLAND
#mesondefine GDK_WINDOWING_WIN32
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index 8a359b77c6..cd6fb6fe71 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -50,6 +50,10 @@
#include "broadway/gdkprivate-broadway.h"
#endif
+#ifdef GDK_WINDOWING_MACOS
+#include "macos/gdkmacos-private.h"
+#endif
+
#ifdef GDK_WINDOWING_WIN32
#include "win32/gdkwin32.h"
#include "win32/gdkprivate-win32.h"
@@ -262,6 +266,9 @@ static GdkBackend gdk_backends[] = {
#ifdef GDK_WINDOWING_QUARTZ
{ "quartz", _gdk_quartz_display_open },
#endif
+#ifdef GDK_WINDOWING_MACOS
+ { "macos", _gdk_macos_display_open },
+#endif
#ifdef GDK_WINDOWING_WIN32
{ "win32", _gdk_win32_display_open },
#endif
diff --git a/gdk/macos/gdkmacos-private.h b/gdk/macos/gdkmacos-private.h
new file mode 100644
index 0000000000..793f67968e
--- /dev/null
+++ b/gdk/macos/gdkmacos-private.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GDK_MACOS_PRIVATE_H__
+#define __GDK_MACOS_PRIVATE_H__
+
+#define GDK_BEGIN_MACOS_ALLOC_POOL NSAutoreleasePool *_pool = [[NSAutoreleasePool alloc] init]
+#define GDK_END_MACOS_ALLOC_POOL [_pool release]
+
+#include "gdkmacos.h"
+#include "gdkmacosdisplay-private.h"
+#include "gdkmacosmonitor-private.h"
+
+#endif /* __GDK_MACOS_PRIVATE_H__ */
diff --git a/gdk/macos/gdkmacos.h b/gdk/macos/gdkmacos.h
new file mode 100644
index 0000000000..f7eea95502
--- /dev/null
+++ b/gdk/macos/gdkmacos.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GDK_MACOS_H__
+#define __GDK_MACOS_H__
+
+#include <gdk/gdk.h>
+
+#include "gdkmacosdisplay.h"
+
+#endif /* __GDK_MACOS_H__ */
diff --git a/gdk/macos/gdkmacosdisplay-private.h b/gdk/macos/gdkmacosdisplay-private.h
new file mode 100644
index 0000000000..a7060ca8ab
--- /dev/null
+++ b/gdk/macos/gdkmacosdisplay-private.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GDK_MACOS_DISPLAY_PRIVATE_H__
+#define __GDK_MACOS_DISPLAY_PRIVATE_H__
+
+#include "gdkdisplayprivate.h"
+#include "gdkmacosdisplay.h"
+
+G_BEGIN_DECLS
+
+struct _GdkMacosDisplay
+{
+ GdkDisplay parent_instance;
+ GPtrArray *monitors;
+};
+
+struct _GdkMacosDisplayClass
+{
+ GdkDisplayClass parent_class;
+};
+
+GdkDisplay *_gdk_macos_display_open (const gchar *display_name);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_DISPLAY_PRIVATE_H__ */
diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c
new file mode 100644
index 0000000000..8ef2070c76
--- /dev/null
+++ b/gdk/macos/gdkmacosdisplay.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "config.h"
+
+#include <gdk/gdk.h>
+
+#include "gdkmacosdisplay-private.h"
+#include "gdkmacosmonitor-private.h"
+
+/**
+ * SECTION:macos_interaction
+ * @Short_description: macOS backend-specific functions
+ * @Title: macOS Interaction
+ * @Include: gdk/macos/gdkmacos.h
+ *
+ * The functions in this section are specific to the GDK macOS backend.
+ * To use them, you need to include the `<gdk/macos/gdkmacos.h>` header and
+ * use the macOS-specific pkg-config `gtk4-macos` file to build your
+ * application.
+ *
+ * To make your code compile with other GDK backends, guard backend-specific
+ * calls by an ifdef as follows. Since GDK may be built with multiple
+ * backends, you should also check for the backend that is in use (e.g. by
+ * using the GDK_IS_MACOS_DISPLAY() macro).
+ * |[<!-- language="C" -->
+ * #ifdef GDK_WINDOWING_MACOS
+ * if (GDK_IS_MACOS_DISPLAY (display))
+ * {
+ * // make macOS-specific calls here
+ * }
+ * else
+ * #endif
+ * #ifdef GDK_WINDOWING_X11
+ * if (GDK_IS_X11_DISPLAY (display))
+ * {
+ * // make X11-specific calls here
+ * }
+ * else
+ * #endif
+ * g_error ("Unsupported GDK backend");
+ * ]|
+ */
+
+G_DEFINE_TYPE (GdkMacosDisplay, gdk_macos_display, GDK_TYPE_DISPLAY)
+
+static void
+gdk_macos_display_add_monitor (GdkMacosDisplay *self,
+ GdkMacosMonitor *monitor)
+{
+ g_assert (GDK_IS_MACOS_DISPLAY (self));
+ g_assert (GDK_IS_MACOS_MONITOR (monitor));
+
+ g_ptr_array_add (self->monitors, g_object_ref (monitor));
+ gdk_display_monitor_added (GDK_DISPLAY (self), GDK_MONITOR (monitor));
+}
+
+static void
+gdk_macos_display_remove_monitor (GdkMacosDisplay *self,
+ GdkMacosMonitor *monitor)
+{
+ g_assert (GDK_IS_MACOS_DISPLAY (self));
+ g_assert (GDK_IS_MACOS_MONITOR (monitor));
+
+ g_object_ref (monitor);
+
+ if (g_ptr_array_remove (self->monitors, monitor))
+ gdk_display_monitor_removed (GDK_DISPLAY (self), GDK_MONITOR (monitor));
+
+ g_object_unref (monitor);
+}
+
+static void
+gdk_macos_display_load_monitors (GdkMacosDisplay *self)
+{
+#if 0
+ GDK_BEGIN_MACOS_ALLOC_POOL;
+
+ NSArray *screens;
+
+ g_assert (GDK_IS_MACOS_DISPLAY (self));
+
+ screens = [NSScreen screens];
+
+ for (id obj in screens)
+ {
+ CGDirectDisplayID screen_id;
+ GdkMonitor *monitor;
+
+ screen_id = [[[obj deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
+ monitor = _gdk_macos_monitor_new (self, screen_id);
+
+ gdk_macos_display_add_monitor (self, monitor);
+
+ g_object_unref (monitor);
+ }
+
+ GDK_END_MACOS_ALLOC_POOL;
+#endif
+}
+
+static void
+gdk_macos_display_constructed (GObject *object)
+{
+ GdkMacosDisplay *self = (GdkMacosDisplay *)object;
+
+ G_OBJECT_CLASS (gdk_macos_display_parent_class)->constructed (object);
+
+ gdk_macos_display_load_monitors (self);
+}
+
+static void
+gdk_macos_display_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gdk_macos_display_parent_class)->finalize (object);
+}
+
+static void
+gdk_macos_display_class_init (GdkMacosDisplayClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructed = gdk_macos_display_constructed;
+ object_class->finalize = gdk_macos_display_finalize;
+}
+
+static void
+gdk_macos_display_init (GdkMacosDisplay *self)
+{
+ self->monitors = g_ptr_array_new_with_free_func (g_object_unref);
+}
+
+GdkDisplay *
+_gdk_macos_display_open (const gchar *display_name)
+{
+ GdkDisplay *display;
+
+ GDK_NOTE (MISC, g_message ("opening display %s", display_name ? display_name : ""));
+
+ /* Make the current process a foreground application, i.e. an app
+ * with a user interface, in case we're not running from a .app bundle
+ */
+ //TransformProcessType (&psn, kProcessTransformToForegroundApplication);
+
+ display = g_object_new (GDK_TYPE_MACOS_DISPLAY, NULL);
+
+ //[NSApplication sharedApplication];
+
+ gdk_display_emit_opened (display);
+
+ return g_steal_pointer (&display);
+}
diff --git a/gdk/macos/gdkmacosdisplay.h b/gdk/macos/gdkmacosdisplay.h
new file mode 100644
index 0000000000..7c5730d0c7
--- /dev/null
+++ b/gdk/macos/gdkmacosdisplay.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GDK_MACOS_DISPLAY_H__
+#define __GDK_MACOS_DISPLAY_H__
+
+#if !defined (__GDKMACOS_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gdk/macos/gdkmacos.h> can be included directly."
+#endif
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#ifdef GTK_COMPILATION
+typedef struct _GdkMacosDisplay GdkMacosDisplay;
+#else
+typedef GdkDisplay GdkMacosDisplay;
+#endif
+typedef struct _GdkMacosDisplayClass GdkMacosDisplayClass;
+
+#define GDK_TYPE_MACOS_DISPLAY (gdk_macos_display_get_type())
+#define GDK_MACOS_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MACOS_DISPLAY,
GdkMacosDisplay))
+#define GDK_IS_MACOS_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_DISPLAY))
+
+GDK_AVAILABLE_IN_ALL
+GType gdk_macos_display_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_DISPLAY_H__ */
diff --git a/gdk/macos/gdkmacosmonitor-private.h b/gdk/macos/gdkmacosmonitor-private.h
new file mode 100644
index 0000000000..cd63f23e72
--- /dev/null
+++ b/gdk/macos/gdkmacosmonitor-private.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GDK_MACOS_MONITOR_PRIVATE_H__
+#define __GDK_MACOS_MONITOR_PRIVATE_H__
+
+#include "gdkmacosdisplay.h"
+#include "gdkmacosmonitor.h"
+
+#include "gdkmonitorprivate.h"
+
+G_BEGIN_DECLS
+
+struct _GdkMacosMonitor
+{
+ GdkMonitor parent_instance;
+};
+
+struct _GdkMacosMonitorClass
+{
+ GdkMonitorClass parent_class;
+};
+
+typedef guint CGDirectDisplayID;
+
+GdkMonitor *_gdk_macos_monitor_new (GdkMacosDisplay *display,
+ CGDirectDisplayID monitor_id);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_MONITOR_PRIVATE_H__ */
diff --git a/gdk/macos/gdkmacosmonitor.c b/gdk/macos/gdkmacosmonitor.c
new file mode 100644
index 0000000000..3b7644ba81
--- /dev/null
+++ b/gdk/macos/gdkmacosmonitor.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "config.h"
+
+#include <gdk/gdk.h>
+
+#include "gdkmacosmonitor-private.h"
+
+G_DEFINE_TYPE (GdkMacosMonitor, gdk_macos_monitor, GDK_TYPE_MONITOR)
+
+static void
+gdk_macos_monitor_finalize (GObject *object)
+{
+ GdkMacosMonitor *self = (GdkMacosMonitor *)object;
+
+ G_OBJECT_CLASS (gdk_macos_monitor_parent_class)->finalize (object);
+}
+
+static void
+gdk_macos_monitor_class_init (GdkMacosMonitorClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gdk_macos_monitor_finalize;
+}
+
+static void
+gdk_macos_monitor_init (GdkMacosMonitor *self)
+{
+}
+
+GdkMonitor *
+_gdk_macos_monitor_new (GdkMacosDisplay *display,
+ CGDirectDisplayID screen_id)
+{
+ g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (display), NULL);
+
+ return g_object_new (GDK_TYPE_MACOS_MONITOR,
+ "display", display,
+ NULL);
+}
diff --git a/gdk/macos/gdkmacosmonitor.h b/gdk/macos/gdkmacosmonitor.h
new file mode 100644
index 0000000000..64b91f887e
--- /dev/null
+++ b/gdk/macos/gdkmacosmonitor.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GDK_MACOS_MONITOR_H__
+#define __GDK_MACOS_MONITOR_H__
+
+#if !defined (__GDKMACOS_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gdk/macos/gdkmacos.h> can be included directly."
+#endif
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GdkMacosMonitor GdkMacosMonitor;
+typedef struct _GdkMacosMonitorClass GdkMacosMonitorClass;
+
+#define GDK_TYPE_MACOS_MONITOR (gdk_macos_monitor_get_type())
+#define GDK_MACOS_MONITOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MACOS_MONITOR,
GdkMacosMonitor))
+#define GDK_IS_MACOS_MONITOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_MONITOR))
+
+GDK_AVAILABLE_IN_ALL
+GType gdk_macos_monitor_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_MONITOR_H__ */
diff --git a/gdk/macos/meson.build b/gdk/macos/meson.build
new file mode 100644
index 0000000000..a595b280ba
--- /dev/null
+++ b/gdk/macos/meson.build
@@ -0,0 +1,41 @@
+gdk_macos_sources = files([
+ # 'gdkapplaunchcontext-macos.c',
+ # 'gdkcairocontext-macos.c',
+ # 'gdkclipboard-macos.c',
+ # 'gdkcursor-macos.c',
+ # 'gdkdevice-macos.c',
+ 'gdkmacosdisplay.c',
+ 'gdkmacosmonitor.c',
+ # 'gdkdrag-macos.c',
+ # 'gdkdrop-macos.c',
+ # 'gdkeventsource.c',
+ # 'gdkglcontext-macos.c',
+ # 'gdkkeys-macos.c',
+ # 'gdkprimary-macos.c',
+ # 'gdksurface-macos.c',
+])
+
+gdk_macos_public_headers = files([
+ # 'gdkmacosdevice.h',
+ 'gdkmacosdisplay.h',
+ 'gdkmacosmonitor.h',
+ # 'gdkmacosglcontext.h',
+ # 'gdkmacossurface.h'
+])
+
+install_headers(gdk_macos_public_headers, 'gdkmacos.h', subdir: 'gtk-4.0/gdk/macos/')
+
+gdk_macos_deps = [
+]
+
+libgdk_macos = static_library('gdk-macos',
+ gdk_macos_sources, gdkconfig, gdkenum_h,
+ include_directories: [ confinc, gdkinc, ],
+ c_args: [
+ '-DGTK_COMPILATION',
+ '-DG_LOG_DOMAIN="Gdk"',
+ '-xobjective-c',
+ ] + common_cflags,
+ link_args: common_ldflags,
+ link_with: [],
+ dependencies: [ gdk_deps, gdk_macos_deps])
diff --git a/gdk/meson.build b/gdk/meson.build
index ac14c3b6fe..5835c0fbbf 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -143,6 +143,7 @@ gdkconfig_cdata.set('GDK_WINDOWING_X11', x11_enabled)
gdkconfig_cdata.set('GDK_WINDOWING_WAYLAND', wayland_enabled)
gdkconfig_cdata.set('GDK_WINDOWING_WIN32', win32_enabled)
gdkconfig_cdata.set('GDK_WINDOWING_BROADWAY', broadway_enabled)
+gdkconfig_cdata.set('GDK_WINDOWING_MACOS', macos_enabled)
gdkconfig_cdata.set('GDK_RENDERING_VULKAN', have_vulkan)
gdkconfig = configure_file(
@@ -218,7 +219,7 @@ endif
gdk_backends = []
gdk_backends_gen_headers = [] # non-public generated headers
-foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11']
+foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11', 'macos']
if get_variable('@0@_enabled'.format(backend))
subdir(backend)
gdk_deps += get_variable('gdk_@0@_deps'.format(backend))
diff --git a/meson.build b/meson.build
index 12388f743a..c5c431a17a 100644
--- a/meson.build
+++ b/meson.build
@@ -93,6 +93,7 @@ gtk_api_version = '4.0'
x11_enabled = get_option('x11-backend')
wayland_enabled = get_option('wayland-backend')
broadway_enabled = get_option('broadway-backend')
+macos_enabled = get_option('macos-backend')
quartz_enabled = get_option('quartz-backend')
win32_enabled = get_option('win32-backend')
@@ -242,6 +243,8 @@ if cc.get_id() == 'msvc'
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
test_cflags = [
'-fno-strict-aliasing',
+ '-Wno-c++11-extensions',
+ '-Wno-missing-include-dirs',
'-Wno-typedef-redefinition',
'-Wcast-align',
'-Wduplicated-branches',
@@ -368,7 +371,8 @@ pangocairo_dep = dependency('pangocairo', version: cairo_req,
pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'])
epoxy_dep = dependency('epoxy', version: epoxy_req,
- fallback: ['libepoxy', 'libepoxy_dep'])
+ fallback: ['libepoxy', 'libepoxy_dep'],
+ static: false)
atk_dep = dependency('atk', version: atk_req)
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false)
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
@@ -775,7 +779,7 @@ pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
pkgs = [ 'gtk4.pc' ]
pkg_targets = ''
-foreach backend: [ 'broadway', 'quartz', 'wayland', 'win32', 'x11', ]
+foreach backend: [ 'broadway', 'quartz', 'macos', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend))
pkgs += ['gtk4-@0@.pc'.format(backend)]
pkg_targets += ' ' + backend
diff --git a/meson_options.txt b/meson_options.txt
index 73f26da7da..61c8930ab3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,6 +9,8 @@ option('win32-backend', type: 'boolean', value: true,
description : 'Enable the Windows gdk backend (only when building on Windows)')
option('quartz-backend', type: 'boolean', value: true,
description : 'Enable the macOS gdk backend (only when building on macOS)')
+option('macos-backend', type: 'boolean', value: true,
+ description : 'Enable the macOS gdk backend (only when building on macOS)')
# Media backends
option('media', type: 'string', value: 'gstreamer',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]