[gtk/wip/chergert/quartz4u] stub out various surfaces
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u] stub out various surfaces
- Date: Mon, 27 Apr 2020 22:11:26 +0000 (UTC)
commit e28dd48bcb48b1709915ca02dbedfaf0d139eaf1
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 27 15:09:42 2020 -0700
stub out various surfaces
gdk/macos/gdkmacosdragsurface-private.h | 44 +++++++++++++++++
gdk/macos/gdkmacosdragsurface.c | 72 ++++++++++++++++++++++++++++
gdk/macos/gdkmacospopupsurface-private.h | 44 +++++++++++++++++
gdk/macos/gdkmacospopupsurface.c | 74 +++++++++++++++++++++++++++++
gdk/macos/gdkmacossurface-private.h | 28 ++++++-----
gdk/macos/gdkmacossurface.c | 56 +++++++++-------------
gdk/macos/gdkmacossurface.h | 2 +-
gdk/macos/gdkmacostoplevelsurface-private.h | 44 +++++++++++++++++
gdk/macos/gdkmacostoplevelsurface.c | 74 +++++++++++++++++++++++++++++
gdk/macos/meson.build | 26 ++++------
10 files changed, 398 insertions(+), 66 deletions(-)
---
diff --git a/gdk/macos/gdkmacosdragsurface-private.h b/gdk/macos/gdkmacosdragsurface-private.h
new file mode 100644
index 0000000000..2fcba16c82
--- /dev/null
+++ b/gdk/macos/gdkmacosdragsurface-private.h
@@ -0,0 +1,44 @@
+/*
+ * 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_DRAG_SURFACE_PRIVATE_H__
+#define __GDK_MACOS_DRAG_SURFACE_PRIVATE_H__
+
+#include "gdkmacossurface-private.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GdkMacosDragSurface GdkMacosDragSurface;
+typedef struct _GdkMacosDragSurfaceClass GdkMacosDragSurfaceClass;
+
+#define GDK_TYPE_MACOS_DRAG_SURFACE (_gdk_macos_drag_surface_get_type())
+#define GDK_MACOS_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
GDK_TYPE_MACOS_DRAG_SURFACE, GdkMacosDragSurface))
+#define GDK_IS_MACOS_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object),
GDK_TYPE_MACOS_DRAG_SURFACE))
+
+GType _gdk_macos_drag_surface_get_type (void);
+GdkMacosSurface *_gdk_macos_drag_surface_new (GdkMacosDisplay *display,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_DRAG_SURFACE_PRIVATE_H__ */
diff --git a/gdk/macos/gdkmacosdragsurface.c b/gdk/macos/gdkmacosdragsurface.c
new file mode 100644
index 0000000000..e84945d64d
--- /dev/null
+++ b/gdk/macos/gdkmacosdragsurface.c
@@ -0,0 +1,72 @@
+/*
+ * 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 "gdkdragsurfaceprivate.h"
+
+#include "gdkmacosdragsurface-private.h"
+
+struct _GdkMacosDragSurface
+{
+ GdkMacosSurface parent_instance;
+};
+
+static void
+drag_surface_iface_init (GdkDragSurfaceInterface *iface)
+{
+}
+
+G_DEFINE_TYPE_WITH_CODE (GdkMacosDragSurface, _gdk_macos_drag_surface, GDK_TYPE_MACOS_SURFACE,
+ G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE, drag_surface_iface_init))
+
+static void
+_gdk_macos_drag_surface_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (_gdk_macos_drag_surface_parent_class)->finalize (object);
+}
+
+static void
+_gdk_macos_drag_surface_class_init (GdkMacosDragSurfaceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = _gdk_macos_drag_surface_finalize;
+}
+
+static void
+_gdk_macos_drag_surface_init (Gdkmacosdragsurface *self)
+{
+}
+
+GdkMacosSurface *
+_gdk_macos_drag_surface_new (GdkMacosDisplay *display,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (display), NULL);
+ g_return_val_if_fail (!parent || GDK_IS_MACOS_SURFACE (parent), NULL);
+
+ return g_object_new (GDK_TYPE_MACOS_DRAG_SURFACE,
+ "display", display,
+ NULL);
+}
diff --git a/gdk/macos/gdkmacospopupsurface-private.h b/gdk/macos/gdkmacospopupsurface-private.h
new file mode 100644
index 0000000000..2f48c4cd07
--- /dev/null
+++ b/gdk/macos/gdkmacospopupsurface-private.h
@@ -0,0 +1,44 @@
+/*
+ * 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_POPUP_SURFACE_PRIVATE_H__
+#define __GDK_MACOS_POPUP_SURFACE_PRIVATE_H__
+
+#include "gdkmacossurface-private.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GdkMacosPopupSurface GdkMacosPopupSurface;
+typedef struct _GdkMacosPopupSurfaceClass GdkMacosPopupSurfaceClass;
+
+#define GDK_TYPE_MACOS_POPUP_SURFACE (_gdk_macos_popup_surface_get_type())
+#define GDK_MACOS_POPUP_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
GDK_TYPE_MACOS_POPUP_SURFACE, GdkMacosPopupSurface))
+#define GDK_IS_MACOS_POPUP_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object),
GDK_TYPE_MACOS_POPUP_SURFACE))
+
+GType _gdk_macos_popup_surface_get_type (void);
+GdkMacosSurface *_gdk_macos_popup_surface_new (GdkMacosDisplay *display,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_POPUP_SURFACE_PRIVATE_H__ */
diff --git a/gdk/macos/gdkmacospopupsurface.c b/gdk/macos/gdkmacospopupsurface.c
new file mode 100644
index 0000000000..e51b5ab536
--- /dev/null
+++ b/gdk/macos/gdkmacospopupsurface.c
@@ -0,0 +1,74 @@
+/*
+ * 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 "gdkpopupprivate.h"
+
+#include "gdkmacospopupsurface-private.h"
+
+struct _GdkMacosPopupSurface
+{
+ GdkMacosSurface parent_instance;
+};
+
+static void
+popup_interface_init (GdkPopupInterface *iface)
+{
+}
+
+G_DEFINE_TYPE_WITH_CODE (GdkMacosPopupSurface, _gdk_macos_popup_surface, GDK_TYPE_MACOS_SURFACE,
+ G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP, popup_interface_init))
+
+static void
+_gdk_macos_popup_surface_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (_gdk_macos_popup_surface_parent_class)->finalize (object);
+}
+
+static void
+_gdk_macos_popup_surface_class_init (GdkMacosPopupSurfaceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = _gdk_macos_popup_surface_finalize;
+
+ gdk_popup_install_properties (object_class, 1);
+}
+
+static void
+_gdk_macos_popup_surface_init (Gdkmacospopupsurface *self)
+{
+}
+
+GdkMacosSurface *
+_gdk_macos_popup_surface_new (GdkMacosDisplay *display,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (display), NULL);
+ g_return_val_if_fail (!parent || GDK_IS_MACOS_SURFACE (parent), NULL);
+
+ return g_object_new (GDK_TYPE_MACOS_POPUP_SURFACE,
+ "display", display,
+ NULL);
+}
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index daf6a6efef..e67648f6d8 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -27,19 +27,21 @@
G_BEGIN_DECLS
-GdkMacosSurface *_gdk_macos_surface_new (GdkMacosDisplay *display,
- GdkSurfaceType surface_type,
- GdkSurface *parent,
- int x,
- int y,
- int width,
- int height);
-GdkSurfaceType _gdk_macos_surface_get_surface_type (GdkMacosSurface *self);
-void _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
- gint *top,
- gint *right,
- gint *bottom,
- gint *left);
+struct _GdkMacosSurface
+{
+ GdkSurface parent_instance;
+};
+
+struct _GdkMacosSurfaceClass
+{
+ GdkSurfaceClass parent_class;
+};
+
+void _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
+ gint *top,
+ gint *right,
+ gint *bottom,
+ gint *left);
G_END_DECLS
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 7592787090..359de74059 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -23,26 +23,21 @@
#include <gdk/gdk.h>
#include "gdksurfaceprivate.h"
-#include "gdkmacossurface-private.h"
-
-struct _GdkMacosSurface
-{
- GdkSurface parent_instance;
-
- GdkSurfaceType surface_type;
- gint shadow_top;
- gint shadow_right;
- gint shadow_bottom;
- gint shadow_left;
-};
+#include "gdkmacosdragsurface-private.h"
+#include "gdkmacospopupsurface-private.h"
+#include "gdkmacossurface-private.h"
+#include "gdkmacostoplevelsurface-private.h"
-struct _GdkMacosSurfaceClass
+typedef struct
{
- GdkSurfaceClass parent_class;
-};
+ gint shadow_top;
+ gint shadow_right;
+ gint shadow_bottom;
+ gint shadow_left;
+} GdkMacosSurfacePrivate;
-G_DEFINE_TYPE (GdkMacosSurface, gdk_macos_surface, GDK_TYPE_SURFACE)
+G_DEFINE_TYPE_WITH_PRIVATE (GdkMacosSurface, gdk_macos_surface, GDK_TYPE_SURFACE)
static void
gdk_macos_surface_finalize (GObject *object)
@@ -79,26 +74,17 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
switch (surface_type)
{
case GDK_SURFACE_TOPLEVEL:
+ return _gdk_macos_toplevel_surface_new (display, parent, x, y, width, height);
+
case GDK_SURFACE_POPUP:
+ return _gdk_macos_popup_surface_new (display, parent, x, y, width, height);
+
case GDK_SURFACE_TEMP:
- break;
+ return _gdk_macos_drag_surface_new (display, parent, x, y, width, height);
default:
return NULL;
}
-
- return g_object_new (GDK_TYPE_MACOS_SURFACE,
- "display", display,
- "surface-type", surface_type,
- NULL);
-}
-
-GdkSurfaceType
-_gdk_macos_surface_get_surface_type (GdkMacosSurface *self)
-{
- g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), 0);
-
- return self->surface_type;
}
void
@@ -108,17 +94,19 @@ _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
gint *bottom,
gint *left)
{
+ GdkMacosSurfacePrivate *priv = gdk_macos_surface_get_instance_private (self);
+
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
if (top)
- *top = self->shadow_top;
+ *top = priv->shadow_top;
if (left)
- *left = self->shadow_left;
+ *left = priv->shadow_left;
if (bottom)
- *bottom = self->shadow_bottom;
+ *bottom = priv->shadow_bottom;
if (right)
- *right = self->shadow_right;
+ *right = priv->shadow_right;
}
diff --git a/gdk/macos/gdkmacossurface.h b/gdk/macos/gdkmacossurface.h
index 81b59689ad..470287202e 100644
--- a/gdk/macos/gdkmacossurface.h
+++ b/gdk/macos/gdkmacossurface.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-typedef struct _GdkMacosSurface GdkMacosSurface;
+typedef struct _GdkMacosSurface GdkMacosSurface;
typedef struct _GdkMacosSurfaceClass GdkMacosSurfaceClass;
#define GDK_TYPE_MACOS_SURFACE (gdk_macos_surface_get_type())
diff --git a/gdk/macos/gdkmacostoplevelsurface-private.h b/gdk/macos/gdkmacostoplevelsurface-private.h
new file mode 100644
index 0000000000..73b828e6dd
--- /dev/null
+++ b/gdk/macos/gdkmacostoplevelsurface-private.h
@@ -0,0 +1,44 @@
+/*
+ * 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_TOPLEVEL_SURFACE_PRIVATE_H__
+#define __GDK_MACOS_TOPLEVEL_SURFACE_PRIVATE_H__
+
+#include "gdkmacossurface-private.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GdkMacosToplevelSurface GdkMacosToplevelSurface;
+typedef struct _GdkMacosToplevelSurfaceClass GdkMacosToplevelSurfaceClass;
+
+#define GDK_TYPE_MACOS_TOPLEVEL_SURFACE (_gdk_macos_toplevel_surface_get_type())
+#define GDK_MACOS_TOPLEVEL_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
GDK_TYPE_MACOS_TOPLEVEL_SURFACE, GdkMacosToplevelSurface))
+#define GDK_IS_MACOS_TOPLEVEL_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object),
GDK_TYPE_MACOS_TOPLEVEL_SURFACE))
+
+GType _gdk_macos_toplevel_surface_get_type (void);
+GdkMacosSurface *_gdk_macos_toplevel_surface_new (GdkMacosDisplay *display,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height);
+
+G_END_DECLS
+
+#endif /* __GDK_MACOS_TOPLEVEL_SURFACE_PRIVATE_H__ */
diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c
new file mode 100644
index 0000000000..a260e21a88
--- /dev/null
+++ b/gdk/macos/gdkmacostoplevelsurface.c
@@ -0,0 +1,74 @@
+/*
+ * 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 "gdktoplevelprivate.h"
+
+#include "gdkmacostoplevelsurface-private.h"
+
+struct _GdkMacosToplevelSurface
+{
+ GdkMacosSurface parent_instance;
+};
+
+static void
+toplevel_iface_init (GdkToplevelInterface *iface)
+{
+}
+
+G_DEFINE_TYPE_WITH_CODE (GdkMacosToplevelSurface, _gdk_macos_toplevel_surface, GDK_TYPE_MACOS_SURFACE,
+ G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL, toplevel_iface_init))
+
+static void
+_gdk_macos_toplevel_surface_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (_gdk_macos_toplevel_surface_parent_class)->finalize (object);
+}
+
+static void
+_gdk_macos_toplevel_surface_class_init (GdkMacosToplevelSurfaceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = _gdk_macos_toplevel_surface_finalize;
+
+ gdk_toplevel_install_properties (object_class, 1);
+}
+
+static void
+_gdk_macos_toplevel_surface_init (Gdkmacostoplevelsurface *self)
+{
+}
+
+GdkMacosSurface *
+_gdk_macos_toplevel_surface_new (GdkMacosDisplay *display,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (display), NULL);
+ g_return_val_if_fail (!parent || GDK_IS_MACOS_SURFACE (parent), NULL);
+
+ return g_object_new (GDK_TYPE_MACOS_TOPLEVEL_SURFACE,
+ "display", display,
+ NULL);
+}
diff --git a/gdk/macos/meson.build b/gdk/macos/meson.build
index 8a43f3375d..c46a7bfced 100644
--- a/gdk/macos/meson.build
+++ b/gdk/macos/meson.build
@@ -1,35 +1,25 @@
gdk_macos_sources = files([
+ 'GdkMacosWindow.c',
'gdkmacosdevice.c',
'gdkmacosdisplay.c',
+ 'gdkmacosdragsurface.c',
'gdkmacoseventsource.c',
'gdkmacoskeymap.c',
'gdkmacosmonitor.c',
+ 'gdkmacospopupsurface.c',
'gdkmacosseat.c',
'gdkmacossurface.c',
- # 'GdkMacosView.c',
- 'GdkMacosWindow.c',
+ 'gdkmacostoplevelsurface.c',
- # 'gdkapplaunchcontext-macos.c',
- # 'gdkcairocontext-macos.c',
- # 'gdkclipboard-macos.c',
- # 'gdkcursor-macos.c',
- # 'gdkdevice-macos.c',
- # 'gdkdrag-macos.c',
- # 'gdkdrop-macos.c',
- # 'gdkeventsource.c',
- # 'gdkglcontext-macos.c',
- # 'gdkkeys-macos.c',
- # 'gdkprimary-macos.c',
- # 'gdksurface-macos.c',
+ # 'GdkMacosView.c',
])
gdk_macos_public_headers = files([
+ 'gdkmacosdevice.h',
'gdkmacosdisplay.h',
- 'gdkmacosmonitor.h',
'gdkmacoskeymap.h',
-
- # 'gdkmacosdevice.h',
- # 'gdkmacosglcontext.h',
+ 'gdkmacosmonitor.h',
+ 'gdkmacossurface.h',
])
install_headers(gdk_macos_public_headers, 'gdkmacos.h', subdir: 'gtk-4.0/gdk/macos/')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]