Commit 813e9c95 authored by Benjamin Otte's avatar Benjamin Otte

gdk: Add Cairo context implementations for all backends

And make the GdkCairoContext as abstract.

The idea of this and thje following commits is to get rid of all
Cairo code in gdksurface.c (and $backend/gdksurface-$backend.c)
by moving that code into the Cairo context files.
In particular, the GdkSurfaceClass.begin_frame/end_frame()
functions (which are currently exclusively used by the Cairo code
should end up being moved to GdkDrawContextClass.begin/end_frame().

This has multiple benefits:

1. It unifies code between the different drawing contexts.
   GL lives in GLContext, Vulkan in VulkanContext and Cairo in
   CairoContext. In turn, this makes it way easier to reason about
   what's going on in surface-specific code. Currently pretty much
   all backends do things wrong when they want to sync to drawing
   or to the frame clock.

2. It makes the API of GdkSurface smaller. No drawing code (apart
   from creating the contexts) needs to remain.

3. It confines Cairo to the Drawcontext, thereby making it way
   more obvious when backends are still using it in situations
   where it may now conflict with OpenGL (like when doing the dnd
   failed animation or in the APIs that I'm removing in this
   branch).

4. We have 2 very different types of Cairo contexts: The X/win32
   model, where we have a natively supported Cairo backend but do
   double buffering ourselves and use similar surfaces and the
   Wayland/Broadway model where we use image surfaces without any
   Cairo backend support and have to submit the buffers manually.
   By not sharing code between those 2 versions, we can make the
   actual code way smaller. We also get around the need to create
   1x1 image surfaces in the Wayland backend where we pretend
   there's a native Cairo surface.
parent a83487a0
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkconfig.h"
#include "gdkcairocontext-broadway.h"
G_DEFINE_TYPE (GdkBroadwayCairoContext, gdk_broadway_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
static void
gdk_broadway_cairo_context_class_init (GdkBroadwayCairoContextClass *klass)
{
}
static void
gdk_broadway_cairo_context_init (GdkBroadwayCairoContext *self)
{
}
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_BROADWAY_CAIRO_CONTEXT__
#define __GDK_BROADWAY_CAIRO_CONTEXT__
#include "gdkconfig.h"
#include "gdkcairocontextprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_BROADWAY_CAIRO_CONTEXT (gdk_broadway_cairo_context_get_type ())
#define GDK_BROADWAY_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_BROADWAY_CAIRO_CONTEXT, GdkBroadwayCairoContext))
#define GDK_IS_BROADWAY_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_BROADWAY_CAIRO_CONTEXT))
#define GDK_BROADWAY_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_CAIRO_CONTEXT, GdkBroadwayCairoContextClass))
#define GDK_IS_BROADWAY_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_CAIRO_CONTEXT))
#define GDK_BROADWAY_CAIRO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_CAIRO_CONTEXT, GdkBroadwayCairoContextClass))
typedef struct _GdkBroadwayCairoContext GdkBroadwayCairoContext;
typedef struct _GdkBroadwayCairoContextClass GdkBroadwayCairoContextClass;
struct _GdkBroadwayCairoContext
{
GdkCairoContext parent_instance;
};
struct _GdkBroadwayCairoContextClass
{
GdkCairoContextClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gdk_broadway_cairo_context_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_BROADWAY_CAIRO_CONTEXT__ */
......@@ -24,6 +24,7 @@
#include "gdkdisplay-broadway.h"
#include "gdkcairocontext-broadway.h"
#include "gdkdisplay.h"
#include "gdkeventsource.h"
#include "gdkmonitor-broadway.h"
......@@ -521,6 +522,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
object_class->finalize = gdk_broadway_display_finalize;
display_class->surface_type = GDK_TYPE_BROADWAY_SURFACE;
display_class->cairo_context_type = GDK_TYPE_BROADWAY_CAIRO_CONTEXT;
display_class->get_name = gdk_broadway_display_get_name;
display_class->beep = gdk_broadway_display_beep;
......
......@@ -3,6 +3,7 @@ gdk_broadway_sources = files([
'broadway-server.c',
'broadwayd.c',
'gdkbroadway-server.c',
'gdkcairocontext-broadway.c',
'gdkcursor-broadway.c',
'gdkdevice-broadway.c',
'gdkdisplay-broadway.c',
......
......@@ -53,8 +53,8 @@ struct _GdkCairoContextPrivate {
gpointer unused;
};
G_DEFINE_TYPE_WITH_CODE (GdkCairoContext, gdk_cairo_context, GDK_TYPE_DRAW_CONTEXT,
G_ADD_PRIVATE (GdkCairoContext))
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkCairoContext, gdk_cairo_context, GDK_TYPE_DRAW_CONTEXT,
G_ADD_PRIVATE (GdkCairoContext))
static cairo_surface_t *
gdk_surface_ref_impl_surface (GdkSurface *surface)
......
......@@ -114,7 +114,8 @@ struct _GdkDisplayClass
{
GObjectClass parent_class;
GType surface_type; /* type for native surfaces for this display, set in class_init */
GType surface_type; /* type for native surfaces for this display, set in class_init */
GType cairo_context_type; /* type for GdkCairoContext, must be set */
GType vk_context_type; /* type for GdkVulkanContext, must be set if vk_extension_name != NULL */
const char *vk_extension_name; /* Name of required windowing vulkan extension or %NULL (default) if Vulkan isn't supported */
......
......@@ -1483,10 +1483,24 @@ gdk_surface_create_gl_context (GdkSurface *surface,
error);
}
/**
* gdk_surface_create_cairo_context:
* @surface: a #GdkSurface
*
* Creates a new #GdkCairoContext for rendering on @surface.
*
* Returns: (transfer full): the newly created #GdkCairoContext
**/
GdkCairoContext *
gdk_surface_create_cairo_context (GdkSurface *surface)
{
return g_object_new (GDK_TYPE_CAIRO_CONTEXT,
GdkDisplay *display;
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
display = gdk_surface_get_display (surface);
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->cairo_context_type,
"surface", surface,
NULL);
}
......
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkconfig.h"
#include "gdkcairocontext-quartz.h"
G_DEFINE_TYPE (GdkQuartzCairoContext, gdk_quartz_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
static void
gdk_quartz_cairo_context_class_init (GdkQuartzCairoContextClass *klass)
{
}
static void
gdk_quartz_cairo_context_init (GdkQuartzCairoContext *self)
{
}
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_CAIRO_CONTEXT__
#define __GDK_QUARTZ_CAIRO_CONTEXT__
#include "gdkconfig.h"
#include "gdkcairocontextprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_QUARTZ_CAIRO_CONTEXT (gdk_quartz_cairo_context_get_type ())
#define GDK_QUARTZ_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_QUARTZ_CAIRO_CONTEXT, GdkQuartzCairoContext))
#define GDK_IS_QUARTZ_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_QUARTZ_CAIRO_CONTEXT))
#define GDK_QUARTZ_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_CAIRO_CONTEXT, GdkQuartzCairoContextClass))
#define GDK_IS_QUARTZ_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_CAIRO_CONTEXT))
#define GDK_QUARTZ_CAIRO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_CAIRO_CONTEXT, GdkQuartzCairoContextClass))
typedef struct _GdkQuartzCairoContext GdkQuartzCairoContext;
typedef struct _GdkQuartzCairoContextClass GdkQuartzCairoContextClass;
struct _GdkQuartzCairoContext
{
GdkCairoContext parent_instance;
};
struct _GdkQuartzCairoContextClass
{
GdkCairoContextClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gdk_quartz_cairo_context_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_QUARTZ_CAIRO_CONTEXT__ */
......@@ -28,6 +28,7 @@
#include "gdkquartzdevicemanager-core.h"
#include "gdkmonitorprivate.h"
#include "gdkdisplay-quartz.h"
#include "gdkcairocontext-quartz.h"
static GdkSurface *
......@@ -216,6 +217,7 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
object_class->dispose = gdk_quartz_display_dispose;
display_class->surface_type = GDK_TYPE_QUARTZ_SURFACE;
display_class->cairo_context_type = GDK_TYPE_QUARTZ_CAIRO_CONTEXT;
display_class->get_name = gdk_quartz_display_get_name;
display_class->beep = gdk_quartz_display_beep;
......
......@@ -2,6 +2,7 @@
gdk_quartz_sources = files([
'GdkQuartzView.c',
'GdkQuartzNSWindow.c',
'gdkcairocontext-quartz.c',
'gdkcursor-quartz.c',
'gdkdevice-core-quartz.c',
'gdkdevicemanager-core-quartz.c',
......
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkconfig.h"
#include "gdkcairocontext-wayland.h"
G_DEFINE_TYPE (GdkWaylandCairoContext, gdk_wayland_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
static void
gdk_wayland_cairo_context_class_init (GdkWaylandCairoContextClass *klass)
{
}
static void
gdk_wayland_cairo_context_init (GdkWaylandCairoContext *self)
{
}
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_WAYLAND_CAIRO_CONTEXT__
#define __GDK_WAYLAND_CAIRO_CONTEXT__
#include "gdkconfig.h"
#include "gdkcairocontextprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_WAYLAND_CAIRO_CONTEXT (gdk_wayland_cairo_context_get_type ())
#define GDK_WAYLAND_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WAYLAND_CAIRO_CONTEXT, GdkWaylandCairoContext))
#define GDK_IS_WAYLAND_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WAYLAND_CAIRO_CONTEXT))
#define GDK_WAYLAND_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_CAIRO_CONTEXT, GdkWaylandCairoContextClass))
#define GDK_IS_WAYLAND_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_CAIRO_CONTEXT))
#define GDK_WAYLAND_CAIRO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_CAIRO_CONTEXT, GdkWaylandCairoContextClass))
typedef struct _GdkWaylandCairoContext GdkWaylandCairoContext;
typedef struct _GdkWaylandCairoContextClass GdkWaylandCairoContextClass;
struct _GdkWaylandCairoContext
{
GdkCairoContext parent_instance;
};
struct _GdkWaylandCairoContextClass
{
GdkCairoContextClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_cairo_context_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_WAYLAND_CAIRO_CONTEXT__ */
......@@ -42,6 +42,7 @@
#include "gdkdeviceprivate.h"
#include "gdkkeysprivate.h"
#include "gdkprivate-wayland.h"
#include "gdkcairocontext-wayland.h"
#include "gdkglcontext-wayland.h"
#include "gdkvulkancontext-wayland.h"
#include "gdkwaylandmonitor.h"
......@@ -954,6 +955,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
object_class->finalize = gdk_wayland_display_finalize;
display_class->surface_type = gdk_wayland_surface_get_type ();
display_class->cairo_context_type = GDK_TYPE_WAYLAND_CAIRO_CONTEXT;
#ifdef GDK_RENDERING_VULKAN
display_class->vk_context_type = GDK_TYPE_WAYLAND_VULKAN_CONTEXT;
......
gdk_wayland_sources = files([
'gdkapplaunchcontext-wayland.c',
'gdkcairocontext-wayland.c',
'gdkclipboard-wayland.c',
'gdkcursor-wayland.c',
'gdkdevice-wayland.c',
......
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkconfig.h"
#include "gdkcairocontext-win32.h"
G_DEFINE_TYPE (GdkWin32CairoContext, gdk_win32_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
static void
gdk_win32_cairo_context_class_init (GdkWin32CairoContextClass *klass)
{
}
static void
gdk_win32_cairo_context_init (GdkWin32CairoContext *self)
{
}
/* GDK - The GIMP Drawing Kit
*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_WIN32_CAIRO_CONTEXT__
#define __GDK_WIN32_CAIRO_CONTEXT__
#include "gdkconfig.h"
#include "gdkcairocontextprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_WIN32_CAIRO_CONTEXT (gdk_win32_cairo_context_get_type ())
#define GDK_WIN32_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WIN32_CAIRO_CONTEXT, GdkWin32CairoContext))
#define GDK_IS_WIN32_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WIN32_CAIRO_CONTEXT))
#define GDK_WIN32_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_CAIRO_CONTEXT, GdkWin32CairoContextClass))
#define GDK_IS_WIN32_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_CAIRO_CONTEXT))
#define GDK_WIN32_CAIRO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_CAIRO_CONTEXT, GdkWin32CairoContextClass))
typedef struct _GdkWin32CairoContext GdkWin32CairoContext;
typedef struct _GdkWin32CairoContextClass GdkWin32CairoContextClass;
struct _GdkWin32CairoContext
{
GdkCairoContext parent_instance;
};
struct _GdkWin32CairoContextClass
{
GdkCairoContextClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gdk_win32_cairo_context_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_WIN32_CAIRO_CONTEXT__ */
......@@ -23,6 +23,7 @@
#include "gdk.h"
#include "gdkprivate-win32.h"
#include "gdkcairocontext-win32.h"
#include "gdkclipboardprivate.h"
#include "gdkclipboard-win32.h"
#include "gdkdisplay-win32.h"
......@@ -1090,6 +1091,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
object_class->finalize = gdk_win32_display_finalize;
display_class->surface_type = GDK_TYPE_WIN32_SURFACE;
display_class->cairo_context_type = GDK_TYPE_WIN32_CAIRO_CONTEXT;
display_class->get_name = gdk_win32_display_get_name;
display_class->beep = gdk_win32_display_beep;
......
gdk_win32_sources = files([
'gdkcairocontext-win32.c',
'gdkcursor-win32.c',
'gdkclipboard-win32.c',
'gdkclipdrop-win32.c',
......
/* GDK - The GIMP Drawing Kit
*
* gdkcairocontext-x11.c: X11 specific Cairo wrappers
*
* Copyright © 2016 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkconfig.h"
#include "gdkcairocontext-x11.h"
G_DEFINE_TYPE (GdkX11CairoContext, gdk_x11_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
static void
gdk_x11_cairo_context_class_init (GdkX11CairoContextClass *klass)
{
}
static void
gdk_x11_cairo_context_init (GdkX11CairoContext *self)
{
}
/* GDK - The GIMP Drawing Kit
*
* gdkcairocontext-x11.h: X11 specific Cairo wrappers
*
* Copyright © 2016 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_CAIRO_CONTEXT__
#define __GDK_X11_CAIRO_CONTEXT__
#include "gdkconfig.h"
#include "gdkcairocontextprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_X11_CAIRO_CONTEXT (gdk_x11_cairo_context_get_type ())
#define GDK_X11_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_X11_CAIRO_CONTEXT, GdkX11CairoContext))
#define GDK_IS_X11_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_X11_CAIRO_CONTEXT))
#define GDK_X11_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_CAIRO_CONTEXT, GdkX11CairoContextClass))
#define GDK_IS_X11_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_CAIRO_CONTEXT))
#define GDK_X11_CAIRO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_CAIRO_CONTEXT, GdkX11CairoContextClass))
typedef struct _GdkX11CairoContext GdkX11CairoContext;
typedef struct _GdkX11CairoContextClass GdkX11CairoContextClass;
struct _GdkX11CairoContext
{
GdkCairoContext parent_instance;
};
struct _GdkX11CairoContextClass
{
GdkCairoContextClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gdk_x11_cairo_context_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_X11_CAIRO_CONTEXT__ */
......@@ -40,6 +40,7 @@
#include "gdkclipboard-x11.h"
#include "gdkprivate-x11.h"
#include "gdkscreen-x11.h"
#include "gdkcairocontext-x11.h"
#include "gdkglcontext-x11.h"
#include "gdkvulkancontext-x11.h"
#include "gdk-private.h"
......@@ -3032,6 +3033,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
object_class->finalize = gdk_x11_display_finalize;
display_class->surface_type = GDK_TYPE_X11_SURFACE;
display_class->cairo_context_type = GDK_TYPE_X11_CAIRO_CONTEXT;
#ifdef GDK_RENDERING_VULKAN
display_class->vk_context_type = GDK_TYPE_X11_VULKAN_CONTEXT;
display_class->vk_extension_name = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
......
......@@ -2,6 +2,7 @@
gdk_x11_sources = files([
'gdkapplaunchcontext-x11.c',
'gdkasync.c',
'gdkcairocontext-x11.c',
'gdkclipboard-x11.c',
'gdkcursor-x11.c',
'gdkdevice-core-x11.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment