add functions to create new compositor
authorChris Michael <cp.michael@samsung.com>
Tue, 14 Oct 2014 18:03:15 +0000 (14:03 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 30 Oct 2014 14:39:05 +0000 (10:39 -0400)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/bin/e_comp_wl.c

index d8dc407..30b631e 100644 (file)
@@ -6,6 +6,38 @@
 #define E_COMP_WL_PIXMAP_CHECK \
    if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return
 
+/* local functions */
+static void 
+_e_comp_wl_cb_del(E_Comp *comp)
+{
+   E_Comp_Data *cdata;
+
+   /* get existing compositor data */
+   if (!(cdata = comp->wl_comp_data)) return;
+
+   /* free allocated data structure */
+   free(cdata);
+}
+
+static Eina_Bool 
+_e_comp_wl_compositor_create(void)
+{
+   E_Comp *comp;
+
+   /* check for existing compositor. create if needed */
+   if (!(comp = e_comp_get(NULL)))
+     {
+        comp = e_comp_new();
+        comp->comp_type = E_PIXMAP_TYPE_WL;
+        E_OBJECT_DEL_SET(comp, _e_comp_wl_cb_del);
+     }
+
+   /* create new compositor data */
+   cdata = E_NEW(E_Comp_Data, 1);
+
+   return EINA_TRUE;
+}
+
 /* public functions */
 EAPI Eina_Bool 
 e_comp_wl_init(void)
@@ -15,7 +47,14 @@ e_comp_wl_init(void)
        ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM))
      e_comp_gl_set(EINA_TRUE);
 
-   return EINA_FALSE;
+   /* try to create a wayland compositor */
+   if (!_e_comp_wl_compositor_create())
+     {
+        e_error_message_show(_("Enlightenment cannot create a Wayland Compositor!\n"));
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
 }
 
 EAPI struct wl_signal