blob: 80dc2d7a05bde6c89e58407ff73580e68ac11f5e [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 6575ab0f0e8c1bba033ad1616511e37a2ec995ff Mon Sep 17 00:00:00 2001
Patrick Williamsc0f7c042017-02-23 20:41:17 -06002From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Fri, 16 Oct 2015 16:35:16 +0300
Andrew Geissler82c905d2020-04-13 13:39:40 -05004Subject: [PATCH] Do not try to initialize GL without libGL
Patrick Williamsc0f7c042017-02-23 20:41:17 -06005
6_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys
7GLX api which will exit() if libGL.so.1 is not present. We do not
8want that to happen and we don't want every app to have to set
9"GDK_GL=disabled" environment variable: so use #ifdef set based on
10opengl distro feature.
11
12Upstream is not interested in the fix as it is: Either epoxy should be
13fixed (to not exit) or GTK+ possibly could do some additional probing
14before calling epoxy APIs.
15
16Upstream-Status: Denied
17Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -040018
Patrick Williamsc0f7c042017-02-23 20:41:17 -060019---
Brad Bishop316dfdd2018-06-25 12:45:53 -040020 configure.ac | 6 ++++++
Patrick Williamsc0f7c042017-02-23 20:41:17 -060021 gdk/x11/gdkvisual-x11.c | 5 +++++
Brad Bishop316dfdd2018-06-25 12:45:53 -040022 2 files changed, 11 insertions(+)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060023
24diff --git a/configure.ac b/configure.ac
Andrew Geissler82c905d2020-04-13 13:39:40 -050025index e9f5583..bd651bb 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -060026--- a/configure.ac
27+++ b/configure.ac
Andrew Geissler82c905d2020-04-13 13:39:40 -050028@@ -346,6 +346,12 @@ AC_ARG_ENABLE(cloudproviders,
Brad Bishop316dfdd2018-06-25 12:45:53 -040029 [AS_HELP_STRING([--enable-cloudproviders],
30 [enable libcloudproviders integration])],
31 [cloudproviders_set=yes])
Patrick Williamsc0f7c042017-02-23 20:41:17 -060032+AC_ARG_ENABLE(glx,
33+ [AS_HELP_STRING([--enable-glx],
34+ [When enabled Gdk will try to initialize GLX])])
35+AS_IF([test "x$enable_glx" != "xno"], [
36+ AC_DEFINE([HAVE_GLX], [], [GLX will be available at runtime])
37+])
Brad Bishop316dfdd2018-06-25 12:45:53 -040038
Andrew Geissler82c905d2020-04-13 13:39:40 -050039 AC_ARG_ENABLE(profiler,
40 [AS_HELP_STRING([--enable-profiler],
Patrick Williamsc0f7c042017-02-23 20:41:17 -060041diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
42index 81479d8..3c8c5c0 100644
43--- a/gdk/x11/gdkvisual-x11.c
44+++ b/gdk/x11/gdkvisual-x11.c
45@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
46 /* If GL is available we want to pick better default/rgba visuals,
47 as we care about glx details such as alpha/depth/stencil depth,
48 stereo and double buffering */
49+ /* update_visuals_for_gl() will end up calling epoxy GLX api which
50+ will exit if libgl is not there: so only do this if we know GL
51+ is available */
52+#ifdef HAVE_GLX
53 _gdk_x11_screen_update_visuals_for_gl (screen);
54+#endif
55 }
56
57 gint