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
# include <wayland-cursor.h>
# include <xkbcommon/xkbcommon.h>
+# define WL_HIDE_DEPRECATED
+# include <wayland-server.h>
+
# ifdef EAPI
# undef EAPI
# endif
*/
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 */
--- /dev/null
+#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;
+}