summaryrefslogtreecommitdiff
path: root/gdk/quartz
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-20 07:16:32 +0100
committerBenjamin Otte <otte@redhat.com>2016-11-20 07:19:52 +0100
commitcb18752f94c33f3b5886faa472a11bad872923a2 (patch)
treede17319284070404e34b3ec086fe7ae61d29c794 /gdk/quartz
parent1912d992d88f4c9e02207329b73c3474dd72817d (diff)
downloadgtk+-cb18752f94c33f3b5886faa472a11bad872923a2.tar.gz
gdk: Make each backend have a custom GdkDrawingContext subclass
Diffstat (limited to 'gdk/quartz')
-rw-r--r--gdk/quartz/Makefile.am2
-rw-r--r--gdk/quartz/gdkdrawingcontext-quartz.c33
-rw-r--r--gdk/quartz/gdkdrawingcontext-quartz.h48
-rw-r--r--gdk/quartz/gdkwindow-quartz.c12
4 files changed, 95 insertions, 0 deletions
diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am
index eda5263f72..ba5e8d20fd 100644
--- a/gdk/quartz/Makefile.am
+++ b/gdk/quartz/Makefile.am
@@ -30,6 +30,8 @@ libgdk_quartz_la_SOURCES = \
gdkdevicemanager-core-quartz.h \
gdkdisplay-quartz.c \
gdkdisplaymanager-quartz.c \
+ gdkdrawingcontext-quartz.c \
+ gdkdrawingcontext-quartz.h \
gdkdnd-quartz.c \
gdkdnd-quartz.h \
gdkevents-quartz.c \
diff --git a/gdk/quartz/gdkdrawingcontext-quartz.c b/gdk/quartz/gdkdrawingcontext-quartz.c
new file mode 100644
index 0000000000..1e30ed7e23
--- /dev/null
+++ b/gdk/quartz/gdkdrawingcontext-quartz.c
@@ -0,0 +1,33 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright 2016 Benjamin Otte <otte@gnome.org>
+ *
+ * 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 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/>.
+ */
+
+#include "config.h"
+
+#include "gdkdrawingcontext-quartz.h"
+
+G_DEFINE_TYPE (GdkQuartzDrawingContext, gdk_quartz_drawing_context, GDK_TYPE_DRAWING_CONTEXT)
+
+static void
+gdk_quartz_drawing_context_class_init (GdkQuartzDrawingContextClass *klass)
+{
+}
+
+static void
+gdk_quartz_drawing_context_init (GdkQuartzDrawingContext *self)
+{
+}
+
diff --git a/gdk/quartz/gdkdrawingcontext-quartz.h b/gdk/quartz/gdkdrawingcontext-quartz.h
new file mode 100644
index 0000000000..55c9d69cb9
--- /dev/null
+++ b/gdk/quartz/gdkdrawingcontext-quartz.h
@@ -0,0 +1,48 @@
+/* GDK - The GIMP Drawing Kit
+ *
+ * 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 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/>.
+ */
+
+#ifndef __GDK_QUARTZ_DRAWING_CONTEXT_H__
+#define __GDK_QUARTZ_DRAWING_CONTEXT_H__
+
+#include "gdk/gdkdrawingcontextprivate.h"
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_DRAWING_CONTEXT (gdk_quartz_drawing_context_get_type ())
+#define GDK_QUARTZ_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_QUARTZ_DRAWING_CONTEXT, GdkQuartzDrawingContext))
+#define GDK_IS_QUARTZ_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_QUARTZ_DRAWING_CONTEXT))
+#define GDK_QUARTZ_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_DRAWING_CONTEXT, GdkQuartzDrawingContextClass))
+#define GDK_IS_QUARTZ_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_DRAWING_CONTEXT))
+#define GDK_QUARTZ_DRAWING_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_DRAWING_CONTEXT, GdkQuartzDrawingContextClass))
+
+typedef struct _GdkQuartzDrawingContext GdkQuartzDrawingContext;
+typedef struct _GdkQuartzDrawingContextClass GdkQuartzDrawingContextClass;
+
+struct _GdkQuartzDrawingContext
+{
+ GdkDrawingContext parent_instance;
+};
+
+struct _GdkQuartzDrawingContextClass
+{
+ GdkDrawingContextClass parent_instance;
+};
+
+GType gdk_quartz_drawing_context_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DRAWING_CONTEXT_H__ */
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 9349537135..1c548cc787 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -25,6 +25,7 @@
#include "gdkwindowimpl.h"
#include "gdkprivate-quartz.h"
+#include "gdkdrawingcontext-quartz.h"
#include "gdkglcontext-quartz.h"
#include "gdkquartzscreen.h"
#include "gdkquartzcursor.h"
@@ -2825,6 +2826,16 @@ gdk_quartz_window_get_scale_factor (GdkWindow *window)
return 1;
}
+static GdkDrawingContext *
+gdk_quartz_window_create_draw_context (GdkWindow *window,
+ const cairo_region_t *region)
+{
+ return g_object_new (GDK_TYPE_QUARTZ_DRAWING_CONTEXT,
+ "window", window,
+ "clip", region,
+ NULL);
+}
+
static void
gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
{
@@ -2909,6 +2920,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->delete_property = _gdk_quartz_window_delete_property;
impl_class->create_gl_context = gdk_quartz_window_create_gl_context;
+ impl_class->create_draw_context = gdk_quartz_window_create_draw_context;
impl_quartz_class->get_context = gdk_window_impl_quartz_get_context;
impl_quartz_class->release_context = gdk_window_impl_quartz_release_context;