blob: e5a67d098e7b03d8ede929fab59f463cad250db3 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 9e243474eea4330b593e0f6dd418b61b79699d8b Mon Sep 17 00:00:00 2001
Patrick Williamsc0f7c042017-02-23 20:41:17 -06002From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Tue, 21 Jun 2016 15:11:39 +0300
Brad Bishop19323692019-04-05 15:28:33 -04004Subject: [PATCH] Add --disable-opengl configure option
Patrick Williamsc0f7c042017-02-23 20:41:17 -06005
6--disable-opengl will remove the dependency on libepoxy and on the
7OpenGL APIs. This is useful for those who want to keep using gtk+3
8without the "opengl" distro feature.
9
10GtkGLArea is still part of the API (it just doesn't work) even when
11OpenGL is disabled. GdkX11GLContext was removed from the Gtk API
12completely: that object exposes GL API elements so it had to be at
13the very least modified.
14
15The patch is _not_ great from a maintenance point of view and
16modifying the library API is also a fairly nasty thing to do.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017Next long term release (4.0) will require alternative solutions
18as it actually will depend on OpenGL.
Patrick Williamsc0f7c042017-02-23 20:41:17 -060019
20Upstream-Status: Inappropriate [Evil eye expected from upstream]
21Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -040022
Patrick Williamsc0f7c042017-02-23 20:41:17 -060023---
Brad Bishop19323692019-04-05 15:28:33 -040024 configure.ac | 13 ++++-
25 demos/gtk-demo/glarea.c | 14 ++++++
26 docs/tools/Makefile.am | 9 +++-
27 docs/tools/widgets.c | 4 +-
28 gdk/gdkdisplay.c | 4 +-
29 gdk/gdkgl.c | 10 ++++
30 gdk/gdkglcontext.c | 6 +++
31 gdk/gdkwindow.c | 13 +++++
32 gdk/x11/Makefile.am | 30 +++++++++--
33 gdk/x11/gdkdisplay-x11.c | 6 ++-
34 gdk/x11/gdkscreen-x11.c | 5 ++
35 gdk/x11/gdkwindow-x11.c | 4 ++
36 gdk/x11/gdkx-autocleanups.h | 2 +
Brad Bishop316dfdd2018-06-25 12:45:53 -040037 gdk/x11/{gdkx.h => gdkx-with-gl-context.h} | 1 -
Brad Bishop19323692019-04-05 15:28:33 -040038 gdk/x11/gdkx-without-gl-context.h | 58 ++++++++++++++++++++++
Brad Bishop316dfdd2018-06-25 12:45:53 -040039 gtk/Makefile.am | 3 +-
Brad Bishop19323692019-04-05 15:28:33 -040040 gtk/gtkglarea.c | 20 +++++++-
41 gtk/inspector/general.c | 6 +++
42 tests/Makefile.am | 10 ++--
43 testsuite/gtk/objects-finalize.c | 2 +
Brad Bishop316dfdd2018-06-25 12:45:53 -040044 20 files changed, 202 insertions(+), 18 deletions(-)
45 rename gdk/x11/{gdkx.h => gdkx-with-gl-context.h} (98%)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 create mode 100644 gdk/x11/gdkx-without-gl-context.h
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047
48diff --git a/configure.ac b/configure.ac
Brad Bishop19323692019-04-05 15:28:33 -040049index a91b29c..561d3b5 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050--- a/configure.ac
51+++ b/configure.ac
Brad Bishop316dfdd2018-06-25 12:45:53 -040052@@ -351,6 +351,15 @@ AC_ARG_ENABLE(cloudproviders,
53 [AS_HELP_STRING([--enable-cloudproviders],
54 [enable libcloudproviders integration])],
55 [cloudproviders_set=yes])
Patrick Williamsc0f7c042017-02-23 20:41:17 -060056+AC_ARG_ENABLE(opengl,
57+ [AS_HELP_STRING([--enable-opengl],
58+ [When enabled, Gtk+ will use libepoxy and exposes GtkGLArea widget ])])
59+AS_IF([test "x$enable_opengl" != "xno"], [
60+ AC_DEFINE([HAVE_OPENGL], [1], [libepoxy and opengl APIs are available at buildtime])
61+ EPOXY_PACKAGES="epoxy >= epoxy_required_version"
62+])
63+AM_CONDITIONAL([HAVE_OPENGL],[test "x$enable_opengl" != "xno"])
64+
65 AC_ARG_ENABLE(glx,
66 [AS_HELP_STRING([--enable-glx],
67 [When enabled Gdk will try to initialize GLX])])
Brad Bishop19323692019-04-05 15:28:33 -040068@@ -1381,7 +1390,7 @@ CFLAGS="$saved_cflags"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060069 LDFLAGS="$saved_ldflags"
70
71 GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version"
Brad Bishop316dfdd2018-06-25 12:45:53 -040072-GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $cairo_backends epoxy >= epoxy_required_version $CLOUDPROVIDER_PACKAGES"
73+GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $cairo_backends $EPOXY_PACKAGES $CLOUDPROVIDER_PACKAGES"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074
75 PKG_CHECK_MODULES(GDK_DEP, $GDK_PACKAGES $GDK_PRIVATE_PACKAGES)
76 GDK_DEP_LIBS="$GDK_EXTRA_LIBS $GDK_DEP_LIBS $MATH_LIB"
Brad Bishop19323692019-04-05 15:28:33 -040077@@ -1415,7 +1424,7 @@ fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060078 PKG_CHECK_MODULES(ATK, $ATK_PACKAGES)
79
80 GTK_PACKAGES="atk >= atk_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version gdk-pixbuf-2.0 >= gdk_pixbuf_required_version gio-2.0 >= glib_required_version"
81-GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES epoxy >= epoxy_required_version"
82+GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $EPOXY_PACKAGES"
83 if test "x$enable_x11_backend" = xyes -o "x$enable_wayland_backend" = xyes; then
84 GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
85 fi
86diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -050087index b51e4ae..82409c7 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -060088--- a/demos/gtk-demo/glarea.c
89+++ b/demos/gtk-demo/glarea.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -050090@@ -3,9 +3,12 @@
91 * GtkGLArea is a widget that allows custom drawing using OpenGL calls.
92 */
Patrick Williamsc0f7c042017-02-23 20:41:17 -060093
Brad Bishop6e60e8b2018-02-01 10:27:11 -050094+#include "config.h"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060095 #include <math.h>
96 #include <gtk/gtk.h>
97+#if HAVE_OPENGL
98 #include <epoxy/gl.h>
99+#endif
100
101 static GtkWidget *demo_window = NULL;
102
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500103@@ -23,6 +26,8 @@ enum {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600104 /* Rotation angles on each axis */
105 static float rotation_angles[N_AXIS] = { 0.0 };
106
107+#ifdef HAVE_OPENGL
108+
109 /* The object we are drawing */
110 static const GLfloat vertex_data[] = {
111 0.f, 0.5f, 0.f, 1.f,
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500112@@ -215,6 +220,7 @@ compute_mvp (float *res,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600113 static GLuint position_buffer;
114 static GLuint program;
115 static GLuint mvp_location;
116+#endif
117
118 /* We need to set up our state when we realize the GtkGLArea widget */
119 static void
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500120@@ -241,8 +247,10 @@ realize (GtkWidget *widget)
121 fragment_path = "/glarea/glarea-gl.fs.glsl";
122 }
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600123
124+#ifdef HAVE_OPENGL
125 init_buffers (&position_buffer, NULL);
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500126 init_shaders (vertex_path, fragment_path, &program, &mvp_location);
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600127+#endif
128 }
129
130 /* We should tear down the state when unrealizing */
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500131@@ -254,10 +262,13 @@ unrealize (GtkWidget *widget)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600132 if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
133 return;
134
135+#ifdef HAVE_OPENGL
136 glDeleteBuffers (1, &position_buffer);
137 glDeleteProgram (program);
138+#endif
139 }
140
141+#ifdef HAVE_OPENGL
142 static void
143 draw_triangle (void)
144 {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500145@@ -290,6 +301,7 @@ draw_triangle (void)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600146 glBindBuffer (GL_ARRAY_BUFFER, 0);
147 glUseProgram (0);
148 }
149+#endif
150
151 static gboolean
152 render (GtkGLArea *area,
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500153@@ -298,6 +310,7 @@ render (GtkGLArea *area,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600154 if (gtk_gl_area_get_error (area) != NULL)
155 return FALSE;
156
157+#ifdef HAVE_OPENGL
158 /* Clear the viewport */
159 glClearColor (0.5, 0.5, 0.5, 1.0);
160 glClear (GL_COLOR_BUFFER_BIT);
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500161@@ -307,6 +320,7 @@ render (GtkGLArea *area,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600162
163 /* Flush the contents of the pipeline */
164 glFlush ();
165+#endif
166
167 return TRUE;
168 }
169diff --git a/docs/tools/Makefile.am b/docs/tools/Makefile.am
170index 6a6d70f..5cdf312 100644
171--- a/docs/tools/Makefile.am
172+++ b/docs/tools/Makefile.am
173@@ -9,13 +9,18 @@ AM_CPPFLAGS = \
174 $(GTK_DEBUG_FLAGS) \
175 $(GTK_DEP_CFLAGS)
176
177+if HAVE_OPENGL
178+GEARS_LDADD = $(top_builddir)/tests/gtkgears.o
179+endif
180+
181 DEPS = \
182- $(top_builddir)/gtk/libgtk-3.la
183+ $(top_builddir)/gtk/libgtk-3.la \
184+ $(GEARS_LDADD)
185
186 LDADDS = \
187 $(top_builddir)/gtk/libgtk-3.la \
188 $(top_builddir)/gdk/libgdk-3.la \
189- $(top_builddir)/tests/gtkgears.o \
190+ $(GEARS_LDADD) \
191 $(GTK_DEP_LIBS) \
192 $(GDK_DEP_LIBS) \
193 -lm
194diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
195index 932daf1..54239d6 100644
196--- a/docs/tools/widgets.c
197+++ b/docs/tools/widgets.c
198@@ -1526,9 +1526,11 @@ create_gl_area (void)
199 widget = gtk_frame_new (NULL);
200 gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
201
202+#ifdef HAVE_OPENGL
203 gears = gtk_gears_new ();
204 gtk_container_add (GTK_CONTAINER (widget), gears);
205-
206+#endif
207+
208 info = new_widget_info ("glarea", widget, MEDIUM);
209
210 return info;
211diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400212index 40225e9..c55e1de 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600213--- a/gdk/gdkdisplay.c
214+++ b/gdk/gdkdisplay.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400215@@ -2406,7 +2406,9 @@ gboolean
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600216 gdk_display_make_gl_context_current (GdkDisplay *display,
217 GdkGLContext *context)
218 {
219- return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
220+ if (GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current)
221+ return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
222+ return FALSE;
223 }
224
225 GdkRenderingMode
226diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
Brad Bishop19323692019-04-05 15:28:33 -0400227index 933e204..1767508 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600228--- a/gdk/gdkgl.c
229+++ b/gdk/gdkgl.c
Brad Bishop19323692019-04-05 15:28:33 -0400230@@ -26,7 +26,9 @@
231 # include "win32/gdkwin32.h"
232 #endif
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600233
234+#ifdef HAVE_OPENGL
235 #include <epoxy/gl.h>
236+#endif
237 #include <math.h>
238 #include <string.h>
239
Brad Bishop19323692019-04-05 15:28:33 -0400240@@ -40,6 +42,7 @@ gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600241 g_object_ref (window), g_object_unref);
242 }
243
244+#ifdef HAVE_OPENGL
245 static const char *
246 get_vertex_type_name (int type)
247 {
Brad Bishop19323692019-04-05 15:28:33 -0400248@@ -212,6 +215,7 @@ use_texture_rect_program (GdkGLContextPaintData *paint_data)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600249 glUseProgram (paint_data->current_program->program);
250 }
251 }
252+#endif
253
254 void
255 gdk_gl_texture_quads (GdkGLContext *paint_context,
Brad Bishop19323692019-04-05 15:28:33 -0400256@@ -220,6 +224,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500257 GdkTexturedQuad *quads,
258 gboolean flip_colors)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600259 {
260+#ifdef HAVE_OPENGL
261 GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context);
262 GdkGLContextProgram *program;
263 GdkWindow *window = gdk_gl_context_get_window (paint_context);
Brad Bishop19323692019-04-05 15:28:33 -0400264@@ -293,6 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600265
266 glDisableVertexAttribArray (program->position_location);
267 glDisableVertexAttribArray (program->uv_location);
268+#endif
269 }
270
271 /* x,y,width,height describes a rectangle in the gl render buffer
Brad Bishop19323692019-04-05 15:28:33 -0400272@@ -341,6 +347,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600273 int width,
274 int height)
275 {
276+#ifdef HAVE_OPENGL
277 GdkGLContext *paint_context;
278 cairo_surface_t *image;
279 cairo_matrix_t matrix;
Brad Bishop19323692019-04-05 15:28:33 -0400280@@ -718,6 +725,7 @@ out:
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600281 if (clip_region)
282 cairo_region_destroy (clip_region);
283
284+#endif
285 }
286
287 /* This is always called with the paint context current */
Brad Bishop19323692019-04-05 15:28:33 -0400288@@ -725,6 +733,7 @@ void
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600289 gdk_gl_texture_from_surface (cairo_surface_t *surface,
290 cairo_region_t *region)
291 {
292+#ifdef HAVE_OPENGL
293 GdkGLContext *paint_context;
294 cairo_surface_t *image;
295 double device_x_offset, device_y_offset;
Brad Bishop19323692019-04-05 15:28:33 -0400296@@ -825,4 +834,5 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600297
298 glDisable (GL_SCISSOR_TEST);
299 glDeleteTextures (1, &texture_id);
300+#endif
301 }
302diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
Brad Bishop19323692019-04-05 15:28:33 -0400303index dfbed63..556f0a3 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600304--- a/gdk/gdkglcontext.c
305+++ b/gdk/gdkglcontext.c
306@@ -85,7 +85,9 @@
307 #include "gdkintl.h"
308 #include "gdk-private.h"
309
310+#ifdef HAVE_OPENGL
311 #include <epoxy/gl.h>
312+#endif
313
314 typedef struct {
315 GdkDisplay *display;
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500316@@ -243,6 +245,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600317 int height,
318 guint texture_target)
319 {
320+#ifdef HAVE_OPENGL
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500321 GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600322
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500323 g_return_if_fail (GDK_IS_GL_CONTEXT (context));
324@@ -286,6 +289,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
325 glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (unsigned char*) data + (i * stride));
326 }
327 }
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600328+#endif
329 }
330
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500331 static gboolean
332@@ -774,6 +778,7 @@ gdk_gl_context_realize (GdkGLContext *context,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600333 static void
334 gdk_gl_context_check_extensions (GdkGLContext *context)
335 {
336+#ifdef HAVE_OPENGL
337 GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
338 gboolean has_npot, has_texture_rectangle;
339
Brad Bishop19323692019-04-05 15:28:33 -0400340@@ -853,6 +858,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600341 priv->use_texture_rectangle ? "yes" : "no"));
342
343 priv->extensions_checked = TRUE;
344+#endif
345 }
346
347 /**
348diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
Brad Bishop19323692019-04-05 15:28:33 -0400349index 6b231f0..904b86d 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600350--- a/gdk/gdkwindow.c
351+++ b/gdk/gdkwindow.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500352@@ -45,7 +45,9 @@
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600353
354 #include <math.h>
355
356+#ifdef HAVE_OPENGL
357 #include <epoxy/gl.h>
358+#endif
359
360 /* for the use of round() */
361 #include "fallback-c89.c"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400362@@ -2822,6 +2824,13 @@ gdk_window_get_paint_gl_context (GdkWindow *window,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600363 {
364 GError *internal_error = NULL;
365
366+#ifndef HAVE_OPENGL
367+ g_set_error_literal (error, GDK_GL_ERROR,
368+ GDK_GL_ERROR_NOT_AVAILABLE,
369+ _("GL support disabled with --disable-opengl"));
370+ return NULL;
371+#endif
372+
373 if (_gdk_gl_flags & GDK_GL_DISABLE)
374 {
375 g_set_error_literal (error, GDK_GL_ERROR,
Brad Bishop316dfdd2018-06-25 12:45:53 -0400376@@ -2957,6 +2966,7 @@ gdk_window_begin_paint_internal (GdkWindow *window,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600377 }
378 else
379 {
380+#ifdef HAVE_OPENGL
381 gdk_gl_context_make_current (context);
382 /* With gl we always need a surface to combine the gl
383 drawing with the native drawing. */
Brad Bishop316dfdd2018-06-25 12:45:53 -0400384@@ -2971,6 +2981,7 @@ gdk_window_begin_paint_internal (GdkWindow *window,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600385 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
386
387 glViewport (0, 0, ww, wh);
388+#endif
389 }
390 }
391
Brad Bishop316dfdd2018-06-25 12:45:53 -0400392@@ -3034,6 +3045,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600393
394 gdk_gl_context_make_current (window->gl_paint_context);
395
396+#ifdef HAVE_OPENGL
397 if (!cairo_region_is_empty (opaque_region))
398 gdk_gl_texture_from_surface (window->current_paint.surface,
399 opaque_region);
Brad Bishop316dfdd2018-06-25 12:45:53 -0400400@@ -3044,6 +3056,7 @@ gdk_window_end_paint_internal (GdkWindow *window)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600401 window->current_paint.need_blend_region);
402 glDisable(GL_BLEND);
403 }
404+#endif
405
406 cairo_region_destroy (opaque_region);
407
408diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500409index 6289f3a..cbbac79 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600410--- a/gdk/x11/Makefile.am
411+++ b/gdk/x11/Makefile.am
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500412@@ -40,8 +40,6 @@ libgdk_x11_la_SOURCES = \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600413 gdkeventtranslator.c \
414 gdkeventtranslator.h \
415 gdkgeometry-x11.c \
416- gdkglcontext-x11.c \
417- gdkglcontext-x11.h \
418 gdkkeys-x11.c \
419 gdkmain-x11.c \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500420 gdkmonitor-x11.c \
421@@ -56,14 +54,32 @@ libgdk_x11_la_SOURCES = \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600422 gdkwindow-x11.h \
423 gdkxftdefaults.c \
424 gdkxid.c \
425- gdkx.h \
426 gdkprivate-x11.h \
427 xsettings-client.h \
428 xsettings-client.c
429
430+if HAVE_OPENGL
431+libgdk_x11_la_SOURCES += \
432+ gdkglcontext-x11.c \
433+ gdkglcontext-x11.h
434+endif
435+
436 libgdkinclude_HEADERS = \
437 gdkx.h
438
439+if HAVE_OPENGL
440+GDKX_HEADER = gdkx-with-gl-context.h
441+else
442+GDKX_HEADER = gdkx-without-gl-context.h
443+endif
444+
445+BUILT_SOURCES = gdkx.h
446+
447+.PHONY: gdkx.h
448+gdkx.h:
449+ $(AM_V_GEN) cd $(srcdir) \
450+ && (cmp -s $(GDKX_HEADER) gdkx.h || cp $(GDKX_HEADER) gdkx.h )
451+
452 libgdkx11include_HEADERS = \
453 gdkx-autocleanups.h \
454 gdkx11applaunchcontext.h \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500455@@ -77,7 +93,6 @@ libgdkx11include_HEADERS = \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600456 gdkx11display.h \
457 gdkx11displaymanager.h \
458 gdkx11dnd.h \
459- gdkx11glcontext.h \
460 gdkx11keys.h \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500461 gdkx11monitor.h \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600462 gdkx11property.h \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500463@@ -87,9 +102,16 @@ libgdkx11include_HEADERS = \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600464 gdkx11visual.h \
465 gdkx11window.h
466
467+if HAVE_OPENGL
468+libgdkx11include_HEADERS += gdkx11glcontext.h
469+endif
470+
471 # We need to include all these C files here since the conditionals
472 # don't seem to be correctly expanded for the dist files.
473 EXTRA_DIST += \
474+ gdkx.h \
475 gdksettings.c
476
477+MAINTAINERCLEANFILES = gdkx.h
478+
479 -include $(top_srcdir)/git.mk
480diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
Brad Bishop19323692019-04-05 15:28:33 -0400481index 659b9fa..b15536b 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600482--- a/gdk/x11/gdkdisplay-x11.c
483+++ b/gdk/x11/gdkdisplay-x11.c
484@@ -37,7 +37,9 @@
485 #include "gdkdisplay-x11.h"
486 #include "gdkprivate-x11.h"
487 #include "gdkscreen-x11.h"
488+#ifdef HAVE_OPENGL
489 #include "gdkglcontext-x11.h"
490+#endif
491 #include "gdk-private.h"
492
493 #include <glib.h>
Brad Bishop19323692019-04-05 15:28:33 -0400494@@ -3194,7 +3196,9 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600495 display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list;
496 display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target;
497
498- display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;
499+#ifdef HAVE_OPENGL
500+ display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current;
501+#endif
502
503 display_class->get_default_seat = gdk_x11_display_get_default_seat;
504
505diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
Brad Bishop19323692019-04-05 15:28:33 -0400506index 272cecd..2bb34ac 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600507--- a/gdk/x11/gdkscreen-x11.c
508+++ b/gdk/x11/gdkscreen-x11.c
Brad Bishop19323692019-04-05 15:28:33 -0400509@@ -1675,3 +1675,8 @@ gdk_x11_screen_get_current_desktop (GdkScreen *screen)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600510 {
511 return get_netwm_cardinal_property (screen, "_NET_CURRENT_DESKTOP");
512 }
513+
514+#ifndef HAVE_OPENGL
515+/* Function from in gdk/x11/gdkglcontext-x11.c */
516+void _gdk_x11_screen_update_visuals_for_gl (GdkScreen *screen) {}
517+#endif
518diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
Brad Bishop19323692019-04-05 15:28:33 -0400519index c6205e4..df2334f 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600520--- a/gdk/x11/gdkwindow-x11.c
521+++ b/gdk/x11/gdkwindow-x11.c
522@@ -36,7 +36,9 @@
523 #include "gdkasync.h"
524 #include "gdkeventsource.h"
525 #include "gdkdisplay-x11.h"
526+#ifdef HAVE_OPENGL
527 #include "gdkglcontext-x11.h"
528+#endif
529 #include "gdkprivate-x11.h"
530 #include "gdk-private.h"
531
Brad Bishop19323692019-04-05 15:28:33 -0400532@@ -5804,7 +5806,9 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600533 impl_class->set_opaque_region = gdk_x11_window_set_opaque_region;
534 impl_class->set_shadow_width = gdk_x11_window_set_shadow_width;
535 impl_class->show_window_menu = gdk_x11_window_show_window_menu;
536+#ifdef HAVE_OPENGL
537 impl_class->create_gl_context = gdk_x11_window_create_gl_context;
538 impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame;
539+#endif
540 impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size;
541 }
542diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h
543index edb0ea7..a317d61 100644
544--- a/gdk/x11/gdkx-autocleanups.h
545+++ b/gdk/x11/gdkx-autocleanups.h
546@@ -30,7 +30,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref)
547 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref)
548 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DisplayManager, g_object_unref)
549 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref)
550+#ifdef HAVE_OPENGL
551 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref)
552+#endif
553 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref)
554 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref)
555 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Visual, g_object_unref)
Brad Bishop316dfdd2018-06-25 12:45:53 -0400556diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx-with-gl-context.h
557similarity index 98%
558rename from gdk/x11/gdkx.h
559rename to gdk/x11/gdkx-with-gl-context.h
560index 1f64bcc..ae05fa6 100644
561--- a/gdk/x11/gdkx.h
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600562+++ b/gdk/x11/gdkx-with-gl-context.h
Brad Bishop316dfdd2018-06-25 12:45:53 -0400563@@ -45,7 +45,6 @@
564 #include <gdk/x11/gdkx11dnd.h>
565 #include <gdk/x11/gdkx11glcontext.h>
566 #include <gdk/x11/gdkx11keys.h>
567-#include <gdk/x11/gdkx11monitor.h>
568 #include <gdk/x11/gdkx11property.h>
569 #include <gdk/x11/gdkx11screen.h>
570 #include <gdk/x11/gdkx11selection.h>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600571diff --git a/gdk/x11/gdkx-without-gl-context.h b/gdk/x11/gdkx-without-gl-context.h
572new file mode 100644
573index 0000000..c9e2617
574--- /dev/null
575+++ b/gdk/x11/gdkx-without-gl-context.h
576@@ -0,0 +1,58 @@
577+/* GDK - The GIMP Drawing Kit
578+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
579+ *
580+ * This library is free software; you can redistribute it and/or
581+ * modify it under the terms of the GNU Lesser General Public
582+ * License as published by the Free Software Foundation; either
583+ * version 2 of the License, or (at your option) any later version.
584+ *
585+ * This library is distributed in the hope that it will be useful,
586+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
587+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
588+ * Lesser General Public License for more details.
589+ *
590+ * You should have received a copy of the GNU Lesser General Public
591+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
592+ */
593+
594+/*
595+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
596+ * file for a list of people on the GTK+ Team. See the ChangeLog
597+ * files for a list of changes. These files are distributed with
598+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
599+ */
600+
601+#ifndef __GDK_X_H__
602+#define __GDK_X_H__
603+
604+#include <gdk/gdk.h>
605+
606+#include <X11/Xlib.h>
607+#include <X11/Xutil.h>
608+
609+#define __GDKX_H_INSIDE__
610+
611+#include <gdk/x11/gdkx11applaunchcontext.h>
612+#include <gdk/x11/gdkx11cursor.h>
613+#include <gdk/x11/gdkx11device.h>
614+#include <gdk/x11/gdkx11device-core.h>
615+#include <gdk/x11/gdkx11device-xi2.h>
616+#include <gdk/x11/gdkx11devicemanager.h>
617+#include <gdk/x11/gdkx11devicemanager-core.h>
618+#include <gdk/x11/gdkx11devicemanager-xi2.h>
619+#include <gdk/x11/gdkx11display.h>
620+#include <gdk/x11/gdkx11displaymanager.h>
621+#include <gdk/x11/gdkx11dnd.h>
622+#include <gdk/x11/gdkx11keys.h>
623+#include <gdk/x11/gdkx11property.h>
624+#include <gdk/x11/gdkx11screen.h>
625+#include <gdk/x11/gdkx11selection.h>
626+#include <gdk/x11/gdkx11utils.h>
627+#include <gdk/x11/gdkx11visual.h>
628+#include <gdk/x11/gdkx11window.h>
629+
630+#include <gdk/x11/gdkx-autocleanups.h>
631+
632+#undef __GDKX_H_INSIDE__
633+
634+#endif /* __GDK_X_H__ */
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600635diff --git a/gtk/Makefile.am b/gtk/Makefile.am
Brad Bishop19323692019-04-05 15:28:33 -0400636index 5594429..2259bb3 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600637--- a/gtk/Makefile.am
638+++ b/gtk/Makefile.am
Brad Bishop19323692019-04-05 15:28:33 -0400639@@ -1434,14 +1434,13 @@ gtkprivatetypebuiltins.c: $(gtk_private_type_h_sources) gtkprivatetypebuiltins.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600640 && cp xgen-gptbc gtkprivatetypebuiltins.c \
641 && rm -f xgen-gptbc
642
643-
644 gtktypefuncs.c: stamp-gtktypebuiltins.h stamp-gtkprivatetypebuiltins.h $(top_srcdir)/gtk/*.h $(top_srcdir)/gtk/a11y/*.h $(top_srcdir)/gtk/deprecated/*.h $(top_srcdir)/gdk/*.h Makefile
645 $(AM_V_GEN) (echo '#undef GTK_COMPILATION' && echo '#include <gtk/gtkx.h>') > xgen-gtfsrc.c && \
646 echo 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS' > xgen-gtf && \
647 ${CPP} $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
648 $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
649 sort | uniq | \
650- $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; }' >> xgen-gtf \
651+ $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; s/^.*gdk_x11_gl.*$$/#ifdef HAVE_OPENGL\n&\n#endif/; }' >> xgen-gtf \
652 && cp xgen-gtf $@ && rm -f xgen-gtf
Brad Bishop19323692019-04-05 15:28:33 -0400653 $(srcdir)/gtktestutils.c: gtktypefuncs.c
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600654
655diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
Brad Bishop19323692019-04-05 15:28:33 -0400656index ea383c0..bb4eb64 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600657--- a/gtk/gtkglarea.c
658+++ b/gtk/gtkglarea.c
659@@ -28,7 +28,9 @@
660 #include "gtkprivate.h"
661 #include "gtkrender.h"
662
663+#ifdef HAVE_OPENGL
664 #include <epoxy/gl.h>
665+#endif
666
667 /**
668 * SECTION:gtkglarea
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500669@@ -368,9 +370,12 @@ gtk_gl_area_real_create_context (GtkGLArea *area)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600670 static void
671 gtk_gl_area_resize (GtkGLArea *area, int width, int height)
672 {
673+#ifdef HAVE_OPENGL
674 glViewport (0, 0, width, height);
675+#endif
676 }
677
678+#ifdef HAVE_OPENGL
679 /*
680 * Creates all the buffer objects needed for rendering the scene
681 */
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500682@@ -482,6 +487,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600683
684 priv->needs_render = TRUE;
685 }
686+#endif
687
688 /**
689 * gtk_gl_area_attach_buffers:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500690@@ -500,6 +506,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600691 void
692 gtk_gl_area_attach_buffers (GtkGLArea *area)
693 {
694+#ifdef HAVE_OPENGL
695 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
696
697 g_return_if_fail (GTK_IS_GL_AREA (area));
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500698@@ -532,11 +539,13 @@ gtk_gl_area_attach_buffers (GtkGLArea *area)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600699 glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
700 GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
701 }
702+#endif
703 }
704
705 static void
706 gtk_gl_area_delete_buffers (GtkGLArea *area)
707 {
708+#ifdef HAVE_OPENGL
709 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
710
711 if (priv->context == NULL)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500712@@ -568,6 +577,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600713 glDeleteFramebuffersEXT (1, &priv->frame_buffer);
714 priv->frame_buffer = 0;
715 }
716+#endif
717 }
718
719 static void
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500720@@ -678,6 +688,7 @@ gtk_gl_area_draw (GtkWidget *widget,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600721 GtkGLArea *area = GTK_GL_AREA (widget);
722 GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
723 gboolean unused;
724+#ifdef HAVE_OPENGL
725 int w, h, scale;
726 GLenum status;
727
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500728@@ -689,7 +700,6 @@ gtk_gl_area_draw (GtkWidget *widget,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600729 gtk_widget_get_allocated_height (widget));
730 return FALSE;
731 }
732-
733 if (priv->context == NULL)
734 return FALSE;
735
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500736@@ -735,6 +745,14 @@ gtk_gl_area_draw (GtkWidget *widget,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600737 }
738
739 return TRUE;
740+#else
741+ if (priv->error != NULL)
742+ gtk_gl_area_draw_error_screen (area,
743+ cr,
744+ gtk_widget_get_allocated_width (widget),
745+ gtk_widget_get_allocated_height (widget));
746+ return FALSE;
747+#endif
748 }
749
750 static gboolean
751diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500752index c241ec8..24576dd 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600753--- a/gtk/inspector/general.c
754+++ b/gtk/inspector/general.c
755@@ -33,8 +33,10 @@
756
757 #ifdef GDK_WINDOWING_X11
758 #include "x11/gdkx.h"
759+#ifdef HAVE_OPENGL
760 #include <epoxy/glx.h>
761 #endif
762+#endif
763
764 #ifdef GDK_WINDOWING_WIN32
765 #include "win32/gdkwin32.h"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500766@@ -196,6 +198,7 @@ add_label_row (GtkInspectorGeneral *gen,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600767 gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->priv->labels), label);
768 }
769
770+#ifdef HAVE_OPENGL
771 #ifdef GDK_WINDOWING_X11
772 static void
773 append_glx_extension_row (GtkInspectorGeneral *gen,
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500774@@ -205,6 +208,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen,
775 add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0);
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600776 }
777 #endif
778+#endif
779
780 #ifdef GDK_WINDOWING_WAYLAND
781 static void
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500782@@ -254,6 +258,7 @@ wayland_get_display (struct wl_display *wl_display)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600783 static void
784 init_gl (GtkInspectorGeneral *gen)
785 {
786+#ifdef HAVE_OPENGL
787 #ifdef GDK_WINDOWING_X11
788 if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
789 {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500790@@ -280,6 +285,7 @@ init_gl (GtkInspectorGeneral *gen)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600791 }
792 else
793 #endif
794+#endif
795 #ifdef GDK_WINDOWING_WAYLAND
796 if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
797 {
798diff --git a/tests/Makefile.am b/tests/Makefile.am
Brad Bishop19323692019-04-05 15:28:33 -0400799index 7c5ca99..e4a4546 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600800--- a/tests/Makefile.am
801+++ b/tests/Makefile.am
802@@ -80,8 +80,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \
803 testfullscreen \
804 testgeometry \
805 testgiconpixbuf \
806- testglarea \
807- testglblending \
808 testgrid \
809 testgtk \
810 testheaderbar \
Brad Bishop19323692019-04-05 15:28:33 -0400811@@ -172,12 +170,18 @@ noinst_PROGRAMS = $(TEST_PROGS) \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600812 testactionbar \
813 testwindowsize \
814 testpopover \
815- gdkgears \
816 listmodel \
817 testpopup \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500818 testpopupat \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600819 $(NULL)
820
821+if HAVE_OPENGL
822+noinst_PROGRAMS +=
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500823+ testglarea \
824+ testglblending \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600825+ gdkgears
826+endif
827+
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500828 if USE_WAYLAND
829 noinst_PROGRAMS += testforeign
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600830 endif
831diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500832index 0b3a519..07b096f 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600833--- a/testsuite/gtk/objects-finalize.c
834+++ b/testsuite/gtk/objects-finalize.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400835@@ -115,7 +115,9 @@ main (int argc, char **argv)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600836 all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_CORE &&
837 all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 &&
838 all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER &&
839+#ifdef HAVE_OPENGL
840 all_types[i] != GDK_TYPE_X11_GL_CONTEXT &&
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600841+#endif
Brad Bishop316dfdd2018-06-25 12:45:53 -0400842 #endif
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600843 /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */
844 all_types[i] != GDK_TYPE_PIXBUF_LOADER &&