ecore-wl2: Add support for binding various wayland interfaces
authorChris Michael <cp.michael@samsung.com>
Wed, 19 Aug 2015 17:48:19 +0000 (13:48 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 3 Dec 2015 17:02:40 +0000 (12:02 -0500)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wl2/ecore_wl2_display.c
src/lib/ecore_wl2/ecore_wl2_private.h

index 4102f19..9002769 100644 (file)
@@ -43,6 +43,40 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
           }
      }
 
+   if (!strcmp(interface, "wl_compositor"))
+     {
+        ewd->wl.compositor =
+          wl_registry_bind(registry, id, &wl_compositor_interface, 3);
+     }
+   else if (!strcmp(interface, "wl_subcompositor"))
+     {
+        ewd->wl.subcompositor =
+          wl_registry_bind(registry, id, &wl_subcompositor_interface, 1);
+     }
+   else if (!strcmp(interface, "wl_shm"))
+     {
+        ewd->wl.shm =
+          wl_registry_bind(registry, id, &wl_shm_interface, 1);
+     }
+   else if (!strcmp(interface, "wl_data_device_manager"))
+     {
+        ewd->wl.data_device_manager =
+          wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
+     }
+   else if (!strcmp(interface, "wl_shell"))
+     {
+        ewd->wl.wl_shell =
+          wl_registry_bind(registry, id, &wl_shell_interface, 1);
+     }
+   else if ((!strcmp(interface, "xdg_shell")) &&
+            (!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
+     {
+        ewd->wl.xdg_shell =
+          wl_registry_bind(registry, id, &xdg_shell_interface, 1);
+        xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
+        /* TODO: Add listener */
+     }
+
    /* allocate space for event structure */
    ev = calloc(1, sizeof(Ecore_Wl2_Event_Global));
    if (!ev) return;
index edae5c3..2222f06 100644 (file)
@@ -4,6 +4,9 @@
 # include "Ecore_Wl2.h"
 # include "Ecore_Input.h"
 
+# include "xdg-shell-client-protocol.h"
+# define XDG_VERSION 5
+
 extern int _ecore_wl2_log_dom;
 
 # ifdef ECORE_WL2_DEFAULT_LOG_COLOR
@@ -44,6 +47,12 @@ struct _Ecore_Wl2_Display
      {
         struct wl_display *display;
         struct wl_registry *registry;
+        struct wl_compositor *compositor;
+        struct wl_subcompositor *subcompositor;
+        struct wl_data_device_manager *data_device_manager;
+        struct wl_shm *shm;
+        struct wl_shell *wl_shell;
+        struct xdg_shell *xdg_shell;
      } wl;
 
    Ecore_Fd_Handler *fd_hdl;