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