ecore-wl2: Only bind one shell
authorChris Michael <cp.michael@samsung.com>
Tue, 28 Feb 2017 13:40:26 +0000 (08:40 -0500)
committerChris Michael <cp.michael@samsung.com>
Tue, 28 Feb 2017 13:40:26 +0000 (08:40 -0500)
Since we only ever use One shell at a time, let's not bind all of them
as that is useless.

ref T5226

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wl2/ecore_wl2_display.c

index cade757..4ca8ee9 100644 (file)
@@ -8,6 +8,7 @@
 
 static Eina_Hash *_server_displays = NULL;
 static Eina_Hash *_client_displays = NULL;
+static Eina_Bool _shell_bound = EINA_FALSE;
 
 static Eina_Bool _cb_connect_idle(void *data);
 static Eina_Bool _cb_connect_data(void *data, Ecore_Fd_Handler *hdl);
@@ -152,12 +153,13 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
         ewd->wl.data_device_manager =
           wl_registry_bind(registry, id, &wl_data_device_manager_interface, ewd->wl.data_device_manager_version);
      }
-   else if (!strcmp(interface, "wl_shell"))
+   else if ((!strcmp(interface, "wl_shell")) && (!_shell_bound))
      {
         ewd->wl.wl_shell =
           wl_registry_bind(registry, id, &wl_shell_interface, 1);
+        _shell_bound = EINA_TRUE;
      }
-   else if ((!strcmp(interface, "xdg_shell")) &&
+   else if (((!strcmp(interface, "xdg_shell")) && (!_shell_bound)) &&
             (!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
      {
         Ecore_Wl2_Window *window;
@@ -168,6 +170,8 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
                                        XDG_V5_UNSTABLE_VERSION);
         xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL);
 
+        _shell_bound = EINA_TRUE;
+
         EINA_INLIST_FOREACH(ewd->windows, window)
           if ((window->type != ECORE_WL2_WINDOW_TYPE_DND) &&
               (window->type != ECORE_WL2_WINDOW_TYPE_NONE))
@@ -175,12 +179,13 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
           else
             window->pending.configure = EINA_FALSE;
      }
-   else if (!strcmp(interface, "zxdg_shell_v6"))
+   else if ((!strcmp(interface, "zxdg_shell_v6")) && (!_shell_bound))
      {
         ewd->wl.zxdg_shell =
           wl_registry_bind(registry, id, &zxdg_shell_v6_interface, 1);
         zxdg_shell_v6_add_listener(ewd->wl.zxdg_shell,
                                    &_zxdg_shell_listener, NULL);
+        _shell_bound = EINA_TRUE;
      }
    else if ((eina_streq(interface, "www")) &&
             (getenv("EFL_WAYLAND_ENABLE_WWW")))