diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am index c12f4d5bf2..6d758ccc4d 100644 --- a/src/Makefile_Ecore_Wl2.am +++ b/src/Makefile_Ecore_Wl2.am @@ -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 diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index ef33164b3f..16ed703ecc 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -7,6 +7,9 @@ # include # include +# define WL_HIDE_DEPRECATED +# include + # 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 index 0000000000..a2057b7c24 --- /dev/null +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -0,0 +1,27 @@ +#ifdef HAVE_CONFIG_H +# include +#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; +}