Add header for a Wayland Compositor.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-04-09 08:31:05 +01:00
parent e1d577b153
commit 3ce1e0e8e9
1 changed files with 241 additions and 0 deletions

241
src/bin/e_comp_wl.h Normal file
View File

@ -0,0 +1,241 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_H
# define E_COMP_WL_H
# include <pixman.h>
# include <wayland-server.h>
# include <xkbcommon/xkbcommon.h>
# define container_of(ptr, type, member) ({ \
const __typeof__(((type *)0)->member) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type,member));})
typedef enum _E_Wayland_Shell_Surface_Type E_Wayland_Shell_Surface_Type;
typedef struct _E_Wayland_Region E_Wayland_Region;
typedef struct _E_Wayland_Surface E_Wayland_Surface;
typedef struct _E_Wayland_Surface_Frame_Callback E_Wayland_Surface_Frame_Callback;
typedef struct _E_Wayland_Shell_Surface E_Wayland_Shell_Surface;
typedef struct _E_Wayland_Shell_Interface E_Wayland_Shell_Interface;
typedef struct _E_Wayland_Shell_Grab E_Wayland_Shell_Grab;
typedef struct _E_Wayland_Keyboard_Info E_Wayland_Keyboard_Info;
typedef struct _E_Wayland_Input E_Wayland_Input;
typedef struct _E_Wayland_Compositor E_Wayland_Compositor;
enum _E_Wayland_Shell_Surface_Type
{
E_WAYLAND_SHELL_SURFACE_TYPE_NONE,
E_WAYLAND_SHELL_SURFACE_TYPE_TOPLEVEL,
E_WAYLAND_SHELL_SURFACE_TYPE_TRANSIENT,
E_WAYLAND_SHELL_SURFACE_TYPE_FULLSCREEN,
E_WAYLAND_SHELL_SURFACE_TYPE_MAXIMIZED,
E_WAYLAND_SHELL_SURFACE_TYPE_POPUP
};
struct _E_Wayland_Region
{
struct
{
struct wl_resource resource;
} wl;
pixman_region32_t region;
};
struct _E_Wayland_Surface_Frame_Callback
{
struct
{
struct wl_resource resource;
struct wl_list link;
} wl;
};
struct _E_Wayland_Surface
{
struct
{
struct wl_surface surface;
struct wl_list link, frames;
} wl;
struct
{
struct wl_buffer *buffer;
struct wl_listener buffer_destroy;
struct wl_list frames;
Evas_Coord x, y;
Eina_Bool new_buffer : 1;
pixman_region32_t damage, opaque, input;
} pending;
struct
{
struct wl_buffer *buffer;
struct wl_listener buffer_destroy;
} reference;
struct
{
Evas_Coord x, y;
Evas_Coord w, h;
Eina_Bool changed : 1;
} geometry;
struct
{
pixman_region32_t opaque, input;
pixman_region32_t damage, clip;
} region;
E_Border *bd;
Ecore_Evas *ee;
Evas_Object *img;
Evas_Object *input;
E_Wayland_Shell_Surface *shell_surface;
Eina_Bool mapped : 1;
E_Wayland_Input *input;
void (*map) (E_Wayland_Surface *ews, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
void (*unmap) (E_Wayland_Surface *ews);
void (*configure) (E_Wayland_Surface *ews, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
};
struct _E_Wayland_Shell_Surface
{
struct
{
struct wl_resource resource;
struct wl_listener surface_destroy;
struct wl_list link;
} wl;
struct
{
Evas_Coord x, y;
Evas_Coord w, h;
Eina_Bool valid : 1;
} saved;
E_Wayland_Surface *surface;
E_Wayland_Shell_Surface_Type type, next_type;
char *title, *clas;
Eina_Bool active : 1;
void *ping_timer;
};
struct _E_Wayland_Shell_Interface
{
void *shell;
E_Wayland_Shell_Surface *(*shell_surface_create) (void *shell, E_Wayland_Surface *ews, const void *client);
void (*toplevel_set) (E_Wayland_Shell_Surface *ewss);
void (*transient_set) (E_Wayland_Shell_Surface *ewss, E_Wayland_Surface *ews, int x, int y, unsigned int flags);
void (*fullscreen_set) (E_Wayland_Shell_Surface *ewss, unsigned int method, unsigned int framerate, void *output);
void (*popup_set) (E_Wayland_Shell_Surface *ewss, E_Wayland_Surface *ews, void *seat, unsigned int serial, int x, int y, unsigned int flags);
void (*maximized_set) (E_Wayland_Shell_Surface *ewss, unsigned int edges);
int (*move) (E_Wayland_Shell_Surface *ewss, void *seat);
int (*resize) (E_Wayland_Shell_Surface *ewss, void *seat, unsigned int edges);
};
struct _E_Wayland_Shell_Grab
{
struct wl_pointer_grab grab;
struct wl_pointer *pointer;
Evas_Coord x, y;
E_Wayland_Shell_Surface *shell_surface;
struct wl_listener shell_surface_destroy;
};
struct _E_Wayland_Keyboard_Info
{
struct xkb_keymap *keymap;
int fd;
size_t size;
char *area;
xkb_mod_index_t mod_shift, mod_caps, mod_ctrl, mod_alt, mod_super;
};
struct _E_Wayland_Input
{
struct
{
struct wl_seat seat;
struct wl_pointer pointer;
struct wl_keyboard keyboard;
struct wl_list link;
} wl;
struct
{
E_Wayland_Keyboard_Info *info;
struct xkb_state *state;
} xkb;
struct
{
E_Wayland_Surface *surface;
struct wl_listener surface_destroy;
struct
{
Evas_Coord x, y;
} hot;
} pointer;
Eina_Bool has_pointer : 1;
Eina_Bool has_keyboard : 1;
Eina_Bool has_touch : 1;
};
struct _E_Wayland_Compositor
{
struct
{
struct wl_display *display;
struct wl_event_loop *loop;
} wl;
struct
{
struct wl_signal destroy;
struct wl_signal activate;
struct wl_signal kill;
struct wl_signal seat;
} signals;
struct
{
struct xkb_rule_names names;
struct xkb_context *context;
} xkb;
E_Wayland_Shell_Interface shell_interface;
Ecore_Fd_Handler *fd_handler;
Ecore_Idler *idler;
E_Wayland_Input *input;
Eina_List *surfaces;
Eina_List *seats;
void (*ping_cb) (E_Wayland_Surface *ews, unsigned int serial);
};
/* external variables */
extern E_Wayland_Compositor *_e_wl_comp;
Eina_Bool e_comp_wl_init(void);
void e_comp_wl_shutdown(void);
unsigned int e_comp_wl_time_get(void);
# endif
#endif