1 /* GDK - The GIMP Drawing Kit
2  *
3  * gdkglcontext-x11.h: Private X11 specific OpenGL wrappers
4  *
5  * Copyright © 2014  Emmanuele Bassi
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __GDK_X11_GL_CONTEXT__
22 #define __GDK_X11_GL_CONTEXT__
23 
24 #include "gdkx11glcontext.h"
25 
26 #include <X11/X.h>
27 #include <X11/Xlib.h>
28 
29 #ifdef HAVE_XDAMAGE
30 #include <X11/extensions/Xdamage.h>
31 #endif
32 
33 #include <epoxy/gl.h>
34 #include <epoxy/glx.h>
35 
36 #include "gdkglcontextprivate.h"
37 #include "gdkdisplay-x11.h"
38 #include "gdksurface.h"
39 #include "gdkinternals.h"
40 
41 G_BEGIN_DECLS
42 
43 #define GDK_X11_GL_CONTEXT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_GL_CONTEXT, GdkX11GLContextClass))
44 #define GDK_X11_GL_CONTEXT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_GL_CONTEXT, GdkX11GLContextClass))
45 #define GDK_X11_IS_GL_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_GL_CONTEXT))
46 
47 struct _GdkX11GLContext
48 {
49   GdkGLContext parent_instance;
50 };
51 
52 struct _GdkX11GLContextClass
53 {
54   GdkGLContextClass parent_class;
55 };
56 
57 /* GLX */
58 #define GDK_TYPE_X11_GL_CONTEXT_GLX     (gdk_x11_gl_context_glx_get_type())
59 #define GDK_X11_GL_CONTEXT_GLX(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_X11_GL_CONTEXT_GLX, GdkX11GLContextGLX))
60 #define GDK_IS_X11_GL_CONTEXT_GLX(obj)  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_X11_GL_CONTEXT_GLX))
61 
62 typedef struct _GdkX11GLContextGLX      GdkX11GLContextGLX;
63 
64 gboolean                gdk_x11_display_init_glx                (GdkX11Display *display_x11,
65                                                                  Visual       **out_visual,
66                                                                  int           *out_depth,
67                                                                  GError       **error);
68 void                    gdk_x11_surface_destroy_glx_drawable    (GdkX11Surface *self);
69 
70 GType                   gdk_x11_gl_context_glx_get_type         (void) G_GNUC_CONST;
71 
72 
73 /* EGL */
74 #define GDK_TYPE_X11_GL_CONTEXT_EGL     (gdk_x11_gl_context_egl_get_type())
75 #define GDK_X11_GL_CONTEXT_EGL(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_X11_GL_CONTEXT_EGL, GdkX11GLContextEGL))
76 #define GDK_IS_X11_GL_CONTEXT_EGL(obj)  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_X11_GL_CONTEXT_EGL))
77 
78 typedef struct _GdkX11GLContextEGL      GdkX11GLContextEGL;
79 
80 gboolean                gdk_x11_display_init_egl                (GdkX11Display *display_x11,
81                                                                  gboolean       force,
82                                                                  Visual       **out_visual,
83                                                                  int           *out_depth,
84                                                                  GError       **error);
85 void                    gdk_x11_surface_destroy_egl_surface     (GdkX11Surface *self);
86 
87 GType                   gdk_x11_gl_context_egl_get_type         (void) G_GNUC_CONST;
88 
89 G_END_DECLS
90 
91 #endif /* __GDK_X11_GL_CONTEXT__ */
92