summaryrefslogtreecommitdiff
path: root/gdk/win32
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/win32
parent1912d992d88f4c9e02207329b73c3474dd72817d (diff)
downloadgtk+-cb18752f94c33f3b5886faa472a11bad872923a2.tar.gz
gdk: Make each backend have a custom GdkDrawingContext subclass
Diffstat (limited to 'gdk/win32')
-rw-r--r--gdk/win32/Makefile.am2
-rw-r--r--gdk/win32/gdkdrawingcontext-win32.c33
-rw-r--r--gdk/win32/gdkdrawingcontext-win32.h48
-rw-r--r--gdk/win32/gdkwindow-win32.c12
4 files changed, 95 insertions, 0 deletions
diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am
index ebd4ae6f9f..eb76bbcf5a 100644
--- a/gdk/win32/Makefile.am
+++ b/gdk/win32/Makefile.am
@@ -40,6 +40,8 @@ libgdk_win32_la_SOURCES = \
gdkdisplay-win32.c \
gdkdisplay-win32.h \
gdkdisplaymanager-win32.c \
+ gdkdrawingcontext-win32.c \
+ gdkdrawingcontext-win32.h \
gdkdnd-win32.c \
gdkevents-win32.c \
gdkgeometry-win32.c \
diff --git a/gdk/win32/gdkdrawingcontext-win32.c b/gdk/win32/gdkdrawingcontext-win32.c
new file mode 100644
index 0000000000..6938422444
--- /dev/null
+++ b/gdk/win32/gdkdrawingcontext-win32.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-win32.h"
+
+G_DEFINE_TYPE (GdkWin32DrawingContext, gdk_win32_drawing_context, GDK_TYPE_DRAWING_CONTEXT)
+
+static void
+gdk_win32_drawing_context_class_init (GdkWin32DrawingContextClass *klass)
+{
+}
+
+static void
+gdk_win32_drawing_context_init (GdkWin32DrawingContext *self)
+{
+}
+
diff --git a/gdk/win32/gdkdrawingcontext-win32.h b/gdk/win32/gdkdrawingcontext-win32.h
new file mode 100644
index 0000000000..fe6fa45c32
--- /dev/null
+++ b/gdk/win32/gdkdrawingcontext-win32.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_WIN32_DRAWING_CONTEXT_H__
+#define __GDK_WIN32_DRAWING_CONTEXT_H__
+
+#include "gdk/gdkdrawingcontextprivate.h"
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_WIN32_DRAWING_CONTEXT (gdk_win32_drawing_context_get_type ())
+#define GDK_WIN32_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WIN32_DRAWING_CONTEXT, GdkWin32DrawingContext))
+#define GDK_IS_WIN32_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WIN32_DRAWING_CONTEXT))
+#define GDK_WIN32_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAWING_CONTEXT, GdkWin32DrawingContextClass))
+#define GDK_IS_WIN32_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAWING_CONTEXT))
+#define GDK_WIN32_DRAWING_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAWING_CONTEXT, GdkWin32DrawingContextClass))
+
+typedef struct _GdkWin32DrawingContext GdkWin32DrawingContext;
+typedef struct _GdkWin32DrawingContextClass GdkWin32DrawingContextClass;
+
+struct _GdkWin32DrawingContext
+{
+ GdkDrawingContext parent_instance;
+};
+
+struct _GdkWin32DrawingContextClass
+{
+ GdkDrawingContextClass parent_instance;
+};
+
+GType gdk_win32_drawing_context_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_DRAWING_CONTEXT_H__ */
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index cddd9ef1b5..84e0d7ddb9 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -41,6 +41,7 @@
#include "gdkwin32window.h"
#include "gdkglcontext-win32.h"
#include "gdkdisplay-win32.h"
+#include "gdkdrawingcontext-win32.h"
#include <cairo-win32.h>
#include <dwmapi.h>
@@ -6025,6 +6026,16 @@ _gdk_win32_window_get_unscaled_size (GdkWindow *window,
*unscaled_height = impl->unscaled_height;
}
+static GdkDrawingContext *
+gdk_win32_window_create_draw_context (GdkWindow *window,
+ const cairo_region_t *region)
+{
+ return g_object_new (GDK_TYPE_WIN32_DRAWING_CONTEXT,
+ "window", window,
+ "clip", region,
+ NULL);
+}
+
static void
gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
{
@@ -6114,6 +6125,7 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
impl_class->change_property = _gdk_win32_window_change_property;
impl_class->delete_property = _gdk_win32_window_delete_property;
impl_class->create_gl_context = _gdk_win32_window_create_gl_context;
+ impl_class->create_draw_context = _gdk_win32_window_create_draw_context;
impl_class->invalidate_for_new_frame = _gdk_win32_window_invalidate_for_new_frame;
impl_class->get_scale_factor = _gdk_win32_window_get_scale_factor;
impl_class->get_unscaled_size = _gdk_win32_window_get_unscaled_size;