Ecore_Evas (Wayland): Add missing flush during rendering.
[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              ecore_wl_flush();
866           }
867
868         if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
869      }
870
871    return rend;
872 }
873
874 static void 
875 _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
876 {
877    LOGFN(__FILE__, __LINE__, __FUNCTION__);
878
879    if (x) *x = 0;
880    if (y) *y = 0;
881    ecore_wl_screen_size_get(w, h);
882 }
883
884 static Eina_Bool 
885 _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
886 {
887    Ecore_Evas *ee;
888    Ecore_Event_Mouse_Button *ev;
889
890    LOGFN(__FILE__, __LINE__, __FUNCTION__);
891
892    ev = event;
893    _ecore_evas_wl_btn_timestamp = ev->timestamp;
894    ee = ecore_event_window_match(ev->window);
895    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
896    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
897    evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers, 
898                               ev->timestamp, NULL);
899    return ECORE_CALLBACK_PASS_ON;
900 }
901
902 static Eina_Bool 
903 _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
904 {
905    Ecore_Evas *ee;
906    Ecore_Event_Mouse_Button *ev;
907
908    LOGFN(__FILE__, __LINE__, __FUNCTION__);
909
910    ev = event;
911    ee = ecore_event_window_match(ev->window);
912    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
913    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
914    evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers, 
915                             ev->timestamp, NULL);
916    return ECORE_CALLBACK_PASS_ON;
917 }
918
919 static Eina_Bool 
920 _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
921 {
922    Ecore_Evas *ee;
923    Ecore_Event_Mouse_Move *ev;
924
925    ev = event;
926    ee = ecore_event_window_match(ev->window);
927    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
928    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
929    ee->mouse.x = ev->x;
930    ee->mouse.y = ev->y;
931    evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL);
932    _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
933    return ECORE_CALLBACK_PASS_ON;
934 }
935
936 static Eina_Bool 
937 _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
938 {
939    Ecore_Evas *ee;
940    Ecore_Event_Mouse_Wheel *ev;
941
942    LOGFN(__FILE__, __LINE__, __FUNCTION__);
943
944    ev = event;
945    ee = ecore_event_window_match(ev->window);
946    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
947    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
948    evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, 
949                                ev->timestamp, NULL);
950    return ECORE_CALLBACK_PASS_ON;
951 }
952
953 static Eina_Bool 
954 _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
955 {
956    Ecore_Evas *ee;
957    Ecore_Wl_Event_Mouse_In *ev;
958
959    LOGFN(__FILE__, __LINE__, __FUNCTION__);
960
961    ev = event;
962    ee = ecore_event_window_match(ev->window);
963    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
964    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
965    if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
966    ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
967    evas_event_feed_mouse_in(ee->evas, ev->time, NULL);
968    _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time);
969    return ECORE_CALLBACK_PASS_ON;
970 }
971
972 static Eina_Bool 
973 _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
974 {
975    Ecore_Evas *ee;
976    Ecore_Wl_Event_Mouse_Out *ev;
977
978    LOGFN(__FILE__, __LINE__, __FUNCTION__);
979
980    ev = event;
981    ee = ecore_event_window_match(ev->window);
982    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
983    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
984    ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
985    _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time);
986    evas_event_feed_mouse_out(ee->evas, ev->time, NULL);
987    if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
988    if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
989    return ECORE_CALLBACK_PASS_ON;
990 }
991
992 static Eina_Bool 
993 _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
994 {
995    Ecore_Evas *ee;
996    Ecore_Wl_Event_Focus_In *ev;
997
998    LOGFN(__FILE__, __LINE__, __FUNCTION__);
999
1000    ev = event;
1001    ee = ecore_event_window_match(ev->window);
1002    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1003    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1004    ee->prop.focused = 1;
1005    evas_focus_in(ee->evas);
1006    if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
1007    return ECORE_CALLBACK_PASS_ON;
1008 }
1009
1010 static Eina_Bool 
1011 _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
1012 {
1013    Ecore_Evas *ee;
1014    Ecore_Wl_Event_Focus_Out *ev;
1015
1016    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1017
1018    ev = event;
1019    ee = ecore_event_window_match(ev->window);
1020    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1021    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1022    evas_focus_out(ee->evas);
1023    ee->prop.focused = 0;
1024    if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
1025    return ECORE_CALLBACK_PASS_ON;
1026 }
1027
1028 static void 
1029 _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) 
1030 {
1031    Ecore_Evas *ee;
1032
1033    if (!(ee = data)) return;
1034    if ((shell_surface) && (ee->engine.wl.shell_surface)) 
1035      {
1036         if (ee->engine.wl.shell_surface != shell_surface) return;
1037      }
1038
1039    ecore_evas_resize(ee, width, height);
1040 }
1041
1042 static void 
1043 _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest)
1044 {
1045    static unsigned int format;
1046    char tmp[PATH_MAX];
1047    int fd = -1, stride = 0, size = 0;
1048    void *ret;
1049
1050    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1051
1052    if (dest) *dest = NULL;
1053
1054    if (!format) format = ecore_wl_format_get();
1055
1056    strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX");
1057    if ((fd = mkstemp(tmp)) < 0) 
1058      {
1059         ERR("Could not create temporary file.");
1060         return;
1061      }
1062
1063    stride = (ee->w * sizeof(int));
1064    size = (stride * ee->h);
1065    if (ftruncate(fd, size) < 0) 
1066      {
1067         ERR("Could not truncate temporary file.");
1068         close(fd);
1069         return;
1070      }
1071
1072    ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
1073    unlink(tmp);
1074
1075    if (ret == MAP_FAILED) 
1076      {
1077         ERR("mmap of temporary file failed.");
1078         close(fd);
1079         return;
1080      }
1081
1082    if (dest) *dest = ret;
1083
1084    ee->engine.wl.buffer = 
1085      wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format);
1086
1087    close(fd);
1088 }
1089
1090 static void 
1091 _ecore_evas_wl_smart_init(void) 
1092 {
1093    if (_ecore_evas_wl_smart) return;
1094      {
1095         static const Evas_Smart_Class sc = 
1096           {
1097              "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, 
1098              _ecore_evas_wl_smart_add, 
1099              _ecore_evas_wl_smart_del, 
1100              NULL, 
1101              _ecore_evas_wl_smart_resize, 
1102              _ecore_evas_wl_smart_show, 
1103              _ecore_evas_wl_smart_hide, 
1104              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
1105           };
1106         _ecore_evas_wl_smart = evas_smart_class_new(&sc);
1107      }
1108 }
1109
1110 static void 
1111 _ecore_evas_wl_smart_add(Evas_Object *obj) 
1112 {
1113    EE_Wl_Smart_Data *sd;
1114    Evas *evas;
1115
1116    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1117
1118    if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
1119
1120    evas = evas_object_evas_get(obj);
1121
1122    sd->x = 0;
1123    sd->y = 0;
1124    sd->w = 1;
1125    sd->h = 1;
1126
1127    sd->frame = evas_object_rectangle_add(evas);
1128    evas_object_is_frame_object_set(sd->frame, EINA_TRUE);
1129    evas_object_color_set(sd->frame, 249, 249, 249, 255);
1130    evas_object_smart_member_add(sd->frame, obj);
1131
1132    sd->text = evas_object_text_add(evas);
1133    evas_object_color_set(sd->text, 0, 0, 0, 255);
1134    evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
1135    evas_object_text_font_set(sd->text, "Sans", 10);
1136    evas_object_text_text_set(sd->text, "Smart Test");
1137
1138    evas_object_smart_data_set(obj, sd);
1139 }
1140
1141 static void 
1142 _ecore_evas_wl_smart_del(Evas_Object *obj) 
1143 {
1144    EE_Wl_Smart_Data *sd;
1145
1146    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1147
1148    if (!(sd = evas_object_smart_data_get(obj))) return;
1149    evas_object_del(sd->text);
1150    evas_object_del(sd->frame);
1151    free(sd);
1152 }
1153
1154 static void 
1155 _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) 
1156 {
1157    EE_Wl_Smart_Data *sd;
1158
1159    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1160
1161    if (!(sd = evas_object_smart_data_get(obj))) return;
1162    if ((sd->w == w) && (sd->h == h)) return;
1163    sd->w = w;
1164    sd->h = h;
1165    evas_object_resize(sd->frame, w, h);
1166 }
1167
1168 static void 
1169 _ecore_evas_wl_smart_show(Evas_Object *obj) 
1170 {
1171    EE_Wl_Smart_Data *sd;
1172
1173    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1174
1175    if (!(sd = evas_object_smart_data_get(obj))) return;
1176    evas_object_show(sd->frame);
1177    evas_object_show(sd->text);
1178 }
1179
1180 static void 
1181 _ecore_evas_wl_smart_hide(Evas_Object *obj) 
1182 {
1183    EE_Wl_Smart_Data *sd;
1184
1185    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1186
1187    if (!(sd = evas_object_smart_data_get(obj))) return;
1188    evas_object_hide(sd->text);
1189    evas_object_hide(sd->frame);
1190 }
1191
1192 static Evas_Object *
1193 _ecore_evas_wl_frame_add(Evas *evas) 
1194 {
1195    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1196
1197    _ecore_evas_wl_smart_init();
1198    return evas_object_smart_add(evas, _ecore_evas_wl_smart);
1199 }
1200
1201 #else
1202 EAPI Ecore_Evas *
1203 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__)
1204 {
1205    return NULL;
1206 }
1207
1208 EAPI void 
1209 ecore_evas_wayland_shm_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
1210 {
1211
1212 }
1213 #endif