[cogl/cogl-1.22: 1/2] wayland: do not require wl_shell



commit 3809e7b3875ae688e0febe927e4afb71e7e4e841
Author: Ilia Bozhinov <ammen99 gmail com>
Date:   Fri Jan 25 15:50:29 2019 +0100

    wayland: do not require wl_shell
    
    Most of the time when cogl is used, the app doesn't really need this
    functionality (i.e it manages the app window on its own). So requiring
    wl_shell turns out to prevent apps using for ex. xdg-shell from working
    on compositors that do not support wl_shell.

 cogl/winsys/cogl-winsys-egl-wayland.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c
index dad7b1e4..7f4999d0 100644
--- a/cogl/winsys/cogl-winsys-egl-wayland.c
+++ b/cogl/winsys/cogl-winsys-egl-wayland.c
@@ -279,12 +279,12 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
    * compostor and shell object.
    */
   wl_display_roundtrip (wayland_renderer->wayland_display);
-  if (!wayland_renderer->wayland_compositor || !wayland_renderer->wayland_shell)
+  if (!wayland_renderer->wayland_compositor)
     {
       _cogl_set_error (error,
                        COGL_WINSYS_ERROR,
                        COGL_WINSYS_ERROR_INIT,
-                       "Unable to find wl_compositor or wl_shell");
+                       "Unable to find wl_compositor");
       goto error;
     }
 
@@ -520,9 +520,19 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
                             NULL);
 
   if (!onscreen->foreign_surface)
-    wayland_onscreen->wayland_shell_surface =
-      wl_shell_get_shell_surface (wayland_renderer->wayland_shell,
-                                  wayland_onscreen->wayland_surface);
+    {
+      if (!wayland_renderer->wayland_shell)
+        {
+          _cogl_set_error (error, COGL_WINSYS_ERROR,
+              COGL_WINSYS_ERROR_CREATE_ONSCREEN,
+              "No foreign surface, and wl_shell unsupported by the compositor");
+          return FALSE;
+        }
+
+      wayland_onscreen->wayland_shell_surface =
+        wl_shell_get_shell_surface (wayland_renderer->wayland_shell,
+                                    wayland_onscreen->wayland_surface);
+    }
 
   return TRUE;
 }


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