9 # define LOGFN(fl, ln, fn) \
10 printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn);
12 # define LOGFN(fl, ln, fn)
15 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
19 # include <sys/types.h>
20 # include <sys/mman.h>
27 #include "ecore_evas_private.h"
28 #include "Ecore_Evas.h"
30 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
31 # include <Evas_Engine_Wayland_Egl.h>
32 # include <Ecore_Wayland.h>
34 /* local structures */
35 typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
36 struct _EE_Wl_Smart_Data
40 Evas_Coord x, y, w, h;
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_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
55 static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
56 static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
57 static void _ecore_evas_wl_show(Ecore_Evas *ee);
58 static void _ecore_evas_wl_hide(Ecore_Evas *ee);
59 static void _ecore_evas_wl_raise(Ecore_Evas *ee);
60 static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title);
61 static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
62 static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
63 static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
64 static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
65 static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
66 static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
67 static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
68 static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
69 static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
70 static int _ecore_evas_wl_render(Ecore_Evas *ee);
71 static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
73 static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
74 static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
75 static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
76 static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
77 static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
79 /* SMART stuff for frame */
80 static Evas_Smart *_ecore_evas_wl_smart = NULL;
82 static void _ecore_evas_wl_smart_init(void);
83 static void _ecore_evas_wl_smart_add(Evas_Object *obj);
84 static void _ecore_evas_wl_smart_del(Evas_Object *obj);
85 static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
86 static void _ecore_evas_wl_smart_show(Evas_Object *obj);
87 static void _ecore_evas_wl_smart_hide(Evas_Object *obj);
89 static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
92 static int _ecore_evas_wl_init_count = 0;
93 static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5];
95 static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
98 _ecore_evas_wl_callback_resize_set,
99 _ecore_evas_wl_callback_move_set,
102 _ecore_evas_wl_callback_delete_request_set,
104 _ecore_evas_wl_callback_focus_in_set,
105 _ecore_evas_wl_callback_focus_out_set,
106 _ecore_evas_wl_callback_mouse_in_set,
107 _ecore_evas_wl_callback_mouse_out_set,
109 NULL, // unsticky_set
110 NULL, // pre_render_set
111 NULL, // post_render_set
113 NULL, // managed_move
114 _ecore_evas_wl_resize,
116 NULL, // rotation_set
120 _ecore_evas_wl_raise,
123 _ecore_evas_wl_title_set,
124 _ecore_evas_wl_name_class_set,
125 _ecore_evas_wl_size_min_set,
126 _ecore_evas_wl_size_max_set,
127 _ecore_evas_wl_size_base_set,
128 _ecore_evas_wl_size_step_set,
129 NULL, // object_cursor_set
130 _ecore_evas_wl_layer_set,
132 _ecore_evas_wl_iconified_set,
133 NULL, // borderless set
134 NULL, // override set
135 _ecore_evas_wl_maximized_set,
136 _ecore_evas_wl_fullscreen_set,
137 NULL, // func avoid_damage set
138 NULL, // func withdrawn set
139 NULL, // func sticky set
140 NULL, // func ignore_events set
141 NULL, // func alpha set
142 NULL, // func transparent set
149 _ecore_evas_wl_render,
150 _ecore_evas_wl_screen_geometry_get
153 /* external variables */
155 /* external functions */
157 ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
159 Ecore_Wl_Window *p = NULL;
160 Evas_Engine_Info_Wayland_Egl *einfo;
164 LOGFN(__FILE__, __LINE__, __FUNCTION__);
166 if (!(method = evas_render_method_lookup("wayland_egl")))
168 ERR("Render method lookup failed for Wayland_Egl");
172 if (!ecore_wl_init(disp_name))
174 ERR("Failed to initialize Ecore_Wayland");
178 if (!(ee = calloc(1, sizeof(Ecore_Evas))))
180 ERR("Failed to allocate Ecore_Evas");
185 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
187 _ecore_evas_wl_init();
189 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
191 ee->driver = "wayland_egl";
192 if (disp_name) ee->name = strdup(disp_name);
206 ee->prop.max.w = 32767;
207 ee->prop.max.h = 32767;
209 ee->prop.request_pos = 0;
211 ee->prop.draw_frame = frame;
213 ee->evas = evas_new();
214 evas_data_attach_set(ee->evas, ee);
215 evas_output_method_set(ee->evas, method);
216 evas_output_size_set(ee->evas, ee->w, ee->h);
217 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
219 /* FIXME: This needs to be set based on theme & scale */
220 if (ee->prop.draw_frame)
221 evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
224 p = ecore_wl_window_find(parent);
226 ee->engine.wl.parent = p;
228 ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
229 ee->prop.window = ee->engine.wl.win->id;
231 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
233 einfo->info.display = ecore_wl_display_get();
234 einfo->info.rotation = ee->rotation;
235 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
237 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
239 _ecore_evas_wl_shutdown();
246 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
248 _ecore_evas_wl_shutdown();
253 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
255 if (ee->prop.draw_frame)
257 ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas);
258 evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE);
259 evas_object_move(ee->engine.wl.frame, 0, 0);
262 ecore_evas_input_event_register(ee);
263 _ecore_evas_register(ee);
265 ecore_event_window_register(ee->prop.window, ee, ee->evas,
266 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
267 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
268 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
269 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
271 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
276 /* local functions */
278 _ecore_evas_wl_init(void)
280 LOGFN(__FILE__, __LINE__, __FUNCTION__);
282 if (++_ecore_evas_wl_init_count != 1)
283 return _ecore_evas_wl_init_count;
285 _ecore_evas_wl_event_hdls[0] =
286 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
287 _ecore_evas_wl_cb_mouse_in, NULL);
288 _ecore_evas_wl_event_hdls[1] =
289 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
290 _ecore_evas_wl_cb_mouse_out, NULL);
291 _ecore_evas_wl_event_hdls[2] =
292 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
293 _ecore_evas_wl_cb_focus_in, NULL);
294 _ecore_evas_wl_event_hdls[3] =
295 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
296 _ecore_evas_wl_cb_focus_out, NULL);
297 _ecore_evas_wl_event_hdls[4] =
298 ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
299 _ecore_evas_wl_cb_window_configure, NULL);
301 ecore_event_evas_init();
303 return _ecore_evas_wl_init_count;
307 _ecore_evas_wl_shutdown(void)
311 LOGFN(__FILE__, __LINE__, __FUNCTION__);
313 if (--_ecore_evas_wl_init_count != 0)
314 return _ecore_evas_wl_init_count;
316 for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++)
318 if (_ecore_evas_wl_event_hdls[i])
319 ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
322 ecore_event_evas_shutdown();
324 return _ecore_evas_wl_init_count;
328 _ecore_evas_wl_pre_free(Ecore_Evas *ee)
330 LOGFN(__FILE__, __LINE__, __FUNCTION__);
333 if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
337 _ecore_evas_wl_free(Ecore_Evas *ee)
339 LOGFN(__FILE__, __LINE__, __FUNCTION__);
341 if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win);
342 ee->engine.wl.win = NULL;
344 ecore_event_window_unregister(ee->prop.window);
345 ecore_evas_input_event_unregister(ee);
347 _ecore_evas_wl_shutdown();
352 _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
354 LOGFN(__FILE__, __LINE__, __FUNCTION__);
357 ee->func.fn_resize = func;
361 _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
363 LOGFN(__FILE__, __LINE__, __FUNCTION__);
366 ee->func.fn_move = func;
370 _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
372 LOGFN(__FILE__, __LINE__, __FUNCTION__);
375 ee->func.fn_delete_request = func;
379 _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
381 LOGFN(__FILE__, __LINE__, __FUNCTION__);
384 ee->func.fn_focus_in = func;
388 _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
390 LOGFN(__FILE__, __LINE__, __FUNCTION__);
393 ee->func.fn_focus_out = func;
397 _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
399 LOGFN(__FILE__, __LINE__, __FUNCTION__);
402 ee->func.fn_mouse_in = func;
406 _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
408 LOGFN(__FILE__, __LINE__, __FUNCTION__);
411 ee->func.fn_mouse_out = func;
415 _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
417 LOGFN(__FILE__, __LINE__, __FUNCTION__);
424 if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y);
425 if (ee->func.fn_move) ee->func.fn_move(ee);
429 _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
431 LOGFN(__FILE__, __LINE__, __FUNCTION__);
436 // if ((ee->w == w) && (ee->h == h)) return;
438 if (ee->prop.min.w > w) w = ee->prop.min.w;
439 else if (w > ee->prop.max.w) w = ee->prop.max.w;
440 if (ee->prop.min.h > h) h = ee->prop.min.h;
441 else if (h > ee->prop.max.h) h = ee->prop.max.h;
446 // ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
451 /* change evas output & viewport sizes */
452 evas_output_size_set(ee->evas, ee->w, ee->h);
453 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
454 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
455 if (ee->engine.wl.frame)
456 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
458 /* set new engine destination */
459 /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
461 /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
464 ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
466 if (ee->func.fn_resize) ee->func.fn_resize(ee);
470 _ecore_evas_wl_show(Ecore_Evas *ee)
472 Evas_Engine_Info_Wayland_Egl *einfo;
474 LOGFN(__FILE__, __LINE__, __FUNCTION__);
476 if ((!ee) || (ee->visible)) return;
478 if (ee->engine.wl.win)
479 ecore_wl_window_show(ee->engine.wl.win);
481 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
484 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
487 einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win);
488 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
490 if (ee->engine.wl.frame)
492 evas_object_show(ee->engine.wl.frame);
493 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
498 /* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */
501 if (ee->func.fn_show) ee->func.fn_show(ee);
505 _ecore_evas_wl_hide(Ecore_Evas *ee)
507 Evas_Engine_Info_Wayland_Egl *einfo;
509 LOGFN(__FILE__, __LINE__, __FUNCTION__);
511 if ((!ee) || (!ee->visible)) return;
513 if (ee->engine.wl.win) ecore_wl_window_hide(ee->engine.wl.win);
515 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
516 if ((einfo) && (einfo->info.surface))
518 einfo->info.surface = NULL;
519 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
523 ee->should_be_visible = 0;
525 if (ee->func.fn_hide) ee->func.fn_hide(ee);
529 _ecore_evas_wl_raise(Ecore_Evas *ee)
531 LOGFN(__FILE__, __LINE__, __FUNCTION__);
533 if ((!ee) || (!ee->visible)) return;
534 ecore_wl_window_raise(ee->engine.wl.win);
538 _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
540 LOGFN(__FILE__, __LINE__, __FUNCTION__);
543 if (ee->prop.title) free(ee->prop.title);
544 ee->prop.title = NULL;
545 if (title) ee->prop.title = strdup(title);
546 if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
548 EE_Wl_Smart_Data *sd;
550 if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
551 evas_object_text_text_set(sd->text, ee->prop.title);
556 _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
558 LOGFN(__FILE__, __LINE__, __FUNCTION__);
561 if (ee->prop.name) free(ee->prop.name);
562 if (ee->prop.clas) free(ee->prop.clas);
563 ee->prop.name = NULL;
564 ee->prop.clas = NULL;
565 if (n) ee->prop.name = strdup(n);
566 if (c) ee->prop.clas = strdup(c);
567 /* FIXME: Forward these changes to Wayland somehow */
571 _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h)
573 LOGFN(__FILE__, __LINE__, __FUNCTION__);
578 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
584 _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h)
586 LOGFN(__FILE__, __LINE__, __FUNCTION__);
591 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
597 _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h)
599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
604 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
610 _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
612 LOGFN(__FILE__, __LINE__, __FUNCTION__);
617 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
623 _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
625 LOGFN(__FILE__, __LINE__, __FUNCTION__);
628 if (ee->prop.layer == layer) return;
629 if (layer < 1) layer = 1;
630 else if (layer > 255) layer = 255;
631 ee->prop.layer = layer;
635 _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
637 LOGFN(__FILE__, __LINE__, __FUNCTION__);
640 if (ee->prop.iconified == iconify) return;
641 ee->prop.iconified = iconify;
642 /* FIXME: Implement this in Wayland someshow */
646 _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
648 LOGFN(__FILE__, __LINE__, __FUNCTION__);
651 if (ee->prop.maximized == max) return;
652 ee->prop.maximized = max;
653 ecore_wl_window_maximized_set(ee->engine.wl.win, max);
657 _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
659 LOGFN(__FILE__, __LINE__, __FUNCTION__);
661 if ((!ee) || (!ee->visible)) return;
662 if (ee->prop.fullscreen == full) return;
663 ee->prop.fullscreen = full;
664 ecore_wl_window_fullscreen_set(ee->engine.wl.win, full);
668 _ecore_evas_wl_render(Ecore_Evas *ee)
674 evas_norender(ee->evas);
677 Eina_List *ll = NULL, *updates = NULL;
678 Ecore_Evas *ee2 = NULL;
680 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
682 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
684 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
685 if (ee2->engine.func->fn_render)
686 rend |= ee2->engine.func->fn_render(ee2);
687 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
690 if ((updates = evas_render_updates(ee->evas)))
695 LOGFN(__FILE__, __LINE__, __FUNCTION__);
697 EINA_LIST_FOREACH(updates, l, r)
698 ecore_wl_window_damage(ee->engine.wl.win,
699 r->x, r->y, r->w, r->h);
703 evas_render_updates_free(updates);
704 _ecore_evas_idle_timeout_update(ee);
708 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
714 _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
716 LOGFN(__FILE__, __LINE__, __FUNCTION__);
720 ecore_wl_screen_size_get(w, h);
724 _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
726 LOGFN(__FILE__, __LINE__, __FUNCTION__);
729 if (ee->engine.wl.win)
730 ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location);
734 _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
737 Ecore_Wl_Event_Mouse_In *ev;
739 LOGFN(__FILE__, __LINE__, __FUNCTION__);
742 ee = ecore_event_window_match(ev->win);
743 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
744 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
745 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
746 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
747 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
748 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
749 return ECORE_CALLBACK_PASS_ON;
753 _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
756 Ecore_Wl_Event_Mouse_Out *ev;
758 LOGFN(__FILE__, __LINE__, __FUNCTION__);
761 ee = ecore_event_window_match(ev->win);
762 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
763 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
764 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
765 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
766 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
767 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
768 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
769 return ECORE_CALLBACK_PASS_ON;
773 _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
776 Ecore_Wl_Event_Focus_In *ev;
778 LOGFN(__FILE__, __LINE__, __FUNCTION__);
781 ee = ecore_event_window_match(ev->win);
782 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
783 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
784 ee->prop.focused = 1;
785 evas_focus_in(ee->evas);
786 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
787 return ECORE_CALLBACK_PASS_ON;
791 _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
794 Ecore_Wl_Event_Focus_In *ev;
796 LOGFN(__FILE__, __LINE__, __FUNCTION__);
799 ee = ecore_event_window_match(ev->win);
800 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
801 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
802 evas_focus_out(ee->evas);
803 ee->prop.focused = 0;
804 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
805 return ECORE_CALLBACK_PASS_ON;
809 _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
812 Ecore_Wl_Event_Window_Configure *ev;
814 LOGFN(__FILE__, __LINE__, __FUNCTION__);
817 ee = ecore_event_window_match(ev->win);
818 if (!ee) return ECORE_CALLBACK_PASS_ON;
819 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
820 if ((ee->x != ev->x) || (ee->y != ev->y))
826 if (ee->func.fn_move) ee->func.fn_move(ee);
828 if ((ee->req.w != ev->w) || (ee->req.h != ev->h))
832 if (ee->func.fn_resize) ee->func.fn_resize(ee);
835 return ECORE_CALLBACK_PASS_ON;
839 _ecore_evas_wl_smart_init(void)
841 if (_ecore_evas_wl_smart) return;
843 static const Evas_Smart_Class sc =
845 "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION,
846 _ecore_evas_wl_smart_add,
847 _ecore_evas_wl_smart_del,
849 _ecore_evas_wl_smart_resize,
850 _ecore_evas_wl_smart_show,
851 _ecore_evas_wl_smart_hide,
852 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
854 _ecore_evas_wl_smart = evas_smart_class_new(&sc);
859 _ecore_evas_wl_smart_add(Evas_Object *obj)
861 EE_Wl_Smart_Data *sd;
864 LOGFN(__FILE__, __LINE__, __FUNCTION__);
866 if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
868 evas = evas_object_evas_get(obj);
875 sd->frame = evas_object_rectangle_add(evas);
876 evas_object_is_frame_object_set(sd->frame, EINA_TRUE);
877 evas_object_color_set(sd->frame, 249, 249, 249, 255);
878 evas_object_smart_member_add(sd->frame, obj);
880 sd->text = evas_object_text_add(evas);
881 evas_object_color_set(sd->text, 0, 0, 0, 255);
882 evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
883 evas_object_text_font_set(sd->text, "Sans", 10);
884 evas_object_text_text_set(sd->text, "Smart Test");
886 evas_object_smart_data_set(obj, sd);
890 _ecore_evas_wl_smart_del(Evas_Object *obj)
892 EE_Wl_Smart_Data *sd;
894 LOGFN(__FILE__, __LINE__, __FUNCTION__);
896 if (!(sd = evas_object_smart_data_get(obj))) return;
897 evas_object_del(sd->text);
898 evas_object_del(sd->frame);
903 _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
905 EE_Wl_Smart_Data *sd;
907 LOGFN(__FILE__, __LINE__, __FUNCTION__);
909 if (!(sd = evas_object_smart_data_get(obj))) return;
910 if ((sd->w == w) && (sd->h == h)) return;
913 evas_object_resize(sd->frame, w, h);
917 _ecore_evas_wl_smart_show(Evas_Object *obj)
919 EE_Wl_Smart_Data *sd;
921 LOGFN(__FILE__, __LINE__, __FUNCTION__);
923 if (!(sd = evas_object_smart_data_get(obj))) return;
924 evas_object_show(sd->frame);
925 evas_object_show(sd->text);
929 _ecore_evas_wl_smart_hide(Evas_Object *obj)
931 EE_Wl_Smart_Data *sd;
933 LOGFN(__FILE__, __LINE__, __FUNCTION__);
935 if (!(sd = evas_object_smart_data_get(obj))) return;
936 evas_object_hide(sd->text);
937 evas_object_hide(sd->frame);
941 _ecore_evas_wl_frame_add(Evas *evas)
943 LOGFN(__FILE__, __LINE__, __FUNCTION__);
945 _ecore_evas_wl_smart_init();
946 return evas_object_smart_add(evas, _ecore_evas_wl_smart);
951 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__)