ecore-wl2: Add function to find a window based on surface

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-09-10 13:21:02 -04:00
parent 0a2bcb775b
commit 2a973da77b
3 changed files with 32 additions and 0 deletions

View File

@ -234,6 +234,23 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
eina_hash_free(ewd->globals);
}
Ecore_Wl2_Window *
_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface)
{
Ecore_Wl2_Window *window;
if ((!display) || (!wl_surface)) return NULL;
EINA_INLIST_FOREACH(display->windows, window)
{
if ((window->surface) &&
(window->surface == wl_surface))
return window;
}
return NULL;
}
EAPI Ecore_Wl2_Display *
ecore_wl2_display_create(const char *name)
{

View File

@ -60,6 +60,7 @@ struct _Ecore_Wl2_Display
Eina_Hash *globals;
Eina_Inlist *windows;
Eina_Inlist *outputs;
Eina_Inlist *inputs;
@ -68,6 +69,8 @@ struct _Ecore_Wl2_Display
struct _Ecore_Wl2_Window
{
EINA_INLIST;
Ecore_Wl2_Display *display;
Ecore_Wl2_Window *parent;
@ -183,6 +186,8 @@ struct _Ecore_Wl2_Input
} repeat;
};
Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface);
void _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id);
void _ecore_wl2_output_del(Ecore_Wl2_Output *output);

View File

@ -187,6 +187,9 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x
win->type = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
display->windows =
eina_inlist_append(display->windows, EINA_INLIST_GET(win));
return win;
}
@ -286,8 +289,12 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
EAPI void
ecore_wl2_window_free(Ecore_Wl2_Window *window)
{
Ecore_Wl2_Display *display;
EINA_SAFETY_ON_NULL_RETURN(window);
display = window->display;
/* TODO: reset input pointer and keyboard focus */
/* TODO: delete window anim callback */
/* TODO: destroy subsurfaces */
@ -297,6 +304,9 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window)
if (window->title) eina_stringshare_del(window->title);
if (window->class) eina_stringshare_del(window->class);
display->windows =
eina_inlist_remove(display->windows, EINA_INLIST_GET(window));
free(window);
}