[gtk/wip/otte/nodeeditor2: 56/59] gsk: Export gsk_broadway_renderer_new()



commit b95e0d69e3a8465200250896e99598236547324a
Author: Benjamin Otte <otte redhat com>
Date:   Thu May 2 02:46:23 2019 +0200

    gsk: Export gsk_broadway_renderer_new()
    
    ... when broadway is enabled.

 docs/reference/gsk/gsk4-sections.txt      |  1 +
 gsk/broadway/gskbroadwayrenderer.c        | 23 +++++++++++++-
 gsk/broadway/gskbroadwayrenderer.h        | 52 +++++++++++++++++++++++++++++++
 gsk/broadway/gskbroadwayrendererprivate.h | 24 --------------
 gsk/gsk.h                                 |  1 +
 gsk/gskrenderer.c                         |  2 +-
 gsk/meson.build                           |  3 +-
 7 files changed, 79 insertions(+), 27 deletions(-)
---
diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt
index f37c5c3b2e..3573f8cb31 100644
--- a/docs/reference/gsk/gsk4-sections.txt
+++ b/docs/reference/gsk/gsk4-sections.txt
@@ -10,6 +10,7 @@ gsk_renderer_render_texture
 gsk_renderer_new_for_surface
 gsk_gl_renderer_new
 gsk_cairo_renderer_new
+gsk_broadway_renderer_new
 <SUBSECTION Standard>
 GSK_IS_RENDERER
 GSK_RENDERER
diff --git a/gsk/broadway/gskbroadwayrenderer.c b/gsk/broadway/gskbroadwayrenderer.c
index 594c2cba8c..662ee64934 100644
--- a/gsk/broadway/gskbroadwayrenderer.c
+++ b/gsk/broadway/gskbroadwayrenderer.c
@@ -1,6 +1,7 @@
 #include "config.h"
 
-#include "gskbroadwayrendererprivate.h"
+#include "gskbroadwayrenderer.h"
+
 #include "broadway/gdkprivate-broadway.h"
 
 #include "gskdebugprivate.h"
@@ -827,3 +828,23 @@ static void
 gsk_broadway_renderer_init (GskBroadwayRenderer *self)
 {
 }
+
+/**
+ * gsk_broadway_renderer_new:
+ *
+ * Creates a new Broadway renderer.
+ *
+ * The Broadway renderer is the default renderer for the broadway backend.
+ * It will only work with broadway surfaces, otherwise it will fail the
+ * call to gdk_renderer_realize().
+ *
+ * This function is only available when GTK was compiled with Broadway
+ * support.
+ *
+ * Returns: a new Broadway renderer.
+ **/
+GskRenderer *
+gsk_broadway_renderer_new (void)
+{
+  return g_object_new (GSK_TYPE_BROADWAY_RENDERER, NULL);
+}
diff --git a/gsk/broadway/gskbroadwayrenderer.h b/gsk/broadway/gskbroadwayrenderer.h
new file mode 100644
index 0000000000..9e8d3dbe0b
--- /dev/null
+++ b/gsk/broadway/gskbroadwayrenderer.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2019  Alexander Larsson
+ *
+ * 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/>.
+ */
+
+#ifndef __GSK_BROADWAY_RENDERER_H__
+#define __GSK_BROADWAY_RENDERER_H__
+
+#include <gdk/gdk.h>
+#include <gsk/gskrenderer.h>
+
+#ifdef GDK_WINDOWING_BROADWAY
+
+#include <gdk/broadway/gdkbroadway.h>
+
+G_BEGIN_DECLS
+
+#define GSK_TYPE_BROADWAY_RENDERER (gsk_broadway_renderer_get_type ())
+
+#define GSK_BROADWAY_RENDERER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRenderer))
+#define GSK_IS_BROADWAY_RENDERER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GSK_TYPE_BROADWAY_RENDERER))
+#define GSK_BROADWAY_RENDERER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), 
GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRendererClass))
+#define GSK_IS_BROADWAY_RENDERER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GSK_TYPE_BROADWAY_RENDERER))
+#define GSK_BROADWAY_RENDERER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRendererClass))
+
+typedef struct _GskBroadwayRenderer                GskBroadwayRenderer;
+typedef struct _GskBroadwayRendererClass           GskBroadwayRendererClass;
+
+
+GDK_AVAILABLE_IN_ALL
+GType                   gsk_broadway_renderer_get_type          (void) G_GNUC_CONST;
+
+GDK_AVAILABLE_IN_ALL
+GskRenderer *           gsk_broadway_renderer_new               (void);
+
+G_END_DECLS
+
+#endif /* GDK_WINDOWING_BROADWAY */
+
+#endif /* __GSK_BROADWAY_RENDERER_H__ */
diff --git a/gsk/gsk.h b/gsk/gsk.h
index 5f0938b0e0..b8f6d58ee9 100644
--- a/gsk/gsk.h
+++ b/gsk/gsk.h
@@ -28,6 +28,7 @@
 
 #include <gsk/gskcairorenderer.h>
 #include <gsk/gl/gskglrenderer.h>
+#include <gsk/broadway/gskbroadwayrenderer.h>
 
 #include <gsk/gsktypes.h>
 #include <gsk/gskenumtypes.h>
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index b5b07f9707..73c3247b19 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -55,7 +55,7 @@
 #include <gdk/wayland/gdkwayland.h>
 #endif
 #ifdef GDK_WINDOWING_BROADWAY
-#include "broadway/gskbroadwayrendererprivate.h"
+#include "broadway/gskbroadwayrenderer.h"
 #endif
 #ifdef GDK_RENDERING_VULKAN
 #include "vulkan/gskvulkanrendererprivate.h"
diff --git a/gsk/meson.build b/gsk/meson.build
index dd9be5709d..2d59a4ed51 100644
--- a/gsk/meson.build
+++ b/gsk/meson.build
@@ -56,6 +56,7 @@ gsk_public_headers = files([
   'gsktransform.h',
   'gsktypes.h',
   'gsk-autocleanup.h',
+  'broadway/gskbroadwayrenderer.h',
   'gl/gskglrenderer.h'
 ])
 
@@ -100,7 +101,7 @@ if have_vulkan
 endif # have_vulkan
 
 if get_variable('broadway_enabled')
-  gsk_private_sources += files([
+  gsk_public_sources += files([
     'broadway/gskbroadwayrenderer.c',
   ])
 endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]