[gtk+] wayland: check for support of xdg_shell interface



commit 5a253c546ad9f7f94130bfd0e9dfbe40e171f524
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Thu Feb 18 12:00:23 2016 +0100

    wayland: check for support of xdg_shell interface
    
    When running with a Wayland compositor which doesn't support the
    xdg_shell interface, gtk+ will segfault while trying to access the
    corresponding wl proxy.
    
    Check for xdg_shell support and do not use Wayland if not present, so
    that it can fallback to X11, hoping that Xwayland is usable.
    
    Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762258

 gdk/wayland/gdkdisplay-wayland.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index db02c73..9577d10 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -444,6 +444,16 @@ _gdk_wayland_display_open (const gchar *display_name)
         }
     }
 
+  /* Make sure we have xdg_shell at least */
+  if (display_wayland->xdg_shell == NULL)
+    {
+      g_warning ("Wayland compositor does not support xdg_shell interface,"
+                 " not using Wayland display");
+      g_object_unref (display);
+
+      return NULL;
+    }
+
   gdk_input_init (display);
 
   display_wayland->selection = gdk_wayland_selection_new ();


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