Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame^] | 1 | From a8fa547fdc1416b330aced805f5343ad912932ae Mon Sep 17 00:00:00 2001 |
| 2 | From: Jussi Kukkonen <jussi.kukkonen@intel.com> |
| 3 | Date: Tue, 21 Jun 2016 15:11:39 +0300 |
| 4 | Subject: [PATCH 3/4] Add --disable-opengl configure option |
| 5 | |
| 6 | --disable-opengl will remove the dependency on libepoxy and on the |
| 7 | OpenGL APIs. This is useful for those who want to keep using gtk+3 |
| 8 | without the "opengl" distro feature. |
| 9 | |
| 10 | GtkGLArea is still part of the API (it just doesn't work) even when |
| 11 | OpenGL is disabled. GdkX11GLContext was removed from the Gtk API |
| 12 | completely: that object exposes GL API elements so it had to be at |
| 13 | the very least modified. |
| 14 | |
| 15 | The patch is _not_ great from a maintenance point of view and |
| 16 | modifying the library API is also a fairly nasty thing to do. |
| 17 | Long-term it would be good to find an alternative solution to this |
| 18 | (maybe a no-op backend for libepoxy?) |
| 19 | |
| 20 | Upstream-Status: Inappropriate [Evil eye expected from upstream] |
| 21 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> |
| 22 | --- |
| 23 | configure.ac | 13 +++++++++++-- |
| 24 | demos/gtk-demo/glarea.c | 13 +++++++++++++ |
| 25 | docs/tools/Makefile.am | 9 +++++++-- |
| 26 | docs/tools/widgets.c | 4 +++- |
| 27 | gdk/gdkdisplay.c | 4 +++- |
| 28 | gdk/gdkgl.c | 10 ++++++++++ |
| 29 | gdk/gdkglcontext.c | 6 ++++++ |
| 30 | gdk/gdkwindow.c | 13 +++++++++++++ |
| 31 | gdk/x11/Makefile.am | 30 ++++++++++++++++++++++++++---- |
| 32 | gdk/x11/gdkdisplay-x11.c | 6 +++++- |
| 33 | gdk/x11/gdkscreen-x11.c | 5 +++++ |
| 34 | gdk/x11/gdkwindow-x11.c | 4 ++++ |
| 35 | gdk/x11/gdkx-autocleanups.h | 2 ++ |
| 36 | gdk/x11/gdkx-with-gl-context.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 37 | gdk/x11/gdkx-without-gl-context.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 38 | gdk/x11/gdkx.h | 59 ----------------------------------------------------------- |
| 39 | gtk/Makefile.am | 3 +-- |
| 40 | gtk/gtkglarea.c | 20 +++++++++++++++++++- |
| 41 | gtk/inspector/general.c | 6 ++++++ |
| 42 | tests/Makefile.am | 10 +++++++--- |
| 43 | testsuite/gtk/objects-finalize.c | 2 ++ |
| 44 | 21 files changed, 260 insertions(+), 76 deletions(-) |
| 45 | |
| 46 | diff --git a/configure.ac b/configure.ac |
| 47 | index a01824e..dde9dc5 100644 |
| 48 | --- a/configure.ac |
| 49 | +++ b/configure.ac |
| 50 | @@ -342,6 +342,15 @@ AC_ARG_ENABLE(mir-backend, |
| 51 | [enable the Mir gdk backend])], |
| 52 | [backend_set=yes]) |
| 53 | |
| 54 | +AC_ARG_ENABLE(opengl, |
| 55 | + [AS_HELP_STRING([--enable-opengl], |
| 56 | + [When enabled, Gtk+ will use libepoxy and exposes GtkGLArea widget ])]) |
| 57 | +AS_IF([test "x$enable_opengl" != "xno"], [ |
| 58 | + AC_DEFINE([HAVE_OPENGL], [1], [libepoxy and opengl APIs are available at buildtime]) |
| 59 | + EPOXY_PACKAGES="epoxy >= epoxy_required_version" |
| 60 | +]) |
| 61 | +AM_CONDITIONAL([HAVE_OPENGL],[test "x$enable_opengl" != "xno"]) |
| 62 | + |
| 63 | AC_ARG_ENABLE(glx, |
| 64 | [AS_HELP_STRING([--enable-glx], |
| 65 | [When enabled Gdk will try to initialize GLX])]) |
| 66 | @@ -1333,7 +1342,7 @@ CFLAGS="$saved_cflags" |
| 67 | LDFLAGS="$saved_ldflags" |
| 68 | |
| 69 | GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version" |
| 70 | -GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $cairo_backends epoxy >= epoxy_required_version" |
| 71 | +GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $cairo_backends $EPOXY_PACKAGES" |
| 72 | |
| 73 | PKG_CHECK_MODULES(GDK_DEP, $GDK_PACKAGES $GDK_PRIVATE_PACKAGES) |
| 74 | GDK_DEP_LIBS="$GDK_EXTRA_LIBS $GDK_DEP_LIBS $MATH_LIB" |
| 75 | @@ -1367,7 +1376,7 @@ fi |
| 76 | PKG_CHECK_MODULES(ATK, $ATK_PACKAGES) |
| 77 | |
| 78 | 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" |
| 79 | -GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES epoxy >= epoxy_required_version" |
| 80 | +GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $EPOXY_PACKAGES" |
| 81 | if test "x$enable_x11_backend" = xyes -o "x$enable_wayland_backend" = xyes; then |
| 82 | GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2" |
| 83 | fi |
| 84 | diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c |
| 85 | index 3aba729..c6c79f7 100644 |
| 86 | --- a/demos/gtk-demo/glarea.c |
| 87 | +++ b/demos/gtk-demo/glarea.c |
| 88 | @@ -5,7 +5,9 @@ |
| 89 | |
| 90 | #include <math.h> |
| 91 | #include <gtk/gtk.h> |
| 92 | +#if HAVE_OPENGL |
| 93 | #include <epoxy/gl.h> |
| 94 | +#endif |
| 95 | |
| 96 | static GtkWidget *demo_window = NULL; |
| 97 | |
| 98 | @@ -23,6 +25,8 @@ enum { |
| 99 | /* Rotation angles on each axis */ |
| 100 | static float rotation_angles[N_AXIS] = { 0.0 }; |
| 101 | |
| 102 | +#ifdef HAVE_OPENGL |
| 103 | + |
| 104 | /* The object we are drawing */ |
| 105 | static const GLfloat vertex_data[] = { |
| 106 | 0.f, 0.5f, 0.f, 1.f, |
| 107 | @@ -213,6 +217,7 @@ compute_mvp (float *res, |
| 108 | static GLuint position_buffer; |
| 109 | static GLuint program; |
| 110 | static GLuint mvp_location; |
| 111 | +#endif |
| 112 | |
| 113 | /* We need to set up our state when we realize the GtkGLArea widget */ |
| 114 | static void |
| 115 | @@ -223,8 +228,10 @@ realize (GtkWidget *widget) |
| 116 | if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL) |
| 117 | return; |
| 118 | |
| 119 | +#ifdef HAVE_OPENGL |
| 120 | init_buffers (&position_buffer, NULL); |
| 121 | init_shaders (&program, &mvp_location); |
| 122 | +#endif |
| 123 | } |
| 124 | |
| 125 | /* We should tear down the state when unrealizing */ |
| 126 | @@ -236,10 +243,13 @@ unrealize (GtkWidget *widget) |
| 127 | if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL) |
| 128 | return; |
| 129 | |
| 130 | +#ifdef HAVE_OPENGL |
| 131 | glDeleteBuffers (1, &position_buffer); |
| 132 | glDeleteProgram (program); |
| 133 | +#endif |
| 134 | } |
| 135 | |
| 136 | +#ifdef HAVE_OPENGL |
| 137 | static void |
| 138 | draw_triangle (void) |
| 139 | { |
| 140 | @@ -272,6 +282,7 @@ draw_triangle (void) |
| 141 | glBindBuffer (GL_ARRAY_BUFFER, 0); |
| 142 | glUseProgram (0); |
| 143 | } |
| 144 | +#endif |
| 145 | |
| 146 | static gboolean |
| 147 | render (GtkGLArea *area, |
| 148 | @@ -280,6 +291,7 @@ render (GtkGLArea *area, |
| 149 | if (gtk_gl_area_get_error (area) != NULL) |
| 150 | return FALSE; |
| 151 | |
| 152 | +#ifdef HAVE_OPENGL |
| 153 | /* Clear the viewport */ |
| 154 | glClearColor (0.5, 0.5, 0.5, 1.0); |
| 155 | glClear (GL_COLOR_BUFFER_BIT); |
| 156 | @@ -289,6 +301,7 @@ render (GtkGLArea *area, |
| 157 | |
| 158 | /* Flush the contents of the pipeline */ |
| 159 | glFlush (); |
| 160 | +#endif |
| 161 | |
| 162 | return TRUE; |
| 163 | } |
| 164 | diff --git a/docs/tools/Makefile.am b/docs/tools/Makefile.am |
| 165 | index 6a6d70f..5cdf312 100644 |
| 166 | --- a/docs/tools/Makefile.am |
| 167 | +++ b/docs/tools/Makefile.am |
| 168 | @@ -9,13 +9,18 @@ AM_CPPFLAGS = \ |
| 169 | $(GTK_DEBUG_FLAGS) \ |
| 170 | $(GTK_DEP_CFLAGS) |
| 171 | |
| 172 | +if HAVE_OPENGL |
| 173 | +GEARS_LDADD = $(top_builddir)/tests/gtkgears.o |
| 174 | +endif |
| 175 | + |
| 176 | DEPS = \ |
| 177 | - $(top_builddir)/gtk/libgtk-3.la |
| 178 | + $(top_builddir)/gtk/libgtk-3.la \ |
| 179 | + $(GEARS_LDADD) |
| 180 | |
| 181 | LDADDS = \ |
| 182 | $(top_builddir)/gtk/libgtk-3.la \ |
| 183 | $(top_builddir)/gdk/libgdk-3.la \ |
| 184 | - $(top_builddir)/tests/gtkgears.o \ |
| 185 | + $(GEARS_LDADD) \ |
| 186 | $(GTK_DEP_LIBS) \ |
| 187 | $(GDK_DEP_LIBS) \ |
| 188 | -lm |
| 189 | diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c |
| 190 | index 932daf1..54239d6 100644 |
| 191 | --- a/docs/tools/widgets.c |
| 192 | +++ b/docs/tools/widgets.c |
| 193 | @@ -1526,9 +1526,11 @@ create_gl_area (void) |
| 194 | widget = gtk_frame_new (NULL); |
| 195 | gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN); |
| 196 | |
| 197 | +#ifdef HAVE_OPENGL |
| 198 | gears = gtk_gears_new (); |
| 199 | gtk_container_add (GTK_CONTAINER (widget), gears); |
| 200 | - |
| 201 | +#endif |
| 202 | + |
| 203 | info = new_widget_info ("glarea", widget, MEDIUM); |
| 204 | |
| 205 | return info; |
| 206 | diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c |
| 207 | index 6150ef7..2223629 100644 |
| 208 | --- a/gdk/gdkdisplay.c |
| 209 | +++ b/gdk/gdkdisplay.c |
| 210 | @@ -2360,7 +2360,9 @@ gboolean |
| 211 | gdk_display_make_gl_context_current (GdkDisplay *display, |
| 212 | GdkGLContext *context) |
| 213 | { |
| 214 | - return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context); |
| 215 | + if (GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current) |
| 216 | + return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context); |
| 217 | + return FALSE; |
| 218 | } |
| 219 | |
| 220 | GdkRenderingMode |
| 221 | diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c |
| 222 | index e8ba770..ba7c84b 100644 |
| 223 | --- a/gdk/gdkgl.c |
| 224 | +++ b/gdk/gdkgl.c |
| 225 | @@ -22,7 +22,9 @@ |
| 226 | |
| 227 | #include "gdkinternals.h" |
| 228 | |
| 229 | +#ifdef HAVE_OPENGL |
| 230 | #include <epoxy/gl.h> |
| 231 | +#endif |
| 232 | #include <math.h> |
| 233 | #include <string.h> |
| 234 | |
| 235 | @@ -36,6 +38,7 @@ gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface, |
| 236 | g_object_ref (window), g_object_unref); |
| 237 | } |
| 238 | |
| 239 | +#ifdef HAVE_OPENGL |
| 240 | static const char * |
| 241 | get_vertex_type_name (int type) |
| 242 | { |
| 243 | @@ -254,6 +257,7 @@ use_texture_rect_program (GdkGLContextPaintData *paint_data) |
| 244 | glUseProgram (paint_data->current_program->program); |
| 245 | } |
| 246 | } |
| 247 | +#endif |
| 248 | |
| 249 | void |
| 250 | gdk_gl_texture_quads (GdkGLContext *paint_context, |
| 251 | @@ -261,6 +265,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context, |
| 252 | int n_quads, |
| 253 | GdkTexturedQuad *quads) |
| 254 | { |
| 255 | +#ifdef HAVE_OPENGL |
| 256 | GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context); |
| 257 | GdkGLContextProgram *program; |
| 258 | GdkWindow *window = gdk_gl_context_get_window (paint_context); |
| 259 | @@ -324,6 +329,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context, |
| 260 | |
| 261 | glDisableVertexAttribArray (program->position_location); |
| 262 | glDisableVertexAttribArray (program->uv_location); |
| 263 | +#endif |
| 264 | } |
| 265 | |
| 266 | /* x,y,width,height describes a rectangle in the gl render buffer |
| 267 | @@ -372,6 +378,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr, |
| 268 | int width, |
| 269 | int height) |
| 270 | { |
| 271 | +#ifdef HAVE_OPENGL |
| 272 | GdkGLContext *paint_context; |
| 273 | cairo_surface_t *image; |
| 274 | cairo_matrix_t matrix; |
| 275 | @@ -692,6 +699,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr, |
| 276 | if (clip_region) |
| 277 | cairo_region_destroy (clip_region); |
| 278 | |
| 279 | +#endif |
| 280 | } |
| 281 | |
| 282 | /* This is always called with the paint context current */ |
| 283 | @@ -699,6 +707,7 @@ void |
| 284 | gdk_gl_texture_from_surface (cairo_surface_t *surface, |
| 285 | cairo_region_t *region) |
| 286 | { |
| 287 | +#ifdef HAVE_OPENGL |
| 288 | GdkGLContext *paint_context; |
| 289 | cairo_surface_t *image; |
| 290 | double device_x_offset, device_y_offset; |
| 291 | @@ -799,4 +808,5 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface, |
| 292 | |
| 293 | glDisable (GL_SCISSOR_TEST); |
| 294 | glDeleteTextures (1, &texture_id); |
| 295 | +#endif |
| 296 | } |
| 297 | diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c |
| 298 | index 00a33eb..bd8a793 100644 |
| 299 | --- a/gdk/gdkglcontext.c |
| 300 | +++ b/gdk/gdkglcontext.c |
| 301 | @@ -85,7 +85,9 @@ |
| 302 | #include "gdkintl.h" |
| 303 | #include "gdk-private.h" |
| 304 | |
| 305 | +#ifdef HAVE_OPENGL |
| 306 | #include <epoxy/gl.h> |
| 307 | +#endif |
| 308 | |
| 309 | typedef struct { |
| 310 | GdkDisplay *display; |
| 311 | @@ -239,6 +241,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, |
| 312 | int height, |
| 313 | guint texture_target) |
| 314 | { |
| 315 | +#ifdef HAVE_OPENGL |
| 316 | g_return_if_fail (GDK_IS_GL_CONTEXT (context)); |
| 317 | |
| 318 | glPixelStorei (GL_UNPACK_ALIGNMENT, 4); |
| 319 | @@ -246,6 +249,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, |
| 320 | glTexImage2D (texture_target, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, |
| 321 | cairo_image_surface_get_data (image_surface)); |
| 322 | glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); |
| 323 | +#endif |
| 324 | } |
| 325 | |
| 326 | static void |
| 327 | @@ -635,6 +639,7 @@ gdk_gl_context_realize (GdkGLContext *context, |
| 328 | static void |
| 329 | gdk_gl_context_check_extensions (GdkGLContext *context) |
| 330 | { |
| 331 | +#ifdef HAVE_OPENGL |
| 332 | GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); |
| 333 | gboolean has_npot, has_texture_rectangle; |
| 334 | |
| 335 | @@ -677,6 +682,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context) |
| 336 | priv->use_texture_rectangle ? "yes" : "no")); |
| 337 | |
| 338 | priv->extensions_checked = TRUE; |
| 339 | +#endif |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c |
| 344 | index 66ebb9d..74a0c3a 100644 |
| 345 | --- a/gdk/gdkwindow.c |
| 346 | +++ b/gdk/gdkwindow.c |
| 347 | @@ -44,7 +44,9 @@ |
| 348 | |
| 349 | #include <math.h> |
| 350 | |
| 351 | +#ifdef HAVE_OPENGL |
| 352 | #include <epoxy/gl.h> |
| 353 | +#endif |
| 354 | |
| 355 | /* for the use of round() */ |
| 356 | #include "fallback-c89.c" |
| 357 | @@ -2759,6 +2761,13 @@ gdk_window_get_paint_gl_context (GdkWindow *window, |
| 358 | { |
| 359 | GError *internal_error = NULL; |
| 360 | |
| 361 | +#ifndef HAVE_OPENGL |
| 362 | + g_set_error_literal (error, GDK_GL_ERROR, |
| 363 | + GDK_GL_ERROR_NOT_AVAILABLE, |
| 364 | + _("GL support disabled with --disable-opengl")); |
| 365 | + return NULL; |
| 366 | +#endif |
| 367 | + |
| 368 | if (_gdk_gl_flags & GDK_GL_DISABLE) |
| 369 | { |
| 370 | g_set_error_literal (error, GDK_GL_ERROR, |
| 371 | @@ -2955,6 +2964,7 @@ gdk_window_begin_paint_region (GdkWindow *window, |
| 372 | } |
| 373 | else |
| 374 | { |
| 375 | +#ifdef HAVE_OPENGL |
| 376 | gdk_gl_context_make_current (context); |
| 377 | /* With gl we always need a surface to combine the gl |
| 378 | drawing with the native drawing. */ |
| 379 | @@ -2969,6 +2979,7 @@ gdk_window_begin_paint_region (GdkWindow *window, |
| 380 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
| 381 | |
| 382 | glViewport (0, 0, ww, wh); |
| 383 | +#endif |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | @@ -3117,6 +3128,7 @@ gdk_window_end_paint (GdkWindow *window) |
| 388 | |
| 389 | gdk_gl_context_make_current (window->gl_paint_context); |
| 390 | |
| 391 | +#ifdef HAVE_OPENGL |
| 392 | if (!cairo_region_is_empty (opaque_region)) |
| 393 | gdk_gl_texture_from_surface (window->current_paint.surface, |
| 394 | opaque_region); |
| 395 | @@ -3127,6 +3139,7 @@ gdk_window_end_paint (GdkWindow *window) |
| 396 | window->current_paint.need_blend_region); |
| 397 | glDisable(GL_BLEND); |
| 398 | } |
| 399 | +#endif |
| 400 | |
| 401 | cairo_region_destroy (opaque_region); |
| 402 | |
| 403 | diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am |
| 404 | index c488a31..4ce3c07 100644 |
| 405 | --- a/gdk/x11/Makefile.am |
| 406 | +++ b/gdk/x11/Makefile.am |
| 407 | @@ -39,8 +39,6 @@ libgdk_x11_la_SOURCES = \ |
| 408 | gdkeventtranslator.c \ |
| 409 | gdkeventtranslator.h \ |
| 410 | gdkgeometry-x11.c \ |
| 411 | - gdkglcontext-x11.c \ |
| 412 | - gdkglcontext-x11.h \ |
| 413 | gdkkeys-x11.c \ |
| 414 | gdkmain-x11.c \ |
| 415 | gdkproperty-x11.c \ |
| 416 | @@ -53,14 +51,32 @@ libgdk_x11_la_SOURCES = \ |
| 417 | gdkwindow-x11.h \ |
| 418 | gdkxftdefaults.c \ |
| 419 | gdkxid.c \ |
| 420 | - gdkx.h \ |
| 421 | gdkprivate-x11.h \ |
| 422 | xsettings-client.h \ |
| 423 | xsettings-client.c |
| 424 | |
| 425 | +if HAVE_OPENGL |
| 426 | +libgdk_x11_la_SOURCES += \ |
| 427 | + gdkglcontext-x11.c \ |
| 428 | + gdkglcontext-x11.h |
| 429 | +endif |
| 430 | + |
| 431 | libgdkinclude_HEADERS = \ |
| 432 | gdkx.h |
| 433 | |
| 434 | +if HAVE_OPENGL |
| 435 | +GDKX_HEADER = gdkx-with-gl-context.h |
| 436 | +else |
| 437 | +GDKX_HEADER = gdkx-without-gl-context.h |
| 438 | +endif |
| 439 | + |
| 440 | +BUILT_SOURCES = gdkx.h |
| 441 | + |
| 442 | +.PHONY: gdkx.h |
| 443 | +gdkx.h: |
| 444 | + $(AM_V_GEN) cd $(srcdir) \ |
| 445 | + && (cmp -s $(GDKX_HEADER) gdkx.h || cp $(GDKX_HEADER) gdkx.h ) |
| 446 | + |
| 447 | libgdkx11include_HEADERS = \ |
| 448 | gdkx-autocleanups.h \ |
| 449 | gdkx11applaunchcontext.h \ |
| 450 | @@ -74,7 +90,6 @@ libgdkx11include_HEADERS = \ |
| 451 | gdkx11display.h \ |
| 452 | gdkx11displaymanager.h \ |
| 453 | gdkx11dnd.h \ |
| 454 | - gdkx11glcontext.h \ |
| 455 | gdkx11keys.h \ |
| 456 | gdkx11property.h \ |
| 457 | gdkx11screen.h \ |
| 458 | @@ -83,9 +98,16 @@ libgdkx11include_HEADERS = \ |
| 459 | gdkx11visual.h \ |
| 460 | gdkx11window.h |
| 461 | |
| 462 | +if HAVE_OPENGL |
| 463 | +libgdkx11include_HEADERS += gdkx11glcontext.h |
| 464 | +endif |
| 465 | + |
| 466 | # We need to include all these C files here since the conditionals |
| 467 | # don't seem to be correctly expanded for the dist files. |
| 468 | EXTRA_DIST += \ |
| 469 | + gdkx.h \ |
| 470 | gdksettings.c |
| 471 | |
| 472 | +MAINTAINERCLEANFILES = gdkx.h |
| 473 | + |
| 474 | -include $(top_srcdir)/git.mk |
| 475 | diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c |
| 476 | index de91c64..42d50f6 100644 |
| 477 | --- a/gdk/x11/gdkdisplay-x11.c |
| 478 | +++ b/gdk/x11/gdkdisplay-x11.c |
| 479 | @@ -37,7 +37,9 @@ |
| 480 | #include "gdkdisplay-x11.h" |
| 481 | #include "gdkprivate-x11.h" |
| 482 | #include "gdkscreen-x11.h" |
| 483 | +#ifdef HAVE_OPENGL |
| 484 | #include "gdkglcontext-x11.h" |
| 485 | +#endif |
| 486 | #include "gdk-private.h" |
| 487 | |
| 488 | #include <glib.h> |
| 489 | @@ -2959,7 +2961,9 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) |
| 490 | display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list; |
| 491 | display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target; |
| 492 | |
| 493 | - display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current; |
| 494 | +#ifdef HAVE_OPENGL |
| 495 | + display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current; |
| 496 | +#endif |
| 497 | |
| 498 | display_class->get_default_seat = gdk_x11_display_get_default_seat; |
| 499 | |
| 500 | diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c |
| 501 | index 9d8ed20..bd46b00 100644 |
| 502 | --- a/gdk/x11/gdkscreen-x11.c |
| 503 | +++ b/gdk/x11/gdkscreen-x11.c |
| 504 | @@ -1968,3 +1968,8 @@ gdk_x11_screen_get_current_desktop (GdkScreen *screen) |
| 505 | { |
| 506 | return get_netwm_cardinal_property (screen, "_NET_CURRENT_DESKTOP"); |
| 507 | } |
| 508 | + |
| 509 | +#ifndef HAVE_OPENGL |
| 510 | +/* Function from in gdk/x11/gdkglcontext-x11.c */ |
| 511 | +void _gdk_x11_screen_update_visuals_for_gl (GdkScreen *screen) {} |
| 512 | +#endif |
| 513 | diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c |
| 514 | index 9ed087a..30d6eb7 100644 |
| 515 | --- a/gdk/x11/gdkwindow-x11.c |
| 516 | +++ b/gdk/x11/gdkwindow-x11.c |
| 517 | @@ -36,7 +36,9 @@ |
| 518 | #include "gdkasync.h" |
| 519 | #include "gdkeventsource.h" |
| 520 | #include "gdkdisplay-x11.h" |
| 521 | +#ifdef HAVE_OPENGL |
| 522 | #include "gdkglcontext-x11.h" |
| 523 | +#endif |
| 524 | #include "gdkprivate-x11.h" |
| 525 | #include "gdk-private.h" |
| 526 | |
| 527 | @@ -5782,7 +5784,9 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) |
| 528 | impl_class->set_opaque_region = gdk_x11_window_set_opaque_region; |
| 529 | impl_class->set_shadow_width = gdk_x11_window_set_shadow_width; |
| 530 | impl_class->show_window_menu = gdk_x11_window_show_window_menu; |
| 531 | +#ifdef HAVE_OPENGL |
| 532 | impl_class->create_gl_context = gdk_x11_window_create_gl_context; |
| 533 | impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame; |
| 534 | +#endif |
| 535 | impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size; |
| 536 | } |
| 537 | diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h |
| 538 | index edb0ea7..a317d61 100644 |
| 539 | --- a/gdk/x11/gdkx-autocleanups.h |
| 540 | +++ b/gdk/x11/gdkx-autocleanups.h |
| 541 | @@ -30,7 +30,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref) |
| 542 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref) |
| 543 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DisplayManager, g_object_unref) |
| 544 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref) |
| 545 | +#ifdef HAVE_OPENGL |
| 546 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref) |
| 547 | +#endif |
| 548 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref) |
| 549 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref) |
| 550 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Visual, g_object_unref) |
| 551 | diff --git a/gdk/x11/gdkx-with-gl-context.h b/gdk/x11/gdkx-with-gl-context.h |
| 552 | new file mode 100644 |
| 553 | index 0000000..ae05fa6 |
| 554 | --- /dev/null |
| 555 | +++ b/gdk/x11/gdkx-with-gl-context.h |
| 556 | @@ -0,0 +1,59 @@ |
| 557 | +/* GDK - The GIMP Drawing Kit |
| 558 | + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 559 | + * |
| 560 | + * This library is free software; you can redistribute it and/or |
| 561 | + * modify it under the terms of the GNU Lesser General Public |
| 562 | + * License as published by the Free Software Foundation; either |
| 563 | + * version 2 of the License, or (at your option) any later version. |
| 564 | + * |
| 565 | + * This library is distributed in the hope that it will be useful, |
| 566 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 567 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 568 | + * Lesser General Public License for more details. |
| 569 | + * |
| 570 | + * You should have received a copy of the GNU Lesser General Public |
| 571 | + * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 572 | + */ |
| 573 | + |
| 574 | +/* |
| 575 | + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 576 | + * file for a list of people on the GTK+ Team. See the ChangeLog |
| 577 | + * files for a list of changes. These files are distributed with |
| 578 | + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 579 | + */ |
| 580 | + |
| 581 | +#ifndef __GDK_X_H__ |
| 582 | +#define __GDK_X_H__ |
| 583 | + |
| 584 | +#include <gdk/gdk.h> |
| 585 | + |
| 586 | +#include <X11/Xlib.h> |
| 587 | +#include <X11/Xutil.h> |
| 588 | + |
| 589 | +#define __GDKX_H_INSIDE__ |
| 590 | + |
| 591 | +#include <gdk/x11/gdkx11applaunchcontext.h> |
| 592 | +#include <gdk/x11/gdkx11cursor.h> |
| 593 | +#include <gdk/x11/gdkx11device.h> |
| 594 | +#include <gdk/x11/gdkx11device-core.h> |
| 595 | +#include <gdk/x11/gdkx11device-xi2.h> |
| 596 | +#include <gdk/x11/gdkx11devicemanager.h> |
| 597 | +#include <gdk/x11/gdkx11devicemanager-core.h> |
| 598 | +#include <gdk/x11/gdkx11devicemanager-xi2.h> |
| 599 | +#include <gdk/x11/gdkx11display.h> |
| 600 | +#include <gdk/x11/gdkx11displaymanager.h> |
| 601 | +#include <gdk/x11/gdkx11dnd.h> |
| 602 | +#include <gdk/x11/gdkx11glcontext.h> |
| 603 | +#include <gdk/x11/gdkx11keys.h> |
| 604 | +#include <gdk/x11/gdkx11property.h> |
| 605 | +#include <gdk/x11/gdkx11screen.h> |
| 606 | +#include <gdk/x11/gdkx11selection.h> |
| 607 | +#include <gdk/x11/gdkx11utils.h> |
| 608 | +#include <gdk/x11/gdkx11visual.h> |
| 609 | +#include <gdk/x11/gdkx11window.h> |
| 610 | + |
| 611 | +#include <gdk/x11/gdkx-autocleanups.h> |
| 612 | + |
| 613 | +#undef __GDKX_H_INSIDE__ |
| 614 | + |
| 615 | +#endif /* __GDK_X_H__ */ |
| 616 | diff --git a/gdk/x11/gdkx-without-gl-context.h b/gdk/x11/gdkx-without-gl-context.h |
| 617 | new file mode 100644 |
| 618 | index 0000000..c9e2617 |
| 619 | --- /dev/null |
| 620 | +++ b/gdk/x11/gdkx-without-gl-context.h |
| 621 | @@ -0,0 +1,58 @@ |
| 622 | +/* GDK - The GIMP Drawing Kit |
| 623 | + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 624 | + * |
| 625 | + * This library is free software; you can redistribute it and/or |
| 626 | + * modify it under the terms of the GNU Lesser General Public |
| 627 | + * License as published by the Free Software Foundation; either |
| 628 | + * version 2 of the License, or (at your option) any later version. |
| 629 | + * |
| 630 | + * This library is distributed in the hope that it will be useful, |
| 631 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 632 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 633 | + * Lesser General Public License for more details. |
| 634 | + * |
| 635 | + * You should have received a copy of the GNU Lesser General Public |
| 636 | + * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 637 | + */ |
| 638 | + |
| 639 | +/* |
| 640 | + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 641 | + * file for a list of people on the GTK+ Team. See the ChangeLog |
| 642 | + * files for a list of changes. These files are distributed with |
| 643 | + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 644 | + */ |
| 645 | + |
| 646 | +#ifndef __GDK_X_H__ |
| 647 | +#define __GDK_X_H__ |
| 648 | + |
| 649 | +#include <gdk/gdk.h> |
| 650 | + |
| 651 | +#include <X11/Xlib.h> |
| 652 | +#include <X11/Xutil.h> |
| 653 | + |
| 654 | +#define __GDKX_H_INSIDE__ |
| 655 | + |
| 656 | +#include <gdk/x11/gdkx11applaunchcontext.h> |
| 657 | +#include <gdk/x11/gdkx11cursor.h> |
| 658 | +#include <gdk/x11/gdkx11device.h> |
| 659 | +#include <gdk/x11/gdkx11device-core.h> |
| 660 | +#include <gdk/x11/gdkx11device-xi2.h> |
| 661 | +#include <gdk/x11/gdkx11devicemanager.h> |
| 662 | +#include <gdk/x11/gdkx11devicemanager-core.h> |
| 663 | +#include <gdk/x11/gdkx11devicemanager-xi2.h> |
| 664 | +#include <gdk/x11/gdkx11display.h> |
| 665 | +#include <gdk/x11/gdkx11displaymanager.h> |
| 666 | +#include <gdk/x11/gdkx11dnd.h> |
| 667 | +#include <gdk/x11/gdkx11keys.h> |
| 668 | +#include <gdk/x11/gdkx11property.h> |
| 669 | +#include <gdk/x11/gdkx11screen.h> |
| 670 | +#include <gdk/x11/gdkx11selection.h> |
| 671 | +#include <gdk/x11/gdkx11utils.h> |
| 672 | +#include <gdk/x11/gdkx11visual.h> |
| 673 | +#include <gdk/x11/gdkx11window.h> |
| 674 | + |
| 675 | +#include <gdk/x11/gdkx-autocleanups.h> |
| 676 | + |
| 677 | +#undef __GDKX_H_INSIDE__ |
| 678 | + |
| 679 | +#endif /* __GDK_X_H__ */ |
| 680 | diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h |
| 681 | deleted file mode 100644 |
| 682 | index ae05fa6..0000000 |
| 683 | --- a/gdk/x11/gdkx.h |
| 684 | +++ /dev/null |
| 685 | @@ -1,59 +0,0 @@ |
| 686 | -/* GDK - The GIMP Drawing Kit |
| 687 | - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 688 | - * |
| 689 | - * This library is free software; you can redistribute it and/or |
| 690 | - * modify it under the terms of the GNU Lesser General Public |
| 691 | - * License as published by the Free Software Foundation; either |
| 692 | - * version 2 of the License, or (at your option) any later version. |
| 693 | - * |
| 694 | - * This library is distributed in the hope that it will be useful, |
| 695 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 696 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 697 | - * Lesser General Public License for more details. |
| 698 | - * |
| 699 | - * You should have received a copy of the GNU Lesser General Public |
| 700 | - * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 701 | - */ |
| 702 | - |
| 703 | -/* |
| 704 | - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 705 | - * file for a list of people on the GTK+ Team. See the ChangeLog |
| 706 | - * files for a list of changes. These files are distributed with |
| 707 | - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 708 | - */ |
| 709 | - |
| 710 | -#ifndef __GDK_X_H__ |
| 711 | -#define __GDK_X_H__ |
| 712 | - |
| 713 | -#include <gdk/gdk.h> |
| 714 | - |
| 715 | -#include <X11/Xlib.h> |
| 716 | -#include <X11/Xutil.h> |
| 717 | - |
| 718 | -#define __GDKX_H_INSIDE__ |
| 719 | - |
| 720 | -#include <gdk/x11/gdkx11applaunchcontext.h> |
| 721 | -#include <gdk/x11/gdkx11cursor.h> |
| 722 | -#include <gdk/x11/gdkx11device.h> |
| 723 | -#include <gdk/x11/gdkx11device-core.h> |
| 724 | -#include <gdk/x11/gdkx11device-xi2.h> |
| 725 | -#include <gdk/x11/gdkx11devicemanager.h> |
| 726 | -#include <gdk/x11/gdkx11devicemanager-core.h> |
| 727 | -#include <gdk/x11/gdkx11devicemanager-xi2.h> |
| 728 | -#include <gdk/x11/gdkx11display.h> |
| 729 | -#include <gdk/x11/gdkx11displaymanager.h> |
| 730 | -#include <gdk/x11/gdkx11dnd.h> |
| 731 | -#include <gdk/x11/gdkx11glcontext.h> |
| 732 | -#include <gdk/x11/gdkx11keys.h> |
| 733 | -#include <gdk/x11/gdkx11property.h> |
| 734 | -#include <gdk/x11/gdkx11screen.h> |
| 735 | -#include <gdk/x11/gdkx11selection.h> |
| 736 | -#include <gdk/x11/gdkx11utils.h> |
| 737 | -#include <gdk/x11/gdkx11visual.h> |
| 738 | -#include <gdk/x11/gdkx11window.h> |
| 739 | - |
| 740 | -#include <gdk/x11/gdkx-autocleanups.h> |
| 741 | - |
| 742 | -#undef __GDKX_H_INSIDE__ |
| 743 | - |
| 744 | -#endif /* __GDK_X_H__ */ |
| 745 | diff --git a/gtk/Makefile.am b/gtk/Makefile.am |
| 746 | index 6a53a2b..49a35e6 100644 |
| 747 | --- a/gtk/Makefile.am |
| 748 | +++ b/gtk/Makefile.am |
| 749 | @@ -1351,14 +1351,13 @@ gtkprivatetypebuiltins.c: $(gtk_private_type_h_sources) gtkprivatetypebuiltins. |
| 750 | && cp xgen-gptbc gtkprivatetypebuiltins.c \ |
| 751 | && rm -f xgen-gptbc |
| 752 | |
| 753 | - |
| 754 | 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 |
| 755 | $(AM_V_GEN) (echo '#undef GTK_COMPILATION' && echo '#include <gtk/gtkx.h>') > xgen-gtfsrc.c && \ |
| 756 | echo 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS' > xgen-gtf && \ |
| 757 | ${CPP} $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \ |
| 758 | $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \ |
| 759 | sort | uniq | \ |
| 760 | - $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; }' >> xgen-gtf \ |
| 761 | + $(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 \ |
| 762 | && cp xgen-gtf $@ && rm -f xgen-gtf |
| 763 | gtktestutils.c: gtktypefuncs.c |
| 764 | |
| 765 | diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c |
| 766 | index 245fc6b..4214ad1 100644 |
| 767 | --- a/gtk/gtkglarea.c |
| 768 | +++ b/gtk/gtkglarea.c |
| 769 | @@ -28,7 +28,9 @@ |
| 770 | #include "gtkprivate.h" |
| 771 | #include "gtkrender.h" |
| 772 | |
| 773 | +#ifdef HAVE_OPENGL |
| 774 | #include <epoxy/gl.h> |
| 775 | +#endif |
| 776 | |
| 777 | /** |
| 778 | * SECTION:gtkglarea |
| 779 | @@ -357,9 +359,12 @@ gtk_gl_area_real_create_context (GtkGLArea *area) |
| 780 | static void |
| 781 | gtk_gl_area_resize (GtkGLArea *area, int width, int height) |
| 782 | { |
| 783 | +#ifdef HAVE_OPENGL |
| 784 | glViewport (0, 0, width, height); |
| 785 | +#endif |
| 786 | } |
| 787 | |
| 788 | +#ifdef HAVE_OPENGL |
| 789 | /* |
| 790 | * Creates all the buffer objects needed for rendering the scene |
| 791 | */ |
| 792 | @@ -467,6 +472,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area) |
| 793 | |
| 794 | priv->needs_render = TRUE; |
| 795 | } |
| 796 | +#endif |
| 797 | |
| 798 | /** |
| 799 | * gtk_gl_area_attach_buffers: |
| 800 | @@ -485,6 +491,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area) |
| 801 | void |
| 802 | gtk_gl_area_attach_buffers (GtkGLArea *area) |
| 803 | { |
| 804 | +#ifdef HAVE_OPENGL |
| 805 | GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); |
| 806 | |
| 807 | g_return_if_fail (GTK_IS_GL_AREA (area)); |
| 808 | @@ -517,11 +524,13 @@ gtk_gl_area_attach_buffers (GtkGLArea *area) |
| 809 | glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, |
| 810 | GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer); |
| 811 | } |
| 812 | +#endif |
| 813 | } |
| 814 | |
| 815 | static void |
| 816 | gtk_gl_area_delete_buffers (GtkGLArea *area) |
| 817 | { |
| 818 | +#ifdef HAVE_OPENGL |
| 819 | GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); |
| 820 | |
| 821 | if (priv->context == NULL) |
| 822 | @@ -553,6 +562,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area) |
| 823 | glDeleteFramebuffersEXT (1, &priv->frame_buffer); |
| 824 | priv->frame_buffer = 0; |
| 825 | } |
| 826 | +#endif |
| 827 | } |
| 828 | |
| 829 | static void |
| 830 | @@ -663,6 +673,7 @@ gtk_gl_area_draw (GtkWidget *widget, |
| 831 | GtkGLArea *area = GTK_GL_AREA (widget); |
| 832 | GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); |
| 833 | gboolean unused; |
| 834 | +#ifdef HAVE_OPENGL |
| 835 | int w, h, scale; |
| 836 | GLenum status; |
| 837 | |
| 838 | @@ -674,7 +685,6 @@ gtk_gl_area_draw (GtkWidget *widget, |
| 839 | gtk_widget_get_allocated_height (widget)); |
| 840 | return FALSE; |
| 841 | } |
| 842 | - |
| 843 | if (priv->context == NULL) |
| 844 | return FALSE; |
| 845 | |
| 846 | @@ -720,6 +730,14 @@ gtk_gl_area_draw (GtkWidget *widget, |
| 847 | } |
| 848 | |
| 849 | return TRUE; |
| 850 | +#else |
| 851 | + if (priv->error != NULL) |
| 852 | + gtk_gl_area_draw_error_screen (area, |
| 853 | + cr, |
| 854 | + gtk_widget_get_allocated_width (widget), |
| 855 | + gtk_widget_get_allocated_height (widget)); |
| 856 | + return FALSE; |
| 857 | +#endif |
| 858 | } |
| 859 | |
| 860 | static gboolean |
| 861 | diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c |
| 862 | index 4eab3a7..c4e900e 100644 |
| 863 | --- a/gtk/inspector/general.c |
| 864 | +++ b/gtk/inspector/general.c |
| 865 | @@ -33,8 +33,10 @@ |
| 866 | |
| 867 | #ifdef GDK_WINDOWING_X11 |
| 868 | #include "x11/gdkx.h" |
| 869 | +#ifdef HAVE_OPENGL |
| 870 | #include <epoxy/glx.h> |
| 871 | #endif |
| 872 | +#endif |
| 873 | |
| 874 | #ifdef GDK_WINDOWING_WIN32 |
| 875 | #include "win32/gdkwin32.h" |
| 876 | @@ -147,6 +149,7 @@ append_extension_row (GtkInspectorGeneral *gen, |
| 877 | gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->priv->labels), label); |
| 878 | } |
| 879 | |
| 880 | +#ifdef HAVE_OPENGL |
| 881 | #ifdef GDK_WINDOWING_X11 |
| 882 | static void |
| 883 | append_glx_extension_row (GtkInspectorGeneral *gen, |
| 884 | @@ -156,6 +159,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen, |
| 885 | append_extension_row (gen, ext, epoxy_has_glx_extension (dpy, 0, ext)); |
| 886 | } |
| 887 | #endif |
| 888 | +#endif |
| 889 | |
| 890 | #ifdef GDK_WINDOWING_WAYLAND |
| 891 | static void |
| 892 | @@ -171,6 +175,7 @@ append_egl_extension_row (GtkInspectorGeneral *gen, |
| 893 | static void |
| 894 | init_gl (GtkInspectorGeneral *gen) |
| 895 | { |
| 896 | +#ifdef HAVE_OPENGL |
| 897 | #ifdef GDK_WINDOWING_X11 |
| 898 | if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) |
| 899 | { |
| 900 | @@ -197,6 +202,7 @@ init_gl (GtkInspectorGeneral *gen) |
| 901 | } |
| 902 | else |
| 903 | #endif |
| 904 | +#endif |
| 905 | #ifdef GDK_WINDOWING_WAYLAND |
| 906 | if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) |
| 907 | { |
| 908 | diff --git a/tests/Makefile.am b/tests/Makefile.am |
| 909 | index 681807d..2941a36 100644 |
| 910 | --- a/tests/Makefile.am |
| 911 | +++ b/tests/Makefile.am |
| 912 | @@ -80,8 +80,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \ |
| 913 | testfullscreen \ |
| 914 | testgeometry \ |
| 915 | testgiconpixbuf \ |
| 916 | - testglarea \ |
| 917 | - testglblending \ |
| 918 | testgrid \ |
| 919 | testgtk \ |
| 920 | testheaderbar \ |
| 921 | @@ -169,11 +167,17 @@ noinst_PROGRAMS = $(TEST_PROGS) \ |
| 922 | testactionbar \ |
| 923 | testwindowsize \ |
| 924 | testpopover \ |
| 925 | - gdkgears \ |
| 926 | listmodel \ |
| 927 | testpopup \ |
| 928 | $(NULL) |
| 929 | |
| 930 | +if HAVE_OPENGL |
| 931 | +noinst_PROGRAMS += |
| 932 | + testglarea \ |
| 933 | + testglblending \ |
| 934 | + gdkgears |
| 935 | +endif |
| 936 | + |
| 937 | if USE_X11 |
| 938 | noinst_PROGRAMS += testerrors |
| 939 | endif |
| 940 | diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c |
| 941 | index e0ebee0..703643c 100644 |
| 942 | --- a/testsuite/gtk/objects-finalize.c |
| 943 | +++ b/testsuite/gtk/objects-finalize.c |
| 944 | @@ -115,8 +115,10 @@ main (int argc, char **argv) |
| 945 | all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_CORE && |
| 946 | all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 && |
| 947 | all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER && |
| 948 | +#ifdef HAVE_OPENGL |
| 949 | all_types[i] != GDK_TYPE_X11_GL_CONTEXT && |
| 950 | #endif |
| 951 | +#endif |
| 952 | /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */ |
| 953 | all_types[i] != GDK_TYPE_PIXBUF_LOADER && |
| 954 | all_types[i] != gdk_pixbuf_simple_anim_iter_get_type()) |