ecore-wl2: Add ecore_wl2_display file to build order
authorChris Michael <cp.michael@samsung.com>
Tue, 18 Aug 2015 15:56:07 +0000 (11:56 -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/Makefile_Ecore_Wl2.am
src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_display.c [new file with mode: 0644]

index c12f4d5..6d758cc 100644 (file)
@@ -8,6 +8,7 @@ installed_ecorewl2mainheadersdir = $(includedir)/ecore-wl2-@VMAJ@
 dist_installed_ecorewl2mainheaders_DATA = lib/ecore_wl2/Ecore_Wl2.h
 
 lib_ecore_wl2_libecore_wl2_la_SOURCES = \
+lib/ecore_wl2/ecore_wl2_display.c \
 lib/ecore_wl2/ecore_wl2.c \
 lib/ecore_wl2/ecore_wl2_private.h
 
index ef33164..16ed703 100644 (file)
@@ -7,6 +7,9 @@
 # include <wayland-cursor.h>
 # include <xkbcommon/xkbcommon.h>
 
+# define WL_HIDE_DEPRECATED
+# include <wayland-server.h>
+
 # ifdef EAPI
 #  undef EAPI
 # endif
@@ -74,6 +77,42 @@ EAPI int ecore_wl2_init(void);
  */
 EAPI int ecore_wl2_shutdown(void);
 
+/**
+ * @defgroup Ecore_Wl2_Display_Group Wayland Library Display Functions
+ * @ingroup Ecore_Wl2_Group
+ *
+ * Functions that deal with creating, connecting, or interacting with
+ * Wayland displays
+ */
+
+/**
+ * Create a new Wayland display
+ *
+ * @brief This function is typically used to create a new display for
+ * use with compositors, or to create a new display for use in nested
+ * compositors.
+ *
+ * @return The newly created wl_display
+ *
+ * @ingroup Ecore_Wl2_Display_Group
+ */
+EAPI struct wl_display *ecore_wl2_display_create(void);
+
+/**
+ * Connect to an existing Wayland display
+ *
+ * @brief This function is typically used by clients to connect to an
+ * existing wl_display.
+ *
+ * @param name The display target name to connect to. If @c NULL, the default
+ *             display is assumed.
+ *
+ * @return The wl_display which was connected to
+ *
+ * @ingroup Ecore_Wl2_Display_Group
+ */
+EAPI struct wl_display *ecore_wl2_display_connect(const char *name);
+
 /* # ifdef __cplusplus */
 /* } */
 /* # endif */
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
new file mode 100644 (file)
index 0000000..a2057b7
--- /dev/null
@@ -0,0 +1,27 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ecore_wl2_private.h"
+
+EAPI struct wl_display *
+ecore_wl2_display_create(void)
+{
+   return wl_display_create();
+}
+
+EAPI struct wl_display *
+ecore_wl2_display_connect(const char *name)
+{
+   struct wl_display *disp;
+
+   /* try to connect to wayland display with this name */
+   disp = wl_display_connect(name);
+   if (!disp)
+     {
+        ERR("Could not connect to display %s: %m", name);
+        return NULL;
+     }
+
+   return disp;
+}