Add start of surface code.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-05-03 12:31:42 +01:00
parent 59db3c7b89
commit 3837e4c442
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,50 @@
#include "e.h"
/* local function prototypes */
static void _e_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource);
/* local wayland interfaces */
static const struct wl_surface_interface _e_surface_interface =
{
_e_surface_cb_destroy,
NULL, // cb_attach
NULL, // cb_damage
NULL, // cb_frame
NULL, // cb_opaque_set
NULL, // cb_input_set
NULL, // cb_commit
NULL // cb_buffer_transform_set
};
EAPI E_Surface *
e_surface_new(unsigned int id)
{
E_Surface *es;
/* try to allocate space for a new surface */
if (!(es = E_NEW(E_Surface, 1))) return NULL;
/* initialize the destroy signal */
wl_signal_init(&es->wl.surface.resource.destroy_signal);
/* initialize the link */
wl_list_init(&es->wl.link);
/* TODO: finish me */
/* setup the surface object */
es->wl.surface.resource.object.id = id;
es->wl.surface.resource.object.interface = &wl_surface_interface;
es->wl.surface.resource.object.implementation =
(void (**)(void))&_e_surface_interface;
es->wl.surface.resource.data = es;
return es;
}
/* local functions */
static void
_e_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
{
wl_resource_destroy(resource);
}

View File

@ -0,0 +1,21 @@
#ifdef E_TYPEDEFS
typedef struct _E_Surface E_Surface;
#else
# ifndef E_SURFACE_H
# define E_SURFACE_H
struct _E_Surface
{
struct
{
struct wl_surface surface;
struct wl_list link;
} wl;
};
EAPI E_Surface *e_surface_new(unsigned int id);
# endif
#endif