forked from enlightenment/efl
Cache wayland globals
Store the wayland registry globals in a list so that we can bind to them from a user/test program. When a custom interface (protocol extension) is used in a wayland compositor, this allows user/test program to use that interface. For instance, one might provide a custom wayland test protocol that give access to otherwise hidden/missing functionality that allows effective automated testing (in wayland engines). See the Weston unit test suite for an example of this concept. Patch by: "U. Artie Eoff" <ullysses.a.eoff@intel.com> SVN revision: 83312
This commit is contained in:
parent
fb3c280a95
commit
c36058806a
|
@ -29,6 +29,8 @@
|
||||||
typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
|
typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
|
||||||
typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
|
typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
|
||||||
typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
|
typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
|
||||||
|
typedef struct _Ecore_Wl_Global Ecore_Wl_Global;
|
||||||
|
|
||||||
# ifndef _ECORE_WAYLAND_WINDOW_PREDEF
|
# ifndef _ECORE_WAYLAND_WINDOW_PREDEF
|
||||||
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
|
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
|
||||||
# endif
|
# endif
|
||||||
|
@ -70,6 +72,14 @@ enum _Ecore_Wl_Window_Buffer_Type
|
||||||
typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
|
typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
|
||||||
typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
|
typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
|
||||||
|
|
||||||
|
struct _Ecore_Wl_Global
|
||||||
|
{
|
||||||
|
unsigned int id;
|
||||||
|
char *interface;
|
||||||
|
unsigned int version;
|
||||||
|
struct wl_list link;
|
||||||
|
};
|
||||||
|
|
||||||
struct _Ecore_Wl_Display
|
struct _Ecore_Wl_Display
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -91,6 +101,7 @@ struct _Ecore_Wl_Display
|
||||||
|
|
||||||
struct wl_list inputs;
|
struct wl_list inputs;
|
||||||
struct wl_list outputs;
|
struct wl_list outputs;
|
||||||
|
struct wl_list globals;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,6 +132,7 @@ ecore_wl_init(const char *name)
|
||||||
|
|
||||||
wl_list_init(&_ecore_wl_disp->inputs);
|
wl_list_init(&_ecore_wl_disp->inputs);
|
||||||
wl_list_init(&_ecore_wl_disp->outputs);
|
wl_list_init(&_ecore_wl_disp->outputs);
|
||||||
|
wl_list_init(&_ecore_wl_disp->globals);
|
||||||
|
|
||||||
_ecore_wl_disp->wl.registry =
|
_ecore_wl_disp->wl.registry =
|
||||||
wl_display_get_registry(_ecore_wl_disp->wl.display);
|
wl_display_get_registry(_ecore_wl_disp->wl.display);
|
||||||
|
@ -270,6 +271,7 @@ _ecore_wl_shutdown(Eina_Bool close)
|
||||||
{
|
{
|
||||||
Ecore_Wl_Output *out, *tout;
|
Ecore_Wl_Output *out, *tout;
|
||||||
Ecore_Wl_Input *in, *tin;
|
Ecore_Wl_Input *in, *tin;
|
||||||
|
Ecore_Wl_Global *global, *tglobal;
|
||||||
|
|
||||||
wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link)
|
wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link)
|
||||||
_ecore_wl_output_del(out);
|
_ecore_wl_output_del(out);
|
||||||
|
@ -277,6 +279,13 @@ _ecore_wl_shutdown(Eina_Bool close)
|
||||||
wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link)
|
wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link)
|
||||||
_ecore_wl_input_del(in);
|
_ecore_wl_input_del(in);
|
||||||
|
|
||||||
|
wl_list_for_each_safe(global, tglobal, &_ecore_wl_disp->globals, link)
|
||||||
|
{
|
||||||
|
wl_list_remove(&global->link);
|
||||||
|
free(global->interface);
|
||||||
|
free(global);
|
||||||
|
}
|
||||||
|
|
||||||
_ecore_wl_xkb_shutdown(_ecore_wl_disp);
|
_ecore_wl_xkb_shutdown(_ecore_wl_disp);
|
||||||
|
|
||||||
if (_ecore_wl_disp->wl.shell)
|
if (_ecore_wl_disp->wl.shell)
|
||||||
|
@ -361,11 +370,18 @@ static void
|
||||||
_ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version EINA_UNUSED)
|
_ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ecore_Wl_Display *ewd;
|
Ecore_Wl_Display *ewd;
|
||||||
|
Ecore_Wl_Global *global;
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
ewd = data;
|
ewd = data;
|
||||||
|
|
||||||
|
global = malloc(sizeof(*global));
|
||||||
|
global->id = id;
|
||||||
|
global->interface = strdup(interface);
|
||||||
|
global->version = version;
|
||||||
|
wl_list_insert(ewd->globals.prev, &global->link);
|
||||||
|
|
||||||
if (!strcmp(interface, "wl_compositor"))
|
if (!strcmp(interface, "wl_compositor"))
|
||||||
{
|
{
|
||||||
ewd->wl.compositor =
|
ewd->wl.compositor =
|
||||||
|
|
Loading…
Reference in New Issue