aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch
blob: 989716e5137449f943d1cf42802e0f2abecb0432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From d63b926f8c8d8b5c9f9ec33d078b775f0409d88a Mon Sep 17 00:00:00 2001
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date: Fri, 16 Oct 2015 16:35:16 +0300
Subject: [PATCH 2/4] Do not try to initialize GL without libGL

_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys
GLX api which will exit() if libGL.so.1 is not present. We do not
want that to happen and we don't want every app to have to set
"GDK_GL=disabled" environment variable: so use #ifdef set based on
opengl distro feature.

Upstream is not interested in the fix as it is: Either epoxy should be
fixed (to not exit) or GTK+ possibly could do some additional probing
before calling epoxy APIs.

Upstream-Status: Denied
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
 configure.ac            | 7 +++++++
 gdk/x11/gdkvisual-x11.c | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/configure.ac b/configure.ac
index b6931d6..e27da49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,6 +342,13 @@ AC_ARG_ENABLE(mir-backend,
                               [enable the Mir gdk backend])],
 			      [backend_set=yes])
 
+AC_ARG_ENABLE(glx,
+              [AS_HELP_STRING([--enable-glx],
+                              [When enabled Gdk will try to initialize GLX])])
+AS_IF([test "x$enable_glx" != "xno"], [
+  AC_DEFINE([HAVE_GLX], [], [GLX will be available at runtime])
+])
+
 if test -z "$backend_set"; then
   if test "$platform_win32" = yes; then
     enable_win32_backend=yes
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
index 81479d8..3c8c5c0 100644
--- a/gdk/x11/gdkvisual-x11.c
+++ b/gdk/x11/gdkvisual-x11.c
@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
   /* If GL is available we want to pick better default/rgba visuals,
      as we care about glx details such as alpha/depth/stencil depth,
      stereo and double buffering */
+  /* update_visuals_for_gl() will end up calling epoxy GLX api which
+     will exit if libgl is not there: so only do this if we know GL
+     is available */
+#ifdef HAVE_GLX
   _gdk_x11_screen_update_visuals_for_gl (screen);
+#endif
 }
 
 gint
-- 
2.1.4