forked from enlightenment/efl
ecore/wayland: Add some getters.
This centralizes the place where we have to wait for the init to have finished before first using the compositor. It's also part of the later step of hiding Ecore_Wl_* private structs.
This commit is contained in:
parent
40a2dfc870
commit
06d6bf0dba
|
@ -495,6 +495,16 @@ EAPI struct wl_shm *ecore_wl_shm_get(void);
|
|||
*/
|
||||
EAPI struct wl_display *ecore_wl_display_get(void);
|
||||
|
||||
/**
|
||||
* Retrieves the Compositor interface.
|
||||
*
|
||||
* This interface is used by clients to request the creation of surfaces and
|
||||
* regions.
|
||||
*
|
||||
* @return The current wayland compositor interface
|
||||
* @since 1.8
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieves the size of the current screen.
|
||||
*
|
||||
|
|
|
@ -272,6 +272,28 @@ ecore_wl_registry_get(void)
|
|||
return _ecore_wl_disp->wl.registry;
|
||||
}
|
||||
|
||||
struct wl_compositor *
|
||||
ecore_wl_compositor_get(void)
|
||||
{
|
||||
if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
|
||||
return NULL;
|
||||
|
||||
_ecore_wl_init_wait();
|
||||
|
||||
return _ecore_wl_disp->wl.compositor;
|
||||
}
|
||||
|
||||
struct wl_subcompositor *
|
||||
ecore_wl_subcompositor_get(void)
|
||||
{
|
||||
if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
|
||||
return NULL;
|
||||
|
||||
_ecore_wl_init_wait();
|
||||
|
||||
return _ecore_wl_disp->wl.subcompositor;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_screen_size_get(int *w, int *h)
|
||||
{
|
||||
|
|
|
@ -97,4 +97,7 @@ void _ecore_wl_events_shutdown(void);
|
|||
|
||||
void _ecore_wl_subsurfs_del_all(Ecore_Wl_Window *win);
|
||||
|
||||
struct wl_compositor *ecore_wl_compositor_get(void);
|
||||
struct wl_subcompositor *ecore_wl_subcompositor_get(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,19 +23,22 @@ ecore_wl_subsurf_create(Ecore_Wl_Window *win)
|
|||
struct wl_subsurface *subsurface;
|
||||
struct wl_surface *surface;
|
||||
Ecore_Wl_Subsurf *ess;
|
||||
struct wl_subcompositor *subcomp;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return NULL;
|
||||
if (!win->surface) return NULL;
|
||||
if (!_ecore_wl_disp->wl.subcompositor) return NULL;
|
||||
|
||||
surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
|
||||
subcomp = ecore_wl_subcompositor_get();
|
||||
if (!subcomp) return NULL;
|
||||
|
||||
surface = wl_compositor_create_surface(ecore_wl_compositor_get());
|
||||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
subsurface = wl_subcompositor_get_subsurface
|
||||
(_ecore_wl_disp->wl.subcompositor, surface, win->surface);
|
||||
(subcomp, surface, win->surface);
|
||||
if (!subsurface)
|
||||
{
|
||||
wl_surface_destroy(surface);
|
||||
|
@ -171,7 +174,6 @@ ecore_wl_subsurf_sync_set(Ecore_Wl_Subsurf *ess, Eina_Bool val)
|
|||
EAPI void
|
||||
ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, int h)
|
||||
{
|
||||
Ecore_Wl_Window *parent;
|
||||
struct wl_region *region = NULL;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
@ -180,8 +182,7 @@ ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, i
|
|||
|
||||
if ((w > 0) && (h > 0))
|
||||
{
|
||||
parent = ess->parent_win;
|
||||
region = wl_compositor_create_region(parent->display->wl.compositor);
|
||||
region = wl_compositor_create_region(ecore_wl_compositor_get());
|
||||
wl_region_add(region, x, y, w, h);
|
||||
wl_surface_set_opaque_region(ess->surface, region);
|
||||
wl_region_destroy(region);
|
||||
|
|
|
@ -252,7 +252,7 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
|
|||
{
|
||||
if (!win) return NULL;
|
||||
if (win->surface) return win->surface;
|
||||
win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
|
||||
win->surface = wl_compositor_create_surface(ecore_wl_compositor_get());
|
||||
win->surface_id = wl_proxy_get_id((struct wl_proxy *)win->surface);
|
||||
return win->surface;
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
|
|||
struct wl_region *region = NULL;
|
||||
|
||||
region =
|
||||
wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
|
||||
wl_compositor_create_region(ecore_wl_compositor_get());
|
||||
wl_region_add(region, x, y, w, h);
|
||||
wl_surface_set_input_region(win->surface, region);
|
||||
wl_region_destroy(region);
|
||||
|
@ -640,7 +640,7 @@ ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
|
|||
struct wl_region *region = NULL;
|
||||
|
||||
region =
|
||||
wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
|
||||
wl_compositor_create_region(ecore_wl_compositor_get());
|
||||
|
||||
switch (win->rotation)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue