devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8eda8449def01b44a6f54c77dc9d58fc60cc1a8e
commit 8eda8449def01b44a6f54c77dc9d58fc60cc1a8e Author: Chris Michael <[email protected]> Date: Thu Aug 20 12:39:39 2015 -0400 ecore-wl2: Add start of ecore_wl2_window code Signed-off-by: Chris Michael <[email protected]> --- src/Makefile_Ecore_Wl2.am | 1 + src/lib/ecore_wl2/Ecore_Wl2.h | 27 +++++++++++++++++++++++++-- src/lib/ecore_wl2/ecore_wl2_private.h | 18 ++++++++++++++++++ src/lib/ecore_wl2/ecore_wl2_window.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am index cb566dc..1560ed3 100644 --- a/src/Makefile_Ecore_Wl2.am +++ b/src/Makefile_Ecore_Wl2.am @@ -10,6 +10,7 @@ dist_installed_ecorewl2mainheaders_DATA = lib/ecore_wl2/Ecore_Wl2.h lib_ecore_wl2_libecore_wl2_la_SOURCES = \ lib/ecore_wl2/xdg-shell-client-protocol.h \ lib/ecore_wl2/xdg-shell-protocol.c \ +lib/ecore_wl2/ecore_wl2_window.c \ 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 3e9176f..3eff825 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -28,8 +28,8 @@ /* extern "C" { */ /* # endif */ -# ifndef _ECORE_WAYLAND_WINDOW_PREDEF -typedef struct _Ecore_Wl_Window Ecore_Wl_Window; +# ifndef _ECORE_WL2_WINDOW_PREDEF +typedef struct _Ecore_Wl2_Window Ecore_Wl2_Window; # endif typedef struct _Ecore_Wl2_Display Ecore_Wl2_Display; @@ -62,6 +62,7 @@ EAPI extern int ECORE_WL2_EVENT_GLOBAL_REMOVED; * * @li @ref Ecore_Wl2_Init_Group * @li @ref Ecore_Wl2_Display_Group + * @li @ref Ecore_Wl2_Window_Group */ /** @@ -199,6 +200,28 @@ EAPI struct wl_shm *ecore_wl2_display_shm_get(Ecore_Wl2_Display *display); */ EAPI Eina_Iterator *ecore_wl2_display_globals_get(Ecore_Wl2_Display *display); +/** + * @defgroup Ecore_Wl2_Window_Group Wayland Library Window Functions + * @ingroup Ecore_Wl2_Group + * + * Functions that deal with creating, connecting, or interacting with + * Wayland windows + */ + +/** + * Create a new Ecore_Wl2_Window + * + * @param display The Ecore_Wl2_Display on which to create this new window + * @param parent The Ecore_Wl2_Window which is the parent of this window + * @param x Initial x position of window + * @param y Initial y position of window + * @param w Initial width of window + * @param h Initial height of window + * + * @ingroup Ecore_Wl2_Window_Group + */ +EAPI Ecore_Wl2_Window *ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h); + /* # ifdef __cplusplus */ /* } */ /* # endif */ diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 6b4c12e..337440e 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -61,4 +61,22 @@ struct _Ecore_Wl2_Display Eina_Hash *globals; }; +struct _Ecore_Wl2_Window +{ + Ecore_Wl2_Display *display; + + Ecore_Wl2_Window *parent; + + int id; + const char *title; + const char *class; + + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + struct xdg_surface *xdg_surface; + struct xdg_popup *xdg_popup; + + Eina_Rectangle geometry; +}; + #endif diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c new file mode 100644 index 0000000..283bae4 --- /dev/null +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -0,0 +1,29 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "ecore_wl2_private.h" + +EAPI Ecore_Wl2_Window * +ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h) +{ + Ecore_Wl2_Window *win; + static int _win_id = 1; + + EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL); + + /* try to allocate space for window structure */ + win = calloc(1, sizeof(Ecore_Wl2_Window)); + if (!win) return NULL; + + win->display = display; + win->parent = parent; + win->id = _win_id++; + + win->geometry.x = x; + win->geometry.y = y; + win->geometry.w = w; + win->geometry.h = h; + + return win; +} --
