0e7312d5ce1b5f3f6954b52f3ec46e63f903b90f
[platform/upstream/ecore.git] / src / lib / ecore_evas / ecore_evas_wayland_egl.c
1 #ifdef HAVE_CONFIG_H
2 # include "config.h"
3 #endif
4
5 #ifdef STDC_HEADERS
6 # include <stdlib.h>
7 # include <stddef.h>
8 #else
9 # ifdef HAVE_STDLIB_H
10 #  include <stdlib.h>
11 # endif
12 #endif
13 #ifdef HAVE_ALLOCA_H
14 # include <alloca.h>
15 #elif !defined alloca
16 # ifdef __GNUC__
17 #  define alloca __builtin_alloca
18 # elif defined _AIX
19 #  define alloca __alloca
20 # elif defined _MSC_VER
21 #  include <malloc.h>
22 #  define alloca _alloca
23 # elif !defined HAVE_ALLOCA
24 #  ifdef  __cplusplus
25 extern "C"
26 #  endif
27 void *alloca (size_t);
28 # endif
29 #endif
30
31 //#define LOGFNS 1
32
33 #ifdef LOGFNS
34 # include <stdio.h>
35 # define LOGFN(fl, ln, fn) \
36    printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn);
37 #else
38 # define LOGFN(fl, ln, fn)
39 #endif
40
41 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
42 # include <stdlib.h>
43 # include <string.h>
44 # include <unistd.h>
45 # include <sys/types.h>
46 # include <sys/mman.h>
47 #endif
48
49 #include <Eina.h>
50 #include <Evas.h>
51 #include <Ecore.h>
52
53 #include "ecore_evas_private.h"
54 #include "Ecore_Evas.h"
55
56 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
57 # include <Evas_Engine_Wayland_Egl.h>
58 # include <Ecore_Wayland.h>
59
60 /* local structures */
61 typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
62 struct _EE_Wl_Smart_Data 
63 {
64    Evas_Object *frame;
65    Evas_Object *text;
66    Evas_Object *clipper;
67    Evas_Coord x, y, w, h;
68 };
69
70 /* local function prototypes */
71 static int _ecore_evas_wl_init(void);
72 static int _ecore_evas_wl_shutdown(void);
73 static void _ecore_evas_wl_pre_free(Ecore_Evas *ee);
74 static void _ecore_evas_wl_free(Ecore_Evas *ee);
75 static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
76 static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
77 static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
78 static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
79 static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
80 static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
81 static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
82 static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
83 static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
84 static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
85 static void _ecore_evas_wl_show(Ecore_Evas *ee);
86 static void _ecore_evas_wl_hide(Ecore_Evas *ee);
87 static void _ecore_evas_wl_raise(Ecore_Evas *ee);
88 static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title);
89 static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
90 static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
91 static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
92 static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
93 static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
94 static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
95 static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
96 static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
97 static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
98 static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
99 static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
100 static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
101 static int _ecore_evas_wl_render(Ecore_Evas *ee);
102 static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
103 static void _ecore_evas_wl_screen_dpi_get(const Ecore_Evas *ee __UNUSED__, int *xdpi, int *ydpi);
104 static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
105 static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
106 static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
107 static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
108 static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
109
110 /* SMART stuff for frame */
111 static Evas_Smart *_ecore_evas_wl_smart = NULL;
112
113 static void _ecore_evas_wl_smart_init(void);
114 static void _ecore_evas_wl_smart_add(Evas_Object *obj);
115 static void _ecore_evas_wl_smart_del(Evas_Object *obj);
116 static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
117 static void _ecore_evas_wl_smart_show(Evas_Object *obj);
118 static void _ecore_evas_wl_smart_hide(Evas_Object *obj);
119
120 static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
121
122 /* local variables */
123 static int _ecore_evas_wl_init_count = 0;
124 static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5];
125
126 static Ecore_Evas_Engine_Func _ecore_wl_engine_func = 
127 {
128    _ecore_evas_wl_free,
129    _ecore_evas_wl_callback_resize_set,
130    _ecore_evas_wl_callback_move_set,
131    NULL, 
132    NULL,
133    _ecore_evas_wl_callback_delete_request_set,
134    NULL,
135    _ecore_evas_wl_callback_focus_in_set,
136    _ecore_evas_wl_callback_focus_out_set,
137    _ecore_evas_wl_callback_mouse_in_set,
138    _ecore_evas_wl_callback_mouse_out_set,
139    NULL, // sticky_set
140    NULL, // unsticky_set
141    NULL, // pre_render_set
142    NULL, // post_render_set
143    _ecore_evas_wl_move,
144    NULL, // managed_move
145    _ecore_evas_wl_resize,
146    _ecore_evas_wl_move_resize,
147    NULL, // rotation_set
148    NULL, // shaped_set
149    _ecore_evas_wl_show,
150    _ecore_evas_wl_hide,
151    _ecore_evas_wl_raise,
152    NULL, // lower
153    NULL, // activate
154    _ecore_evas_wl_title_set,
155    _ecore_evas_wl_name_class_set,
156    _ecore_evas_wl_size_min_set,
157    _ecore_evas_wl_size_max_set,
158    _ecore_evas_wl_size_base_set,
159    _ecore_evas_wl_size_step_set,
160    NULL, // object_cursor_set
161    _ecore_evas_wl_layer_set,
162    NULL, // focus set
163    _ecore_evas_wl_iconified_set,
164    NULL, // borderless set
165    NULL, // override set
166    _ecore_evas_wl_maximized_set,
167    _ecore_evas_wl_fullscreen_set,
168    NULL, // func avoid_damage set
169    NULL, // func withdrawn set
170    NULL, // func sticky set
171    _ecore_evas_wl_ignore_events_set,
172    _ecore_evas_wl_alpha_set,
173    _ecore_evas_wl_transparent_set,
174    NULL, // func profiles set
175    NULL,
176    NULL,
177    NULL,
178    NULL,
179    NULL,
180    NULL,
181    _ecore_evas_wl_render,
182    _ecore_evas_wl_screen_geometry_get,
183    _ecore_evas_wl_screen_dpi_get,
184    NULL, // wm_rot_preferred_rotation_set
185    NULL  // wm_rot_available_rotations_set
186 };
187
188 /* external variables */
189
190 /* external functions */
191 EAPI Ecore_Evas *
192 ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
193 {
194    Ecore_Wl_Window *p = NULL;
195    Evas_Engine_Info_Wayland_Egl *einfo;
196    Ecore_Evas *ee;
197    int method = 0, count = 0;
198
199    LOGFN(__FILE__, __LINE__, __FUNCTION__);
200
201    if (!(method = evas_render_method_lookup("wayland_egl")))
202      {
203         ERR("Render method lookup failed for Wayland_Egl");
204         return NULL;
205      }
206
207    count = ecore_wl_init(disp_name);
208    if (!count)
209      {
210         ERR("Failed to initialize Ecore_Wayland");
211         return NULL;
212      }
213    else if (count == 1)
214      ecore_wl_display_iterate();
215
216    if (!(ee = calloc(1, sizeof(Ecore_Evas))))
217      {
218         ERR("Failed to allocate Ecore_Evas");
219         ecore_wl_shutdown();
220         return NULL;
221      }
222
223    ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
224
225    _ecore_evas_wl_init();
226
227    ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
228
229    ee->driver = "wayland_egl";
230    if (disp_name) ee->name = strdup(disp_name);
231
232    if (w < 1) w = 1;
233    if (h < 1) h = 1;
234
235    ee->x = x;
236    ee->y = y;
237    ee->w = w;
238    ee->h = h;
239    ee->req.x = ee->x;
240    ee->req.y = ee->y;
241    ee->req.w = ee->w;
242    ee->req.h = ee->h;
243    ee->rotation = 0;
244    ee->prop.max.w = 32767;
245    ee->prop.max.h = 32767;
246    ee->prop.layer = 4;
247    ee->prop.request_pos = 0;
248    ee->prop.sticky = 0;
249    ee->prop.draw_frame = frame;
250    ee->alpha = EINA_FALSE;
251
252    ee->evas = evas_new();
253    evas_data_attach_set(ee->evas, ee);
254    evas_output_method_set(ee->evas, method);
255    evas_output_size_set(ee->evas, ee->w, ee->h);
256    evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
257
258    /* FIXME: This needs to be set based on theme & scale */
259    if (ee->prop.draw_frame)
260      evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
261
262    if (parent)
263      p = ecore_wl_window_find(parent);
264
265    /* FIXME: Get if parent is alpha, and set */
266
267    ee->engine.wl.parent = p;
268    ee->engine.wl.win = 
269      ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
270    ee->prop.window = ee->engine.wl.win->id;
271
272    if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
273      {
274         einfo->info.display = ecore_wl_display_get();
275         einfo->info.destination_alpha = ee->alpha;
276         einfo->info.rotation = ee->rotation;
277         einfo->info.depth = 32;
278         if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
279           {
280              ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
281              ecore_evas_free(ee);
282              _ecore_evas_wl_shutdown();
283              ecore_wl_shutdown();
284              return NULL;
285           }
286      }
287    else 
288      {
289         ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
290         ecore_evas_free(ee);
291         _ecore_evas_wl_shutdown();
292         ecore_wl_shutdown();
293         return NULL;
294      }
295
296    ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
297
298    if (ee->prop.draw_frame) 
299      {
300         ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas);
301         evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE);
302         evas_object_move(ee->engine.wl.frame, 0, 0);
303      }
304
305    _ecore_evas_register(ee);
306    ecore_evas_input_event_register(ee);
307
308    ecore_event_window_register(ee->prop.window, ee, ee->evas, 
309                                (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, 
310                                (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, 
311                                (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, 
312                                (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
313
314    /* evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); */
315
316    return ee;
317 }
318
319 /* local functions */
320 static int 
321 _ecore_evas_wl_init(void)
322 {
323    LOGFN(__FILE__, __LINE__, __FUNCTION__);
324
325    if (++_ecore_evas_wl_init_count != 1)
326      return _ecore_evas_wl_init_count;
327
328    _ecore_evas_wl_event_hdls[0] = 
329      ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, 
330                              _ecore_evas_wl_cb_mouse_in, NULL);
331    _ecore_evas_wl_event_hdls[1] = 
332      ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, 
333                              _ecore_evas_wl_cb_mouse_out, NULL);
334    _ecore_evas_wl_event_hdls[2] = 
335      ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, 
336                              _ecore_evas_wl_cb_focus_in, NULL);
337    _ecore_evas_wl_event_hdls[3] = 
338      ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, 
339                              _ecore_evas_wl_cb_focus_out, NULL);
340    _ecore_evas_wl_event_hdls[4] = 
341      ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, 
342                              _ecore_evas_wl_cb_window_configure, NULL);
343
344    ecore_event_evas_init();
345
346    return _ecore_evas_wl_init_count;
347 }
348
349 static int 
350 _ecore_evas_wl_shutdown(void)
351 {
352    unsigned int i = 0;
353
354    LOGFN(__FILE__, __LINE__, __FUNCTION__);
355
356    if (--_ecore_evas_wl_init_count != 0)
357      return _ecore_evas_wl_init_count;
358
359    for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++)
360      {
361         if (_ecore_evas_wl_event_hdls[i])
362           ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
363      }
364
365    ecore_event_evas_shutdown();
366
367    return _ecore_evas_wl_init_count;
368 }
369
370 static void 
371 _ecore_evas_wl_pre_free(Ecore_Evas *ee)
372 {
373    LOGFN(__FILE__, __LINE__, __FUNCTION__);
374
375    if (!ee) return;
376    if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
377 }
378
379 static void 
380 _ecore_evas_wl_free(Ecore_Evas *ee)
381 {
382    LOGFN(__FILE__, __LINE__, __FUNCTION__);
383
384    if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win);
385    ee->engine.wl.win = NULL;
386
387    ecore_event_window_unregister(ee->prop.window);
388    ecore_evas_input_event_unregister(ee);
389
390    _ecore_evas_wl_shutdown();
391    ecore_wl_shutdown();
392 }
393
394 static void 
395 _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
396 {
397    LOGFN(__FILE__, __LINE__, __FUNCTION__);
398
399    if (!ee) return;
400    ee->func.fn_resize = func;
401 }
402
403 static void 
404 _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
405 {
406    LOGFN(__FILE__, __LINE__, __FUNCTION__);
407
408    if (!ee) return;
409    ee->func.fn_move = func;
410 }
411
412 static void 
413 _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
414 {
415    LOGFN(__FILE__, __LINE__, __FUNCTION__);
416
417    if (!ee) return;
418    ee->func.fn_delete_request = func;
419 }
420
421 static void 
422 _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
423 {
424    LOGFN(__FILE__, __LINE__, __FUNCTION__);
425
426    if (!ee) return;
427    ee->func.fn_focus_in = func;
428 }
429
430 static void 
431 _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
432 {
433    LOGFN(__FILE__, __LINE__, __FUNCTION__);
434
435    if (!ee) return;
436    ee->func.fn_focus_out = func;
437 }
438
439 static void 
440 _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
441 {
442    LOGFN(__FILE__, __LINE__, __FUNCTION__);
443
444    if (!ee) return;
445    ee->func.fn_mouse_in = func;
446 }
447
448 static void 
449 _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
450 {
451    LOGFN(__FILE__, __LINE__, __FUNCTION__);
452
453    if (!ee) return;
454    ee->func.fn_mouse_out = func;
455 }
456
457 static void 
458 _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
459 {
460    LOGFN(__FILE__, __LINE__, __FUNCTION__);
461
462    if (!ee) return;
463    ee->req.x = x;
464    ee->req.y = y;
465    if ((ee->x != x) || (ee->y != y))
466      {
467         ee->x = x;
468         ee->y = y;
469         if (ee->engine.wl.win) 
470           ecore_wl_window_update_location(ee->engine.wl.win, x, y);
471         if (ee->func.fn_move) ee->func.fn_move(ee);
472      }
473 }
474
475 static void 
476 _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
477 {
478    LOGFN(__FILE__, __LINE__, __FUNCTION__);
479    int fw = 0, fh = 0;
480
481    if (!ee) return;
482    if (w < 1) w = 1;
483    if (h < 1) h = 1;
484
485    ee->req.w = w;
486    ee->req.h = h;
487
488    if (!ee->prop.fullscreen)
489      {
490         if (ee->prop.min.w > w) w = ee->prop.min.w;
491         else if (w > ee->prop.max.w) w = ee->prop.max.w;
492         if (ee->prop.min.h > h) h = ee->prop.min.h;
493         else if (h > ee->prop.max.h) h = ee->prop.max.h;
494
495         evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
496         w += fw;
497         h += fh;
498      }
499
500 //   ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
501
502    if ((ee->w != w) || (ee->h != h))
503      {
504         ee->w = w;
505         ee->h = h;
506
507         if ((ee->rotation == 90) || (ee->rotation == 270))
508           {
509              evas_output_size_set(ee->evas, h, w);
510              evas_output_viewport_set(ee->evas, 0, 0, h, w);
511           }
512         else 
513           {
514              evas_output_size_set(ee->evas, w, h);
515              evas_output_viewport_set(ee->evas, 0, 0, w, h);
516           }
517
518         if (ee->prop.avoid_damage)
519           {
520              int pdam = 0;
521
522              pdam = ecore_evas_avoid_damage_get(ee);
523              ecore_evas_avoid_damage_set(ee, 0);
524              ecore_evas_avoid_damage_set(ee, pdam);
525           }
526
527         if (ee->engine.wl.frame)
528           evas_object_resize(ee->engine.wl.frame, w, h);
529
530         /* set new engine destination */
531         /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
532
533         /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
534
535         // WAS ACTIVE
536         /* ecore_wl_flush(); */
537
538         if (ee->engine.wl.win)
539           {
540              Evas_Engine_Info_Wayland_Egl *einfo;
541
542              if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
543                {
544                   einfo->info.edges = ee->engine.wl.win->edges;
545                   if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
546                     ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
547                }
548
549              ecore_wl_window_update_size(ee->engine.wl.win, w, h);
550              ecore_wl_window_buffer_attach(ee->engine.wl.win, NULL, 0, 0);
551           }
552
553         if (ee->func.fn_resize) ee->func.fn_resize(ee);
554      }
555 }
556
557 static void
558 _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
559 {
560    LOGFN(__FILE__, __LINE__, __FUNCTION__);
561
562    if (!ee) return;
563    if ((ee->x != x) || (ee->y != y))
564      _ecore_evas_wl_move(ee, x, y);
565    if ((ee->w != w) || (ee->h != h))
566      _ecore_evas_wl_resize(ee, w, h);
567 }
568
569 static void
570 _ecore_evas_wl_show(Ecore_Evas *ee)
571 {
572    Evas_Engine_Info_Wayland_Egl *einfo;
573
574    LOGFN(__FILE__, __LINE__, __FUNCTION__);
575
576    if ((!ee) || (ee->visible)) return;
577
578    if (ee->engine.wl.win)
579      {
580         ecore_wl_window_show(ee->engine.wl.win);
581         ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
582         ecore_wl_window_buffer_attach(ee->engine.wl.win, NULL, 0, 0);
583
584         if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
585           wl_shell_surface_set_class(ee->engine.wl.win->shell_surface, 
586                                      ee->prop.clas);
587         if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
588           wl_shell_surface_set_title(ee->engine.wl.win->shell_surface, 
589                                      ee->prop.title);
590      }
591
592    if (ee->engine.wl.frame)
593      {
594         evas_object_show(ee->engine.wl.frame);
595         evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
596      }
597
598    if (ee->engine.wl.win)
599      {
600         einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
601         if (!einfo)
602           {
603              ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
604              return;
605           }
606
607         einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win);
608         /* if (einfo->info.surface) */
609         evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
610         /* else */
611         /*   printf("Failed to get a Surface from Ecore_Wl\n"); */
612      }
613
614    ee->visible = 1;
615    if (ee->func.fn_show) ee->func.fn_show(ee);
616 }
617
618 static void 
619 _ecore_evas_wl_hide(Ecore_Evas *ee)
620 {
621    Evas_Engine_Info_Wayland_Egl *einfo;
622
623    LOGFN(__FILE__, __LINE__, __FUNCTION__);
624
625    if ((!ee) || (!ee->visible)) return;
626
627    einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
628    if (einfo)
629      {
630         einfo->info.surface = NULL;
631         evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
632      }
633
634    if (ee->engine.wl.win) 
635      ecore_wl_window_hide(ee->engine.wl.win);
636
637    ee->visible = 0;
638    ee->should_be_visible = 0;
639
640    if (ee->func.fn_hide) ee->func.fn_hide(ee);
641 }
642
643 static void 
644 _ecore_evas_wl_raise(Ecore_Evas *ee)
645 {
646    LOGFN(__FILE__, __LINE__, __FUNCTION__);
647
648    if ((!ee) || (!ee->visible)) return;
649    ecore_wl_window_raise(ee->engine.wl.win);
650 }
651
652 static void 
653 _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
654 {
655    LOGFN(__FILE__, __LINE__, __FUNCTION__);
656
657    if (!ee) return;
658    if (ee->prop.title) free(ee->prop.title);
659    ee->prop.title = NULL;
660    if (title) ee->prop.title = strdup(title);
661    if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) 
662      {
663         EE_Wl_Smart_Data *sd;
664
665         if ((sd = evas_object_smart_data_get(ee->engine.wl.frame)))
666           evas_object_text_text_set(sd->text, ee->prop.title);
667
668      }
669
670    if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
671      wl_shell_surface_set_title(ee->engine.wl.win->shell_surface, 
672                                 ee->prop.title);
673 }
674
675 static void 
676 _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) 
677 {
678    LOGFN(__FILE__, __LINE__, __FUNCTION__);
679
680    if (!ee) return;
681    if (ee->prop.name) free(ee->prop.name);
682    if (ee->prop.clas) free(ee->prop.clas);
683    ee->prop.name = NULL;
684    ee->prop.clas = NULL;
685    if (n) ee->prop.name = strdup(n);
686    if (c) ee->prop.clas = strdup(c);
687
688    if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
689      wl_shell_surface_set_class(ee->engine.wl.win->shell_surface, 
690                                 ee->prop.clas);
691 }
692
693 static void 
694 _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) 
695 {
696    LOGFN(__FILE__, __LINE__, __FUNCTION__);
697
698    if (!ee) return;
699    if (w < 0) w = 0;
700    if (h < 0) h = 0;
701    if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
702    ee->prop.min.w = w;
703    ee->prop.min.h = h;
704 }
705
706 static void 
707 _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) 
708 {
709    LOGFN(__FILE__, __LINE__, __FUNCTION__);
710
711    if (!ee) return;
712    if (w < 0) w = 0;
713    if (h < 0) h = 0;
714    if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
715    ee->prop.max.w = w;
716    ee->prop.max.h = h;
717 }
718
719 static void 
720 _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) 
721 {
722    LOGFN(__FILE__, __LINE__, __FUNCTION__);
723
724    if (!ee) return;
725    if (w < 0) w = 0;
726    if (h < 0) h = 0;
727    if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
728    ee->prop.base.w = w;
729    ee->prop.base.h = h;
730 }
731
732 static void 
733 _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) 
734 {
735    LOGFN(__FILE__, __LINE__, __FUNCTION__);
736
737    if (!ee) return;
738    if (w < 0) w = 0;
739    if (h < 0) h = 0;
740    if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
741    ee->prop.step.w = w;
742    ee->prop.step.h = h;
743 }
744
745 static void 
746 _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
747 {
748    LOGFN(__FILE__, __LINE__, __FUNCTION__);
749
750    if (!ee) return;
751    if (ee->prop.layer == layer) return;
752    if (layer < 1) layer = 1;
753    else if (layer > 255) layer = 255;
754    ee->prop.layer = layer;
755 }
756
757 static void 
758 _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
759 {
760    LOGFN(__FILE__, __LINE__, __FUNCTION__);
761
762    if (!ee) return;
763    if (ee->prop.iconified == iconify) return;
764    ee->prop.iconified = iconify;
765    /* FIXME: Implement this in Wayland someshow */
766 }
767
768 static void 
769 _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
770 {
771    LOGFN(__FILE__, __LINE__, __FUNCTION__);
772
773    if (!ee) return;
774    if (ee->prop.maximized == max) return;
775    ee->prop.maximized = max;
776    ecore_wl_window_maximized_set(ee->engine.wl.win, max);
777    if (ee->func.fn_state_change)
778      ee->func.fn_state_change(ee);
779 }
780
781 static void 
782 _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
783 {
784    LOGFN(__FILE__, __LINE__, __FUNCTION__);
785
786    if (!ee) return;
787    if (ee->prop.fullscreen == full) return;
788    ee->prop.fullscreen = full;
789    ecore_wl_window_fullscreen_set(ee->engine.wl.win, full);
790    if (ee->func.fn_state_change)
791      ee->func.fn_state_change(ee);
792 }
793
794 static void 
795 _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
796 {
797    LOGFN(__FILE__, __LINE__, __FUNCTION__);
798
799    if (!ee) return;
800    ee->ignore_events = ignore;
801    /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */
802 }
803
804 static void 
805 _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
806 {
807    Evas_Engine_Info_Wayland_Egl *einfo;
808
809    LOGFN(__FILE__, __LINE__, __FUNCTION__);
810
811    if (!ee) return;
812    if ((ee->alpha == alpha)) return;
813    ee->alpha = alpha;
814    if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
815      {
816         einfo->info.destination_alpha = alpha;
817         if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
818           ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
819         evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
820      }
821 }
822
823 static void 
824 _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
825 {
826    Evas_Engine_Info_Wayland_Egl *einfo;
827
828    LOGFN(__FILE__, __LINE__, __FUNCTION__);
829
830    if (!ee) return;
831    if ((ee->transparent == transparent)) return;
832    ee->transparent = transparent;
833
834    if (ee->engine.wl.win)
835      ecore_wl_window_transparent_set(ee->engine.wl.win, transparent);
836
837    if (!ee->visible) return;
838    if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
839      {
840         einfo->info.destination_alpha = transparent;
841         if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
842           ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
843         evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
844      }
845 }
846
847 static void
848 _ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t time __UNUSED__);
849
850 static const struct wl_callback_listener frame_listener = {
851    _ecore_evas_wl_frame_complete,
852 };
853
854 static void
855 _ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t time __UNUSED__)
856 {
857    Ecore_Evas *ee = data;
858    Ecore_Wl_Window *win = ee->engine.wl.win;
859
860    win->frame_callback = NULL;
861    win->frame_pending = EINA_FALSE;
862    wl_callback_destroy(callback);
863
864    if (win->surface)
865      {
866         win->frame_callback =
867            wl_surface_frame(win->surface);
868         wl_callback_add_listener(win->frame_callback,
869                                  &frame_listener, ee);
870      }
871 }
872
873 static int 
874 _ecore_evas_wl_render(Ecore_Evas *ee)
875 {
876    int rend = 0;
877
878    if (!ee) return 0;
879    if (!ee->visible)
880      evas_norender(ee->evas);
881    else
882      {
883         Eina_List *ll = NULL, *updates = NULL;
884         Ecore_Evas *ee2 = NULL;
885         Ecore_Wl_Window *win = NULL;
886
887         if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
888
889         EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) 
890           {
891              if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
892              if (ee2->engine.func->fn_render)
893                rend |= ee2->engine.func->fn_render(ee2);
894              if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
895           }
896
897         win = ee->engine.wl.win;
898
899         if (!win->frame_pending)
900           {
901              if (!win->frame_callback)
902                {
903                   win->frame_callback = wl_surface_frame(win->surface);
904                   wl_callback_add_listener(win->frame_callback,
905                                            &frame_listener, ee);
906                }
907
908              if ((updates = evas_render_updates(ee->evas)))
909                {
910                   Eina_List *l = NULL;
911                   Eina_Rectangle *r;
912
913                   LOGFN(__FILE__, __LINE__, __FUNCTION__);
914
915                   EINA_LIST_FOREACH(updates, l, r)
916                      ecore_wl_window_damage(win,
917                                             r->x, r->y, r->w, r->h);
918
919                   ecore_wl_flush();
920
921                   evas_render_updates_free(updates);
922                   _ecore_evas_idle_timeout_update(ee);
923                   rend = 1;
924
925                   win->frame_pending = EINA_TRUE;
926                }
927
928              if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
929           }
930
931      }
932    return rend;
933 }
934
935 static void 
936 _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
937 {
938    LOGFN(__FILE__, __LINE__, __FUNCTION__);
939
940    if (x) *x = 0;
941    if (y) *y = 0;
942    ecore_wl_screen_size_get(w, h);
943 }
944
945 static void 
946 _ecore_evas_wl_screen_dpi_get(const Ecore_Evas *ee __UNUSED__, int *xdpi, int *ydpi)
947 {
948    int dpi = 0;
949
950    LOGFN(__FILE__, __LINE__, __FUNCTION__);
951
952    if (xdpi) *xdpi = 0;
953    if (ydpi) *ydpi = 0;
954    /* FIXME: Ideally this needs to get the DPI from a specific screen */
955    dpi = ecore_wl_dpi_get();
956    if (xdpi) *xdpi = dpi;
957    if (ydpi) *ydpi = dpi;
958 }
959
960 void 
961 _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
962 {
963    LOGFN(__FILE__, __LINE__, __FUNCTION__);
964
965    if (!ee) return;
966    if (ee->engine.wl.win) 
967      {
968         Evas_Engine_Info_Wayland_Egl *einfo;
969
970         if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
971           {
972              einfo->info.edges = location;
973              if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
974                ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
975           }
976
977         ee->engine.wl.win->resizing = EINA_TRUE;
978         ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location);
979      }
980 }
981
982 void 
983 _ecore_evas_wayland_egl_move(Ecore_Evas *ee, int x, int y)
984 {
985    LOGFN(__FILE__, __LINE__, __FUNCTION__);
986
987    if (!ee) return;
988    if (ee->engine.wl.win) 
989      {
990         ee->engine.wl.win->moving = EINA_TRUE;
991         ecore_wl_window_move(ee->engine.wl.win, x, y);
992      }
993 }
994
995 static Eina_Bool 
996 _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
997 {
998    Ecore_Evas *ee;
999    Ecore_Wl_Event_Mouse_In *ev;
1000
1001    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1002
1003    ev = event;
1004    ee = ecore_event_window_match(ev->window);
1005    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1006    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1007
1008    if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
1009    ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
1010    evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
1011    _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
1012    ee->in = EINA_TRUE;
1013
1014    return ECORE_CALLBACK_PASS_ON;
1015 }
1016
1017 static Eina_Bool 
1018 _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
1019 {
1020    Ecore_Evas *ee;
1021    Ecore_Wl_Event_Mouse_Out *ev;
1022
1023    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1024
1025    ev = event;
1026    ee = ecore_event_window_match(ev->window);
1027    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1028    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1029    ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
1030    _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
1031    evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
1032    if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
1033    if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
1034    return ECORE_CALLBACK_PASS_ON;
1035 }
1036
1037 static Eina_Bool 
1038 _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
1039 {
1040    Ecore_Evas *ee;
1041    Ecore_Wl_Event_Focus_In *ev;
1042
1043    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1044
1045    ev = event;
1046    ee = ecore_event_window_match(ev->win);
1047    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1048    if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1049    ee->prop.focused = 1;
1050    evas_focus_in(ee->evas);
1051    if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
1052    return ECORE_CALLBACK_PASS_ON;
1053 }
1054
1055 static Eina_Bool 
1056 _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
1057 {
1058    Ecore_Evas *ee;
1059    Ecore_Wl_Event_Focus_In *ev;
1060
1061    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1062
1063    ev = event;
1064    ee = ecore_event_window_match(ev->win);
1065    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1066    if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1067    evas_focus_out(ee->evas);
1068    ee->prop.focused = 0;
1069    if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
1070    return ECORE_CALLBACK_PASS_ON;
1071 }
1072
1073 static Eina_Bool 
1074 _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
1075 {
1076    Ecore_Evas *ee;
1077    Ecore_Wl_Event_Window_Configure *ev;
1078    int nw = 0, nh = 0;
1079
1080    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1081
1082    ev = event;
1083    ee = ecore_event_window_match(ev->win);
1084    if (!ee) return ECORE_CALLBACK_PASS_ON;
1085    if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1086
1087    if (ee->prop.fullscreen)
1088      {
1089         _ecore_evas_wl_move(ee, ev->x, ev->y);
1090         _ecore_evas_wl_resize(ee, ev->w, ev->h);
1091
1092         return ECORE_CALLBACK_PASS_ON;
1093      }
1094
1095    if ((ee->x != ev->x) || (ee->y != ev->y))
1096      {
1097         ee->req.x = ee->x;
1098         ee->req.y = ee->y;
1099         if (ee->func.fn_move) ee->func.fn_move(ee);
1100      }
1101
1102    nw = ev->w;
1103    nh = ev->h;
1104
1105    if ((ee->prop.maximized) || (!ee->prop.fullscreen))
1106      {
1107         int fw = 0, fh = 0;
1108
1109         evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
1110         nw = ev->w - fw;
1111         nh = ev->h - fh;
1112      }
1113
1114    if (ee->prop.min.w > nw) nw = ee->prop.min.w;
1115    else if (nw > ee->prop.max.w) nw = ee->prop.max.w;
1116    if (ee->prop.min.h > nh) nh = ee->prop.min.h;
1117    else if (nh > ee->prop.max.h) nh = ee->prop.max.h;
1118
1119    if ((ee->w != nw) || (ee->h != nh))
1120      {
1121         ee->req.w = nw;
1122         ee->req.h = nh;
1123         if (ee->func.fn_resize) ee->func.fn_resize(ee);
1124      }
1125
1126    return ECORE_CALLBACK_PASS_ON;
1127 }
1128
1129 static void 
1130 _ecore_evas_wl_smart_init(void) 
1131 {
1132    if (_ecore_evas_wl_smart) return;
1133      {
1134         static const Evas_Smart_Class sc = 
1135           {
1136              "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, 
1137              _ecore_evas_wl_smart_add, 
1138              _ecore_evas_wl_smart_del, 
1139              NULL, 
1140              _ecore_evas_wl_smart_resize, 
1141              _ecore_evas_wl_smart_show, 
1142              _ecore_evas_wl_smart_hide, 
1143              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
1144           };
1145         _ecore_evas_wl_smart = evas_smart_class_new(&sc);
1146      }
1147 }
1148
1149 static void 
1150 _ecore_evas_wl_smart_add(Evas_Object *obj) 
1151 {
1152    EE_Wl_Smart_Data *sd;
1153    Evas *evas;
1154
1155    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1156
1157    if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
1158
1159    evas = evas_object_evas_get(obj);
1160
1161    sd->x = 0;
1162    sd->y = 0;
1163    sd->w = 1;
1164    sd->h = 1;
1165
1166    sd->clipper = evas_object_rectangle_add(evas);
1167    evas_object_color_set(sd->clipper, 255, 255, 255, 255);
1168    evas_object_smart_member_add(sd->clipper, obj);
1169
1170    sd->frame = evas_object_rectangle_add(evas);
1171    evas_object_color_set(sd->frame, 249, 249, 249, 255);
1172    evas_object_smart_member_add(sd->frame, obj);
1173    evas_object_clip_set(sd->frame, sd->clipper);
1174    evas_object_show(sd->frame);
1175
1176    sd->text = evas_object_text_add(evas);
1177    evas_object_color_set(sd->text, 0, 0, 0, 255);
1178    evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
1179    evas_object_text_font_set(sd->text, "Sans", 10);
1180    evas_object_text_text_set(sd->text, "Smart Test");
1181    evas_object_smart_member_add(sd->text, obj);
1182    evas_object_clip_set(sd->text, sd->clipper);
1183    evas_object_show(sd->text);
1184
1185    evas_object_smart_data_set(obj, sd);
1186 }
1187
1188 static void 
1189 _ecore_evas_wl_smart_del(Evas_Object *obj) 
1190 {
1191    EE_Wl_Smart_Data *sd;
1192
1193    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1194
1195    if (!(sd = evas_object_smart_data_get(obj))) return;
1196    evas_object_del(sd->text);
1197    evas_object_del(sd->frame);
1198    evas_object_del(sd->clipper);
1199    free(sd);
1200 }
1201
1202 static void 
1203 _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) 
1204 {
1205    EE_Wl_Smart_Data *sd;
1206
1207    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1208
1209    if (!(sd = evas_object_smart_data_get(obj))) return;
1210    if ((sd->w == w) && (sd->h == h)) return;
1211    sd->w = w;
1212    sd->h = h;
1213    evas_object_resize(sd->frame, w, h);
1214    evas_object_resize(sd->clipper, w, h);
1215 }
1216
1217 static void 
1218 _ecore_evas_wl_smart_show(Evas_Object *obj) 
1219 {
1220    EE_Wl_Smart_Data *sd;
1221
1222    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1223
1224    if (!(sd = evas_object_smart_data_get(obj))) return;
1225    evas_object_show(sd->clipper);
1226 }
1227
1228 static void 
1229 _ecore_evas_wl_smart_hide(Evas_Object *obj) 
1230 {
1231    EE_Wl_Smart_Data *sd;
1232
1233    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1234
1235    if (!(sd = evas_object_smart_data_get(obj))) return;
1236    evas_object_hide(sd->clipper);
1237 }
1238
1239 static Evas_Object *
1240 _ecore_evas_wl_frame_add(Evas *evas) 
1241 {
1242    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1243
1244    _ecore_evas_wl_smart_init();
1245    return evas_object_smart_add(evas, _ecore_evas_wl_smart);
1246 }
1247
1248 #else
1249 EAPI Ecore_Evas *
1250 ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__)
1251 {
1252    return NULL;
1253 }
1254 #endif