1*4882a593SmuzhiyunFrom 6575ab0f0e8c1bba033ad1616511e37a2ec995ff Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Jussi Kukkonen <jussi.kukkonen@intel.com>
3*4882a593SmuzhiyunDate: Fri, 16 Oct 2015 16:35:16 +0300
4*4882a593SmuzhiyunSubject: [PATCH] Do not try to initialize GL without libGL
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys
7*4882a593SmuzhiyunGLX api which will exit() if libGL.so.1 is not present. We do not
8*4882a593Smuzhiyunwant that to happen and we don't want every app to have to set
9*4882a593Smuzhiyun"GDK_GL=disabled" environment variable: so use #ifdef set based on
10*4882a593Smuzhiyunopengl distro feature.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunUpstream is not interested in the fix as it is: Either epoxy should be
13*4882a593Smuzhiyunfixed (to not exit) or GTK+ possibly could do some additional probing
14*4882a593Smuzhiyunbefore calling epoxy APIs.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunUpstream-Status: Denied
17*4882a593SmuzhiyunSigned-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun---
20*4882a593Smuzhiyun configure.ac            | 6 ++++++
21*4882a593Smuzhiyun gdk/x11/gdkvisual-x11.c | 5 +++++
22*4882a593Smuzhiyun 2 files changed, 11 insertions(+)
23*4882a593Smuzhiyun
24*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
25*4882a593Smuzhiyunindex e9f5583..bd651bb 100644
26*4882a593Smuzhiyun--- a/configure.ac
27*4882a593Smuzhiyun+++ b/configure.ac
28*4882a593Smuzhiyun@@ -346,6 +346,12 @@ AC_ARG_ENABLE(cloudproviders,
29*4882a593Smuzhiyun               [AS_HELP_STRING([--enable-cloudproviders],
30*4882a593Smuzhiyun                               [enable libcloudproviders integration])],
31*4882a593Smuzhiyun                               [cloudproviders_set=yes])
32*4882a593Smuzhiyun+AC_ARG_ENABLE(glx,
33*4882a593Smuzhiyun+              [AS_HELP_STRING([--enable-glx],
34*4882a593Smuzhiyun+                              [When enabled Gdk will try to initialize GLX])])
35*4882a593Smuzhiyun+AS_IF([test "x$enable_glx" != "xno"], [
36*4882a593Smuzhiyun+  AC_DEFINE([HAVE_GLX], [], [GLX will be available at runtime])
37*4882a593Smuzhiyun+])
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun AC_ARG_ENABLE(profiler,
40*4882a593Smuzhiyun               [AS_HELP_STRING([--enable-profiler],
41*4882a593Smuzhiyundiff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
42*4882a593Smuzhiyunindex 81479d8..3c8c5c0 100644
43*4882a593Smuzhiyun--- a/gdk/x11/gdkvisual-x11.c
44*4882a593Smuzhiyun+++ b/gdk/x11/gdkvisual-x11.c
45*4882a593Smuzhiyun@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
46*4882a593Smuzhiyun   /* If GL is available we want to pick better default/rgba visuals,
47*4882a593Smuzhiyun      as we care about glx details such as alpha/depth/stencil depth,
48*4882a593Smuzhiyun      stereo and double buffering */
49*4882a593Smuzhiyun+  /* update_visuals_for_gl() will end up calling epoxy GLX api which
50*4882a593Smuzhiyun+     will exit if libgl is not there: so only do this if we know GL
51*4882a593Smuzhiyun+     is available */
52*4882a593Smuzhiyun+#ifdef HAVE_GLX
53*4882a593Smuzhiyun   _gdk_x11_screen_update_visuals_for_gl (screen);
54*4882a593Smuzhiyun+#endif
55*4882a593Smuzhiyun }
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun gint
58