summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_surface_wayland.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-03-09 16:21:08 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-03-15 11:11:59 +0900
commit0c95b694742c712ec4c66e566f216f1b6c1b7079 (patch)
tree4826c248cf1f4490c1d5f78bfb9741838efd3510 /src/lib/evas/canvas/efl_canvas_surface_wayland.c
parent20b4d9dd6adb88f9dd0cd51fa849f0c360432279 (diff)
Evas.Image: Move native surfaces to Efl.Canvas.Surface
X11, TBM and Wayland support are implemented for now.
Diffstat (limited to 'src/lib/evas/canvas/efl_canvas_surface_wayland.c')
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_wayland.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_surface_wayland.c b/src/lib/evas/canvas/efl_canvas_surface_wayland.c
new file mode 100644
index 0000000000..1798107079
--- /dev/null
+++ b/src/lib/evas/canvas/efl_canvas_surface_wayland.c
@@ -0,0 +1,54 @@
1#include "efl_canvas_surface.h"
2
3#define MY_CLASS EFL_CANVAS_SURFACE_WAYLAND_CLASS
4
5typedef struct _Efl_Canvas_Surface_Wayland_Data
6{
7 Efl_Canvas_Surface_Data *base;
8} Efl_Canvas_Surface_Wayland_Data;
9
10EOLIAN static Eo *
11_efl_canvas_surface_wayland_eo_base_constructor(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd)
12{
13 Evas_Object_Protected_Data *obj;
14
15 eo = eo_constructor(eo_super(eo, MY_CLASS));
16 obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
17 if (!obj) return NULL;
18
19 if (!ENFN->image_native_init(ENDT, EVAS_NATIVE_SURFACE_WL))
20 {
21 ERR("Wayland surfaces are not supported on this platform");
22 return NULL;
23 }
24
25 pd->base = eo_data_ref(eo, EFL_CANVAS_SURFACE_MIXIN);
26 pd->base->surf.type = EVAS_NATIVE_SURFACE_WL;
27 return eo;
28}
29
30EOLIAN static void
31_efl_canvas_surface_wayland_eo_base_destructor(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd)
32{
33 Evas_Object_Protected_Data *obj = obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
34
35 ENFN->image_native_shutdown(ENDT, EVAS_NATIVE_SURFACE_WL);
36 eo_data_unref(eo, pd->base);
37 eo_destructor(eo);
38}
39
40EOLIAN static Eina_Bool
41_efl_canvas_surface_wayland_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd, void *buffer)
42{
43 pd->base->surf.data.wl.legacy_buffer = buffer;
44 if (!_evas_image_native_surface_set(eo, &pd->base->surf))
45 {
46 ERR("failed to set native buffer");
47 pd->base->buffer = NULL;
48 return EINA_FALSE;
49 }
50 pd->base->buffer = buffer;
51 return EINA_TRUE;
52}
53
54#include "efl_canvas_surface_wayland.eo.c"