ecore-wl2: Add start of ecore_wl2_window code

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-08-20 12:39:39 -04:00
parent 88e47d7def
commit 8eda8449de
4 changed files with 73 additions and 2 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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;
}