[gnome-control-center] details: Don't crash on Wayland



commit 71a8d89457487138d2c4650a8cce015797fb29ad
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 21 14:12:12 2014 -0400

    details: Don't crash on Wayland
    
    We were just assuming that there is an X server around. This may
    not be the case anymore, so check, and deal with running under
    Wayland. For now, we just say 'Wayland'. We should do better here,
    eventually.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728672

 panels/info/cc-info-panel.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 2d09453..667b3de 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -34,6 +34,7 @@
 #include <glibtop/mem.h>
 #include <glibtop/sysinfo.h>
 
+#include <gdk/gdkwayland.h>
 #include <gdk/gdkx.h>
 #include <GL/gl.h>
 #include <GL/glx.h>
@@ -426,11 +427,32 @@ static GraphicsData *
 get_graphics_data (void)
 {
   GraphicsData *result;
+  GdkDisplay *display;
 
   result = g_slice_new0 (GraphicsData);
 
-  result->glx_renderer = get_graphics_data_glx_renderer ();
-  result->xorg_vesa_hardware = get_graphics_data_xorg_vesa_hardware ();
+  display = gdk_display_get_default ();
+
+#ifdef GDK_WINDOWING_X11
+  if (GDK_IS_X11_DISPLAY (display))
+    {
+      result->glx_renderer = get_graphics_data_glx_renderer ();
+      result->xorg_vesa_hardware = get_graphics_data_xorg_vesa_hardware ();
+    }
+  else
+#endif
+#ifdef GDK_WINDOWING_WAYLAND
+  if (GDK_IS_WAYLAND_DISPLAY (display))
+    {
+      result->glx_renderer = _("Wayland");
+      result->xorg_vesa_hardware = NULL;
+    }
+  else
+#endif
+    {
+      result->glx_renderer = NULL;
+      result->xorg_vesa_hardware = NULL;
+    }
 
   if (result->xorg_vesa_hardware != NULL)
     result->hardware_string = result->xorg_vesa_hardware;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]