summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-10-29 18:40:33 -0200
committerRafael Antognolli <rafael.antognolli@intel.com>2013-10-29 19:14:22 -0200
commit06d6bf0dba9f0cc20075c84507bec2cbdb96aa6b (patch)
treef9ae9e7eb6609994f343470de2df54139aa3fdb3 /src/lib/ecore_wayland
parent40a2dfc8701ff78de73669d059e87535fb39795e (diff)
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.
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h10
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c22
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h3
-rw-r--r--src/lib/ecore_wayland/ecore_wl_subsurf.c13
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c6
5 files changed, 45 insertions, 9 deletions
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h
index 9ba76369e8..78282812fb 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -496,6 +496,16 @@ EAPI struct wl_shm *ecore_wl_shm_get(void);
496EAPI struct wl_display *ecore_wl_display_get(void); 496EAPI struct wl_display *ecore_wl_display_get(void);
497 497
498/** 498/**
499 * Retrieves the Compositor interface.
500 *
501 * This interface is used by clients to request the creation of surfaces and
502 * regions.
503 *
504 * @return The current wayland compositor interface
505 * @since 1.8
506 */
507
508/**
499 * Retrieves the size of the current screen. 509 * Retrieves the size of the current screen.
500 * 510 *
501 * @param w where to return the width. May be NULL. Returns 0 on error. 511 * @param w where to return the width. May be NULL. Returns 0 on error.
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index 451aa794dc..f763675276 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -272,6 +272,28 @@ ecore_wl_registry_get(void)
272 return _ecore_wl_disp->wl.registry; 272 return _ecore_wl_disp->wl.registry;
273} 273}
274 274
275struct wl_compositor *
276ecore_wl_compositor_get(void)
277{
278 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
279 return NULL;
280
281 _ecore_wl_init_wait();
282
283 return _ecore_wl_disp->wl.compositor;
284}
285
286struct wl_subcompositor *
287ecore_wl_subcompositor_get(void)
288{
289 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
290 return NULL;
291
292 _ecore_wl_init_wait();
293
294 return _ecore_wl_disp->wl.subcompositor;
295}
296
275EAPI void 297EAPI void
276ecore_wl_screen_size_get(int *w, int *h) 298ecore_wl_screen_size_get(int *w, int *h)
277{ 299{
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index b83aae38eb..d615f0f4dd 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -97,4 +97,7 @@ void _ecore_wl_events_shutdown(void);
97 97
98void _ecore_wl_subsurfs_del_all(Ecore_Wl_Window *win); 98void _ecore_wl_subsurfs_del_all(Ecore_Wl_Window *win);
99 99
100struct wl_compositor *ecore_wl_compositor_get(void);
101struct wl_subcompositor *ecore_wl_subcompositor_get(void);
102
100#endif 103#endif
diff --git a/src/lib/ecore_wayland/ecore_wl_subsurf.c b/src/lib/ecore_wayland/ecore_wl_subsurf.c
index 4e144fa084..d59810d6cd 100644
--- a/src/lib/ecore_wayland/ecore_wl_subsurf.c
+++ b/src/lib/ecore_wayland/ecore_wl_subsurf.c
@@ -23,19 +23,22 @@ ecore_wl_subsurf_create(Ecore_Wl_Window *win)
23 struct wl_subsurface *subsurface; 23 struct wl_subsurface *subsurface;
24 struct wl_surface *surface; 24 struct wl_surface *surface;
25 Ecore_Wl_Subsurf *ess; 25 Ecore_Wl_Subsurf *ess;
26 struct wl_subcompositor *subcomp;
26 27
27 LOGFN(__FILE__, __LINE__, __FUNCTION__); 28 LOGFN(__FILE__, __LINE__, __FUNCTION__);
28 29
29 if (!win) return NULL; 30 if (!win) return NULL;
30 if (!win->surface) return NULL; 31 if (!win->surface) return NULL;
31 if (!_ecore_wl_disp->wl.subcompositor) return NULL;
32 32
33 surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor); 33 subcomp = ecore_wl_subcompositor_get();
34 if (!subcomp) return NULL;
35
36 surface = wl_compositor_create_surface(ecore_wl_compositor_get());
34 if (!surface) 37 if (!surface)
35 return NULL; 38 return NULL;
36 39
37 subsurface = wl_subcompositor_get_subsurface 40 subsurface = wl_subcompositor_get_subsurface
38 (_ecore_wl_disp->wl.subcompositor, surface, win->surface); 41 (subcomp, surface, win->surface);
39 if (!subsurface) 42 if (!subsurface)
40 { 43 {
41 wl_surface_destroy(surface); 44 wl_surface_destroy(surface);
@@ -171,7 +174,6 @@ ecore_wl_subsurf_sync_set(Ecore_Wl_Subsurf *ess, Eina_Bool val)
171EAPI void 174EAPI void
172ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, int h) 175ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, int h)
173{ 176{
174 Ecore_Wl_Window *parent;
175 struct wl_region *region = NULL; 177 struct wl_region *region = NULL;
176 178
177 LOGFN(__FILE__, __LINE__, __FUNCTION__); 179 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
180 182
181 if ((w > 0) && (h > 0)) 183 if ((w > 0) && (h > 0))
182 { 184 {
183 parent = ess->parent_win; 185 region = wl_compositor_create_region(ecore_wl_compositor_get());
184 region = wl_compositor_create_region(parent->display->wl.compositor);
185 wl_region_add(region, x, y, w, h); 186 wl_region_add(region, x, y, w, h);
186 wl_surface_set_opaque_region(ess->surface, region); 187 wl_surface_set_opaque_region(ess->surface, region);
187 wl_region_destroy(region); 188 wl_region_destroy(region);
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 4ec78c8460..b92469157f 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -252,7 +252,7 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
252{ 252{
253 if (!win) return NULL; 253 if (!win) return NULL;
254 if (win->surface) return win->surface; 254 if (win->surface) return win->surface;
255 win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor); 255 win->surface = wl_compositor_create_surface(ecore_wl_compositor_get());
256 win->surface_id = wl_proxy_get_id((struct wl_proxy *)win->surface); 256 win->surface_id = wl_proxy_get_id((struct wl_proxy *)win->surface);
257 return win->surface; 257 return win->surface;
258} 258}
@@ -610,7 +610,7 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
610 struct wl_region *region = NULL; 610 struct wl_region *region = NULL;
611 611
612 region = 612 region =
613 wl_compositor_create_region(_ecore_wl_disp->wl.compositor); 613 wl_compositor_create_region(ecore_wl_compositor_get());
614 wl_region_add(region, x, y, w, h); 614 wl_region_add(region, x, y, w, h);
615 wl_surface_set_input_region(win->surface, region); 615 wl_surface_set_input_region(win->surface, region);
616 wl_region_destroy(region); 616 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
640 struct wl_region *region = NULL; 640 struct wl_region *region = NULL;
641 641
642 region = 642 region =
643 wl_compositor_create_region(_ecore_wl_disp->wl.compositor); 643 wl_compositor_create_region(ecore_wl_compositor_get());
644 644
645 switch (win->rotation) 645 switch (win->rotation)
646 { 646 {