diff --git a/meson.build b/meson.build index 256256d8a8..6ad434980c 100644 --- a/meson.build +++ b/meson.build @@ -331,7 +331,7 @@ subprojects = [ ['ethumb' ,[] , true, true, true, false, false, false, ['eina', 'efl', 'eo'], []], ['ethumb_client' ,[] , false, true, true, false, false, true, ['eina', 'efl', 'eo', 'ethumb'], []], ['elementary' ,[] , true, true, true, true, true, true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-file', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio'], ['atspi']], -['efl_wl' ,['wl'] , false, true, true, false, false, false, ['evas', 'ecore'], []], +['efl_wl' ,['wl'] , false, true, true, false, false, false, ['eina', 'efl', 'eo', 'evas', 'ecore'], []], ['elua' ,['elua'] , false, true, true, false, true, false, ['eina', 'luajit'], []], ['ecore_wayland' ,['wl-deprecated'] , false, true, false, false, false, false, ['eina'], []], ['ecore_drm' ,['drm-deprecated'] , false, true, false, false, false, false, ['eina'], []], diff --git a/src/bin/efl_wl/efl_wl_test.c b/src/bin/efl_wl/efl_wl_test.c index bf5b2ad4d1..b9f9f6b450 100644 --- a/src/bin/efl_wl/efl_wl_test.c +++ b/src/bin/efl_wl/efl_wl_test.c @@ -6,13 +6,12 @@ static Evas_Object *win; static Eina_Strbuf *buf; -static Ecore_Exe *exe; +static Eo *exe; -static Eina_Bool -del_handler(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Del *ev) +static void +del_handler(void *d EINA_UNUSED, const Efl_Event *ev) { - if (ev->exe == exe) ecore_main_loop_quit(); - return ECORE_CALLBACK_RENEW; + if (ev->object == exe) ecore_main_loop_quit(); } static void @@ -25,7 +24,7 @@ static Eina_Bool dostuff(void *data) { exe = efl_wl_run(data, eina_strbuf_string_get(buf)); - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, (Ecore_Event_Handler_Cb)del_handler, NULL); + efl_event_callback_add(exe, EFL_TASK_EVENT_EXIT, del_handler, NULL); evas_object_focus_set(data, 1); return EINA_FALSE; } @@ -63,7 +62,7 @@ main(int argc, char *argv[]) elm_win_autodel_set(win, 1); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); - o = efl_wl_add(evas_object_evas_get(win)); + o = efl_add(EFL_WL_CLASS, win); efl_wl_aspect_set(o, 1); efl_wl_minmax_set(o, 1); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/src/bin/efl_wl/efl_wl_test_stack.c b/src/bin/efl_wl/efl_wl_test_stack.c index 51cd598984..e6eaa34760 100644 --- a/src/bin/efl_wl/efl_wl_test_stack.c +++ b/src/bin/efl_wl/efl_wl_test_stack.c @@ -26,13 +26,13 @@ dostuff(void *data) static void prev_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - efl_wl_prev(data); + efl_wl_surface_prev(data); } static void next_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - efl_wl_next(data); + efl_wl_surface_next(data); } int @@ -69,7 +69,7 @@ main(int argc, char *argv[]) evas_object_show(next); elm_table_pack(o, next, 1, 0, 1, 1); - comp = efl_wl_add(evas_object_evas_get(win)); + comp = efl_add(EFL_WL_CLASS, win); evas_object_size_hint_min_set(comp, 640, 480); elm_table_pack(o, comp, 0, 1, 2, 1); evas_object_size_hint_align_set(comp, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/src/bin/efl_wl/meson.build b/src/bin/efl_wl/meson.build index c95cd0e767..dc0f0d248c 100644 --- a/src/bin/efl_wl/meson.build +++ b/src/bin/efl_wl/meson.build @@ -1,13 +1,13 @@ executable('efl_wl_test', 'efl_wl_test.c', include_directories : config_dir, - dependencies: [efl_wl, elementary], + dependencies: [efl_wl, efl_wl_deps, efl_wl_pub_deps, elementary], install: true, ) executable('efl_wl_test_stack', 'efl_wl_test_stack.c', include_directories : config_dir, - dependencies: [efl_wl, elementary], + dependencies: [efl_wl, efl_wl_deps, efl_wl_pub_deps, elementary], install: true, ) diff --git a/src/lib/efl_wl/Efl_Wl.h b/src/lib/efl_wl/Efl_Wl.h index a866a4ee13..ee36eb74bb 100644 --- a/src/lib/efl_wl/Efl_Wl.h +++ b/src/lib/efl_wl/Efl_Wl.h @@ -1,24 +1,35 @@ -#ifdef EFL_BETA_API_SUPPORT - #ifndef EFL_WL_H # define EFL_WL_H #include -#include +#include #ifdef EAPI # undef EAPI #endif - -#ifdef __GNUC__ -# if __GNUC__ >= 4 -# define EAPI __attribute__ ((visibility("default"))) -# else -# define EAPI -# endif -#else -# define EAPI +#ifdef EAPI_WEAK +# undef EAPI_WEAK #endif +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# define EAPI_WEAK +# else +# define EAPI +# define EAPI_WEAK +# endif +# endif + +#define EWAPI EAPI EAPI_WEAK + + +typedef struct Efl_Wl_Wl_Surface Efl_Wl_Wl_Surface; +typedef struct Efl_Wl_Wl_Global Efl_Wl_Wl_Global; +typedef struct Efl_Wl_Wl_Interface Efl_Wl_Wl_Interface; +typedef void * Efl_Wl_Wl_Interface_Data; +typedef void * Efl_Wl_Wl_Interface_Bind_Cb; + +#include /** * @defgroup Efl_Wl_Group EFL Wayland * @@ -27,19 +38,7 @@ * @since 1.20 * @{ */ - -/** - * @typedef Efl_Wl_Rotation - * The rotation to apply to the compositor's internal wl_output - */ -typedef enum -{ - EFL_WL_ROTATION_0, - EFL_WL_ROTATION_90, - EFL_WL_ROTATION_180, - EFL_WL_ROTATION_270 -} Efl_Wl_Rotation; - +#if 0 /** * Add a compositor widget to the given canvas. * @@ -103,7 +102,7 @@ EAPI void efl_wl_pid_del(Evas_Object *obj, int32_t pid); * @param obj The compositor widget * @return EINA_TRUE if the window stacking was changed */ -EAPI Eina_Bool efl_wl_next(Evas_Object *obj); +EAPI Eina_Bool efl_wl_surface_next(Evas_Object *obj); /** * Put the second top-most toplevel window on top and apply focus to it @@ -111,7 +110,7 @@ EAPI Eina_Bool efl_wl_next(Evas_Object *obj); * @param obj The compositor widget * @return EINA_TRUE if the window stacking was changed */ -EAPI Eina_Bool efl_wl_prev(Evas_Object *obj); +EAPI Eina_Bool efl_wl_surface_prev(Evas_Object *obj); /** * Set rotation and flip for the compositor's output @@ -165,7 +164,7 @@ EAPI void efl_wl_minmax_set(Evas_Object *obj, Eina_Bool set); * @since 1.21 */ EAPI void *efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t version, void *data, void *bind_cb); - +#endif /** * Extract a child surface from the compositor * @@ -236,6 +235,9 @@ EAPI void efl_wl_seat_keymap_set(Evas_Object *obj, Eo *seat, void *state, char * * @since 1.21 */ EAPI void efl_wl_seat_key_repeat_set(Evas_Object *obj, Eo *seat, int repeat_rate, int repeat_delay); -#endif +#undef EAPI +#define EAPI +#undef EAPI_WEAK +#define EAPI_WEAK #endif diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 2aef1368ce..defa800066 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -1,3 +1,6 @@ +#define EFL_INTERNAL_UNSTABLE +#define EFL_CANVAS_GROUP_PROTECTED + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -34,7 +37,8 @@ # ifdef HAVE_ECORE_X #include "Ecore_X.h" #endif - +#include "Evas_Internal.h" +#include "canvas/evas_canvas_eo.h" #include "Efl_Wl.h" #undef COORDS_INSIDE @@ -84,6 +88,7 @@ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE | \ WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK) +#define MY_CLASS EFL_WL_CLASS typedef struct Input_Sequence { @@ -124,12 +129,11 @@ typedef struct Comp struct wl_display *display; double wayland_time_base; - Evas_Object *obj; - Evas_Object *clip; - Evas_Object *events; + Eo *obj; + Eo *clip; + Eo *events; Eina_Hash *exes; - Ecore_Event_Handler *exe_handler; Eina_Inlist *surfaces; unsigned int surfaces_count; @@ -229,7 +233,7 @@ typedef struct Comp_Seat } cursor; struct { - Evas_Object *obj; + Eo *obj; int layer; int x, y; } efl; @@ -294,9 +298,9 @@ struct Comp_Surface { EINA_INLIST; Comp *c; - Evas_Object *obj; - Evas_Object *clip; - Evas_Object *img; + Eo *obj; + Eo *clip; + Eo *img; Eina_Array *input_rects; Eina_Array *opaque_rects; Eina_List *proxies; @@ -571,12 +575,12 @@ seat_tch_resources_get(Comp_Seat *s, struct wl_client *client) return s->tch.resources ? eina_hash_find(s->tch.resources, &client) : NULL; } -static void comp_render_pre_proxied(Evas_Object *o, Evas *e, void *event_info); +static void comp_render_pre_proxied(Eo *o, Evas *e, void *event_info); static void comp_render_post_proxied(Comp_Surface *cs, Evas *e, void *event_info); -static void comp_surface_commit_image_state(Comp_Surface *cs, Comp_Buffer *buffer, Evas_Object *o); +static void comp_surface_commit_image_state(Comp_Surface *cs, Comp_Buffer *buffer, Eo *o); static void -comp_surface_proxy_del(void *data, Evas *e, Evas_Object *obj, void *event_info EINA_UNUSED) +comp_surface_proxy_del(void *data, Evas *e, Eo *obj, void *event_info EINA_UNUSED) { Comp_Surface *cs = data; int i; @@ -598,7 +602,7 @@ comp_surface_proxy_del(void *data, Evas *e, Evas_Object *obj, void *event_info E } static void -comp_surface_proxy_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +comp_surface_proxy_resize(void *data, Evas *e EINA_UNUSED, Eo *obj, void *event_info EINA_UNUSED) { int w, h; @@ -643,7 +647,7 @@ comp_surface_proxy_win_del(Ecore_Evas *ee) static void seat_drag_proxy_win_add(Comp_Seat *s) { - Evas_Object *o; + Eo *o; if (s->drag.proxy_win) abort(); evas_object_hide(s->drag.surface->obj); @@ -1344,7 +1348,7 @@ comp_surface_buffer_post_render(Comp_Surface *cs) } static void -comp_surface_pixels_get(void *data, Evas_Object *obj) +comp_surface_pixels_get(void *data, Eo *obj) { Comp_Surface *cs = data; Comp_Buffer *buffer; @@ -1358,7 +1362,7 @@ comp_surface_pixels_get(void *data, Evas_Object *obj) } static void -comp_surface_commit_image_state(Comp_Surface *cs, Comp_Buffer *buffer, Evas_Object *o) +comp_surface_commit_image_state(Comp_Surface *cs, Comp_Buffer *buffer, Eo *o) { if ((!buffer->renders) || (!eina_list_data_find(buffer->renders, evas_object_evas_get(o)))) buffer->renders = eina_list_append(buffer->renders, evas_object_evas_get(o)); @@ -1410,7 +1414,7 @@ comp_surface_commit_state(Comp_Surface *cs, Comp_Buffer_State *state) { int x, y; Eina_List *l; - Evas_Object *o; + Eo *o; Comp_Buffer *buffer = NULL; Eina_Bool newly_new = EINA_FALSE; @@ -1513,7 +1517,7 @@ comp_surface_commit_state(Comp_Surface *cs, Comp_Buffer_State *state) { Eina_Iterator *it; Eina_Rectangle *rect; - Evas_Object *r; + Eo *r; it = eina_tiler_iterator_new(state->opaque); cs->opaque_rects = eina_array_new(1); @@ -1550,7 +1554,7 @@ comp_surface_commit_state(Comp_Surface *cs, Comp_Buffer_State *state) { Eina_Iterator *it; Eina_Rectangle *rect; - Evas_Object *r; + Eo *r; array_clear(&cs->input_rects); it = eina_tiler_iterator_new(state->input); @@ -1906,7 +1910,7 @@ comp_surface_impl_destroy(struct wl_resource *resource) if (cs->post_render_queue && (!cs->dead)) { Eina_List *l; - Evas_Object *o; + Eo *o; cs->dead = 1; evas_object_hide(cs->obj); @@ -2017,7 +2021,7 @@ comp_surface_send_pointer_enter(Comp_Surface *cs, Comp_Seat *s, int cx, int cy) } static void -comp_surface_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_mouse_in(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Mouse_In *ev = event_info; Comp_Seat *s; @@ -2071,7 +2075,7 @@ comp_surface_send_pointer_leave(Comp_Surface *cs, Comp_Seat *s) } static void -comp_surface_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_mouse_out(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Mouse_Out *ev = event_info; Comp_Seat *s; @@ -2154,7 +2158,7 @@ comp_surface_mouse_button(Comp_Surface *cs, Comp_Seat *s, uint32_t timestamp, ui } static void -comp_surface_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_mouse_down(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Mouse_Down *ev = event_info; Comp_Seat *s; @@ -2169,7 +2173,7 @@ comp_surface_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U } static void -comp_surface_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_mouse_up(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Mouse_Down *ev = event_info; Comp_Seat *s; @@ -2184,7 +2188,7 @@ comp_surface_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU } static void -comp_surface_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_mouse_move(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Mouse_Move *ev = event_info; Comp_Surface *cs = data; @@ -2229,7 +2233,7 @@ comp_surface_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U } static void -comp_surface_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) +comp_surface_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Eo *obj EINA_UNUSED, void *event) { Evas_Event_Mouse_Wheel *ev = event; Comp_Surface *cs = data; @@ -2262,7 +2266,7 @@ comp_surface_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EI } static void -comp_surface_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_multi_down(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Multi_Down *ev = event_info; Comp_Surface *cs = data; @@ -2296,7 +2300,7 @@ comp_surface_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U } static void -comp_surface_multi_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_multi_up(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Multi_Up *ev = event_info; Comp_Surface *cs = data; @@ -2335,7 +2339,7 @@ comp_surface_multi_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU } static void -comp_surface_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_surface_multi_move(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Evas_Event_Multi_Move *ev = event_info; Comp_Surface *cs = data; @@ -2376,7 +2380,7 @@ comp_surface_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U } static void -comp_surface_smart_add(Evas_Object *obj) +comp_surface_smart_add(Eo *obj) { Comp_Surface *cs; Evas *e; @@ -2405,7 +2409,7 @@ comp_surface_smart_add(Evas_Object *obj) } static void -comp_surface_smart_del(Evas_Object *obj) +comp_surface_smart_del(Eo *obj) { Comp_Surface *cs = evas_object_smart_data_get(obj); @@ -2435,10 +2439,10 @@ comp_surface_smart_del(Evas_Object *obj) } static void -comp_surface_smart_move(Evas_Object *obj, int x, int y) +comp_surface_smart_move(Eo *obj, int x, int y) { Eina_List *l; - Evas_Object *o; + Eo *o; int px, py, cx, cy; evas_object_geometry_get(obj, &px, &py, NULL, NULL); @@ -2457,7 +2461,7 @@ comp_surface_smart_move(Evas_Object *obj, int x, int y) } static void -comp_surface_smart_resize(Evas_Object *obj, int w, int h) +comp_surface_smart_resize(Eo *obj, int w, int h) { Comp_Surface *cs = evas_object_smart_data_get(obj); evas_object_resize(cs->clip, w, h); @@ -2467,7 +2471,7 @@ comp_surface_smart_resize(Evas_Object *obj, int w, int h) } static void -comp_surface_smart_show(Evas_Object *obj) +comp_surface_smart_show(Eo *obj) { Comp_Surface *cs = evas_object_smart_data_get(obj); evas_object_show(cs->clip); @@ -2475,7 +2479,7 @@ comp_surface_smart_show(Evas_Object *obj) } static void -comp_surface_smart_hide(Evas_Object *obj) +comp_surface_smart_hide(Eo *obj) { Comp_Surface *pcs = NULL, *lcs, *cs = evas_object_smart_data_get(obj); @@ -2516,28 +2520,28 @@ comp_surface_smart_hide(Evas_Object *obj) } static void -comp_surface_smart_clip_set(Evas_Object *obj, Evas_Object *clip) +comp_surface_smart_clip_set(Eo *obj, Eo *clip) { Comp_Surface *cs = evas_object_smart_data_get(obj); evas_object_clip_set(cs->clip, clip); } static void -comp_surface_smart_clip_unset(Evas_Object *obj) +comp_surface_smart_clip_unset(Eo *obj) { Comp_Surface *cs = evas_object_smart_data_get(obj); evas_object_clip_unset(cs->clip); } static void -comp_surface_smart_member_add(Evas_Object *obj, Evas_Object *child) +comp_surface_smart_member_add(Eo *obj, Eo *child) { Comp_Surface *cs = evas_object_smart_data_get(obj); if (child != cs->clip) evas_object_clip_set(child, cs->clip); } static void -comp_surface_smart_member_del(Evas_Object *obj, Evas_Object *child) +comp_surface_smart_member_del(Eo *obj, Eo *child) { Comp_Surface *cs = evas_object_smart_data_get(obj); if (child != cs->clip) evas_object_clip_unset(child); @@ -2580,7 +2584,7 @@ comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint struct wl_resource *res; Comp_Surface *cs; Comp *c = wl_resource_get_user_data(resource); - Evas_Object *obj; + Eo *obj; int x, y; res = wl_resource_create(client, &wl_surface_interface, wl_resource_get_version(resource), id); @@ -3164,16 +3168,16 @@ output_resize(Comp *c, struct wl_resource *res) int rot[][4] = { { - [EFL_WL_ROTATION_0] = WL_OUTPUT_TRANSFORM_NORMAL, - [EFL_WL_ROTATION_90] = WL_OUTPUT_TRANSFORM_90, - [EFL_WL_ROTATION_180] = WL_OUTPUT_TRANSFORM_180, - [EFL_WL_ROTATION_270] = WL_OUTPUT_TRANSFORM_270, + [EFL_WL_ROTATION_ROTATE_0] = WL_OUTPUT_TRANSFORM_NORMAL, + [EFL_WL_ROTATION_ROTATE_90] = WL_OUTPUT_TRANSFORM_90, + [EFL_WL_ROTATION_ROTATE_180] = WL_OUTPUT_TRANSFORM_180, + [EFL_WL_ROTATION_ROTATE_270] = WL_OUTPUT_TRANSFORM_270, }, { - [EFL_WL_ROTATION_0] = WL_OUTPUT_TRANSFORM_FLIPPED, - [EFL_WL_ROTATION_90] = WL_OUTPUT_TRANSFORM_FLIPPED_90, - [EFL_WL_ROTATION_180] = WL_OUTPUT_TRANSFORM_FLIPPED_180, - [EFL_WL_ROTATION_270] = WL_OUTPUT_TRANSFORM_FLIPPED_270, + [EFL_WL_ROTATION_ROTATE_0] = WL_OUTPUT_TRANSFORM_FLIPPED, + [EFL_WL_ROTATION_ROTATE_90] = WL_OUTPUT_TRANSFORM_FLIPPED_90, + [EFL_WL_ROTATION_ROTATE_180] = WL_OUTPUT_TRANSFORM_FLIPPED_180, + [EFL_WL_ROTATION_ROTATE_270] = WL_OUTPUT_TRANSFORM_FLIPPED_270, }, }; @@ -3240,7 +3244,7 @@ shell_surface_toplevel_set_parent(struct wl_client *client EINA_UNUSED, struct w comp_surface_reparent(cs, pcs); if (parent_resource) - evas_object_smart_callback_call(cs->c->obj, "child_added", cs->obj); + efl_event_callback_call(cs->c->obj, EFL_WL_EVENT_CHILD_ADDED, cs->obj); } static void @@ -3334,7 +3338,7 @@ shell_surface_toplevel_create(struct wl_client *client EINA_UNUSED, struct wl_re cs->role = wl_resource_create(client, &xdg_toplevel_interface, 1, id); wl_resource_set_implementation(cs->role, &shell_surface_toplevel_interface, cs, shell_surface_toplevel_impl_destroy); cs->shell.new = 1; - evas_object_smart_callback_call(cs->c->obj, "toplevel_added", cs->obj); + efl_event_callback_call(cs->c->obj, EFL_WL_EVENT_TOPLEVEL_ADDED, cs->obj); } static void @@ -3423,7 +3427,7 @@ shell_surface_popup_create(struct wl_client *client, struct wl_resource *resourc comp_surface_reparent(cs, wl_resource_get_user_data(parent_resource)); cs->shell.positioner = wl_resource_get_user_data(positioner_resource); _apply_positioner(cs, cs->shell.positioner); - evas_object_smart_callback_call(cs->c->obj, "popup_added", cs->obj); + efl_event_callback_call(cs->c->obj, EFL_WL_EVENT_POPUP_ADDED, cs->obj); } static void @@ -3894,7 +3898,7 @@ seat_kbd_create(struct wl_client *client, struct wl_resource *resource, uint32_t } static void -seat_ptr_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +seat_ptr_del(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Comp_Seat *s = data; @@ -4206,7 +4210,7 @@ comp_render_pre(Comp *c, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED) if (cs->opaque_rects && (eina_array_count(cs->opaque_rects) == 1)) { - Evas_Object *r = eina_array_data_get(cs->opaque_rects, 0); + Eo *r = eina_array_data_get(cs->opaque_rects, 0); int x, y, w, h, ox, oy, ow, oh; evas_object_geometry_get(cs->img, &x, &y, &w, &h); @@ -4228,7 +4232,7 @@ comp_render_pre(Comp *c, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED) } static void -comp_render_pre_proxied(Evas_Object *o, Evas *e, void *event_info) +comp_render_pre_proxied(Eo *o, Evas *e, void *event_info) { Comp_Surface *cs = evas_object_data_get(o, "comp_surface"); Comp_Buffer *buffer = cs->buffer[!cs->render_queue]; @@ -4302,8 +4306,6 @@ comp_render_post(Comp *c, Evas *e, void *event_info EINA_UNUSED) } } -static Evas_Smart *comp_smart = NULL; - static void comp_seat_selection_update(Comp_Seat *s) { @@ -4541,7 +4543,7 @@ comp_seats_proxy(Comp *c) else if (!c->parent_disp) comp_device_caps_update(s); s->global = wl_global_create(c->display, &wl_seat_interface, 4, s, seat_bind); - evas_object_smart_callback_call(s->c->obj, "seat_added", dev); + efl_event_callback_call(s->c->obj, EFL_WL_EVENT_SEAT_ADDED, dev); if (ecore_wl2_display_sync_is_done(c->client_disp)) seat_proxy_update(s); } @@ -5081,7 +5083,7 @@ comp_handlers_init(void) } static void -comp_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +comp_focus_in(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Comp *c = data; //Efl_Input_Focus_Data *ev = event_info; @@ -5128,7 +5130,7 @@ comp_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi } static void -comp_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +comp_focus_out(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Comp *c = data; //Efl_Input_Focus_Data *ev = event_info; @@ -5143,7 +5145,7 @@ comp_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo } static void -comp_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) +comp_mouse_in(void *data, Evas *e, Eo *obj, void *event_info) { Comp *c = data; Evas_Event_Mouse_In *ev = event_info; @@ -5181,7 +5183,7 @@ comp_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) } static void -comp_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_multi_move(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Comp *c = data; Evas_Event_Multi_Move *ev = event_info; @@ -5202,7 +5204,7 @@ comp_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v } static void -comp_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +comp_mouse_move(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info) { Comp *c = data; Evas_Event_Mouse_Move *ev = event_info; @@ -5223,7 +5225,7 @@ comp_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v } static void -comp_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info) +comp_mouse_out(void *data, Evas *e EINA_UNUSED, Eo *obj, void *event_info) { Comp *c = data; Evas_Event_Mouse_Out *ev = event_info; @@ -5337,18 +5339,22 @@ efl_hints_bind(struct wl_client *client, void *data, uint32_t version, uint32_t wl_resource_set_implementation(res, &hints_interface, data, NULL); } - - -static void -comp_smart_add(Evas_Object *obj) +EOLIAN static Eo * +_efl_wl_efl_object_constructor(Eo *obj, Comp *c) +{ + efl_canvas_group_clipped_set(obj, EINA_TRUE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!ecore_wl2_init(), NULL); + return efl_constructor(efl_super(obj, MY_CLASS)); +} + +EOLIAN static void +_efl_wl_efl_canvas_group_group_add(Eo *obj, Comp *c) { - Comp *c; char *env, *dbg = NULL; - c = calloc(1, sizeof(Comp)); + efl_canvas_group_add(efl_super(obj, MY_CLASS)); c->wayland_time_base = ecore_loop_time_get(); c->obj = obj; - evas_object_smart_data_set(obj, c); env = getenv("WAYLAND_DISPLAY"); if (env) env = strdup(env); @@ -5369,9 +5375,9 @@ comp_smart_add(Evas_Object *obj) else unsetenv("WAYLAND_DISPLAY"); c->display = ecore_wl2_display_get(c->disp); c->client_surfaces = eina_hash_pointer_new(NULL); - c->evas = evas_object_evas_get(obj); - c->clip = evas_object_rectangle_add(c->evas); - evas_object_smart_member_add(c->clip, obj); + c->evas = efl_provider_find(obj, EVAS_CANVAS_CLASS); + c->clip = (Eo*)efl_canvas_group_clipper_get(obj); + efl_gfx_entity_geometry_set(c->clip, efl_gfx_entity_geometry_get(obj)); c->events = evas_object_rectangle_add(c->evas); evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_IN, comp_mouse_in, c); evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, comp_mouse_move, c); @@ -5429,11 +5435,9 @@ comp_smart_add(Evas_Object *obj) free(env); } -static void -comp_smart_del(Evas_Object *obj) +EOLIAN static void +_efl_wl_efl_canvas_group_group_del(Eo *obj, Comp *c) { - Comp *c = evas_object_smart_data_get(obj); - evas_object_del(c->clip); evas_object_del(c->events); free(c->env); @@ -5461,10 +5465,8 @@ comp_smart_del(Evas_Object *obj) evas_event_callback_del_full(c->evas, EVAS_CALLBACK_RENDER_PRE, (Evas_Event_Cb)comp_render_pre, c); evas_event_callback_del_full(c->evas, EVAS_CALLBACK_RENDER_POST, (Evas_Event_Cb)comp_render_post, c); efl_event_callback_array_del(c->evas, comp_device_cbs(), c); - ecore_event_handler_del(c->exe_handler); eina_hash_free(c->exes); comps = eina_list_remove(comps, c); - free(c); if (!comps) { void *h; @@ -5475,35 +5477,25 @@ comp_smart_del(Evas_Object *obj) #endif } ecore_wl2_shutdown(); + efl_canvas_group_del(efl_super(obj, MY_CLASS)); } static void -comp_smart_move(Evas_Object *obj, int x, int y) +_efl_wl_efl_gfx_entity_position_set(Eo *obj, Comp *c, Eina_Position2D pos) { - Comp_Surface *cs; - Comp *c = evas_object_smart_data_get(obj); - int dx, dy; - evas_object_geometry_get(obj, &dx, &dy, NULL, NULL); - dx = x - dx; - dy = y - dy; - evas_object_move(c->clip, x, y); - evas_object_move(c->events, x, y); - EINA_INLIST_FOREACH(c->surfaces, cs) - { - int cx, cy; - evas_object_geometry_get(cs->obj, &cx, &cy, NULL, NULL); - evas_object_move(cs->obj, cx + dx, cy + dy); - } + efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_entity_position_set(c->clip, pos); } static void -comp_smart_resize(Evas_Object *obj, int w, int h) +_efl_wl_efl_gfx_entity_size_set(Eo *obj, Comp *c, Eina_Size2D sz) { - Comp *c = evas_object_smart_data_get(obj); Eina_List *l; Comp_Surface *cs; struct wl_resource *res; + int w = sz.w, h = sz.h; + efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz); evas_object_resize(c->clip, w, h); evas_object_resize(c->events, w, h); EINA_LIST_FOREACH(c->output_resources, l, res) @@ -5515,101 +5507,25 @@ comp_smart_resize(Evas_Object *obj, int w, int h) } static void -comp_smart_show(Evas_Object *obj) +_efl_wl_efl_gfx_entity_visible_set(Eo *obj, Comp *c, Eina_Bool vis) { - Comp *c = evas_object_smart_data_get(obj); Comp_Surface *cs; - evas_object_show(c->clip); + efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis); EINA_INLIST_FOREACH(c->surfaces, cs) - comp_surface_output_enter(cs); + if (vis) + comp_surface_output_enter(cs); + else + comp_surface_output_leave(cs); } static void -comp_smart_hide(Evas_Object *obj) -{ - Comp *c = evas_object_smart_data_get(obj); - Comp_Surface *cs; - - evas_object_hide(c->clip); - EINA_INLIST_FOREACH(c->surfaces, cs) - comp_surface_output_leave(cs); -} - -static void -comp_smart_color_set(Evas_Object *obj, int r, int g, int b, int a) -{ - Comp *c = evas_object_smart_data_get(obj); - evas_object_color_set(c->clip, r, g, b, a); -} - -static void -comp_smart_clip_set(Evas_Object *obj, Evas_Object *clip) -{ - Comp *c = evas_object_smart_data_get(obj); - evas_object_clip_set(c->clip, clip); -} - -static void -comp_smart_clip_unset(Evas_Object *obj) -{ - Comp *c = evas_object_smart_data_get(obj); - evas_object_clip_unset(c->clip); -} - -static void -comp_smart_member_add(Evas_Object *obj, Evas_Object *child) -{ - Comp *c = evas_object_smart_data_get(obj); - if (child != c->clip) evas_object_clip_set(child, c->clip); -} - -static void -comp_smart_member_del(Evas_Object *obj, Evas_Object *child) -{ - Comp *c = evas_object_smart_data_get(obj); - if (child != c->clip) evas_object_clip_unset(child); -} - -static void -comp_smart_init(void) -{ - if (comp_smart) return; - { - static const Evas_Smart_Class sc = - { - "comp", - EVAS_SMART_CLASS_VERSION, - comp_smart_add, - comp_smart_del, - comp_smart_move, - comp_smart_resize, - comp_smart_show, - comp_smart_hide, - comp_smart_color_set, - comp_smart_clip_set, - comp_smart_clip_unset, - NULL, - comp_smart_member_add, - comp_smart_member_del, - - NULL, - NULL, - NULL, - NULL - }; - comp_smart = evas_smart_class_new(&sc); - } -} - -static Eina_Bool -exe_event_del(void *data, int t EINA_UNUSED, Ecore_Exe_Event_Del *ev) +exe_event_del(void *data, const Efl_Event *ev) { Comp *c = data; - int32_t pid = ev->pid; + int32_t pid = efl_exe_pid_get(ev->object); eina_hash_del_by_key(c->exes, &pid); - return ECORE_CALLBACK_RENEW; } # ifdef __GNUC__ @@ -5621,7 +5537,7 @@ Eina_Bool comp_dmabuf_test(struct linux_dmabuf_buffer *dmabuf) { Evas_Native_Surface ns; - Evas_Object *test; + Eo *test; int size; void *data; Comp *c = dmabuf->compositor; @@ -5669,28 +5585,14 @@ comp_dmabuf_modifiers_query(void *compositor EINA_UNUSED, int format EINA_UNUSED *num_modifiers = 0; } -Evas_Object * -efl_wl_add(Evas *e) -{ - comp_smart_init(); - EINA_SAFETY_ON_TRUE_RETURN_VAL(!ecore_wl2_init(), NULL); - return evas_object_smart_add(e, comp_smart); -} - -Ecore_Exe * -comp_run(Evas_Object *obj, const char *cmd, Ecore_Exe_Flags flags) +Eo * +comp_run(Eo *obj, Comp *c, const char *cmd, Efl_Exe_Flags flags) { char *env, *disp, *gl = NULL; - Comp *c; - Ecore_Exe *exe; + Efl_Exe *exe; - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); if (!c->exes) c->exes = eina_hash_int32_new(NULL); - if (!c->exe_handler) - c->exe_handler = - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, (Ecore_Event_Handler_Cb)exe_event_del, c); disp = getenv("DISPLAY"); if (disp) disp = strdup(disp); unsetenv("DISPLAY"); @@ -5703,7 +5605,10 @@ comp_run(Evas_Object *obj, const char *cmd, Ecore_Exe_Flags flags) if (gl) gl = strdup(gl); setenv("ELM_ACCEL", "gl", 1); } - exe = ecore_exe_pipe_run(cmd, flags, c); + exe = efl_add(EFL_EXE_CLASS, obj, + efl_core_command_line_command_string_set(efl_added, cmd), + efl_exe_flags_set(efl_added, flags), + efl_task_run(efl_added)); if (disp) setenv("DISPLAY", disp, 1); if (env) setenv("WAYLAND_DISPLAY", env, 1); else unsetenv("WAYLAND_DISPLAY"); @@ -5717,55 +5622,45 @@ comp_run(Evas_Object *obj, const char *cmd, Ecore_Exe_Flags flags) free(disp); if (exe) { - int32_t pid = ecore_exe_pid_get(exe); + int32_t pid = efl_exe_pid_get(exe); eina_hash_add(c->exes, &pid, (void*)1); + efl_event_callback_add(exe, EFL_TASK_EVENT_EXIT, exe_event_del, c); } return exe; } -Ecore_Exe * -efl_wl_run(Evas_Object *obj, const char *cmd) +EOLIAN static Efl_Exe * +_efl_wl_run(Eo *obj, Comp *c, const char *cmd) { - return comp_run(obj, cmd, ECORE_EXE_TERM_WITH_PARENT); + return comp_run(obj, c, cmd, EFL_EXE_FLAGS_TERM_WITH_PARENT); } -Ecore_Exe * -efl_wl_flags_run(Evas_Object *obj, const char *cmd, Ecore_Exe_Flags flags) +EOLIAN static Eo * +_efl_wl_flags_run(Eo *obj, Comp *c, const char *cmd, Efl_Exe_Flags flags) { - return comp_run(obj, cmd, flags); + return comp_run(obj, c, cmd, flags); } -void -efl_wl_pid_add(Evas_Object *obj, int32_t pid) +EOLIAN static void +_efl_wl_allowed_pid_add(Eo *obj, Comp *c, int32_t pid) { - Comp *c; - - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); if (!c->exes) c->exes = eina_hash_int32_new(NULL); eina_hash_add(c->exes, &pid, (void*)1); } -void -efl_wl_pid_del(Evas_Object *obj, int32_t pid) +EOLIAN static void +_efl_wl_allowed_pid_del(Eo *obj, Comp *c, int32_t pid) { - Comp *c; - - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); if (!c->exes) return; eina_hash_del_by_key(c->exes, &pid); } -Eina_Bool -efl_wl_next(Evas_Object *obj) +EOLIAN static Eina_Bool +_efl_wl_surface_next(Eo *obj, Comp *c) { - Comp *c; Comp_Surface *cs; - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); if (c->surfaces_count < 2) return EINA_FALSE; EINA_INLIST_REVERSE_FOREACH(c->surfaces, cs) { @@ -5779,14 +5674,11 @@ efl_wl_next(Evas_Object *obj) return EINA_FALSE; } -Eina_Bool -efl_wl_prev(Evas_Object *obj) +EOLIAN static Eina_Bool +_efl_wl_surface_prev(Eo *obj, Comp *c) { - Comp *c; Comp_Surface *cs; - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); if (c->surfaces_count < 2) return EINA_FALSE; EINA_INLIST_FOREACH(c->surfaces, cs) { @@ -5800,30 +5692,37 @@ efl_wl_prev(Evas_Object *obj) return EINA_FALSE; } -void -efl_wl_rotate(Evas_Object *obj, Efl_Wl_Rotation rot, Eina_Bool rtl) +EOLIAN static void +_efl_wl_rotation_get(const Eo *obj EINA_UNUSED, Comp *c, Efl_Wl_Rotation *rotation, Eina_Bool *rtl) +{ + if (rotation) *rotation = c->rotation; + if (rtl) *rtl = c->rtl; +} + +EOLIAN static void +_efl_wl_rotation_set(Eo *obj EINA_UNUSED, Comp *c, Efl_Wl_Rotation rot, Eina_Bool rtl) { - Comp *c; Eina_List *l; struct wl_resource *res; - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); c->rtl = !!rtl; c->rotation = rot; EINA_LIST_FOREACH(c->output_resources, l, res) output_resize(c, res); } -void -efl_wl_scale_set(Evas_Object *obj, double scale) +EOLIAN static double +_efl_wl_efl_gfx_entity_scale_get(const Eo *obj EINA_UNUSED, Comp *c) +{ + return c->scale; +} + +EOLIAN static void +_efl_wl_efl_gfx_entity_scale_set(Eo *obj EINA_UNUSED, Comp *c, double scale) { - Comp *c; Eina_List *l; struct wl_resource *res; - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); c->scale = scale; EINA_LIST_FOREACH(c->output_resources, l, res) @@ -5831,13 +5730,15 @@ efl_wl_scale_set(Evas_Object *obj, double scale) wl_output_send_scale(res, lround(c->scale)); } -void -efl_wl_aspect_set(Evas_Object *obj, Eina_Bool set) +EOLIAN static Eina_Bool +_efl_wl_aspect_get(const Eo *obj EINA_UNUSED, Comp *c) { - Comp *c; + return c->aspect; +} - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); +EOLIAN static void +_efl_wl_aspect_set(Eo *obj, Comp *c, Eina_Bool set) +{ if (c->aspect == (!!set)) return; c->aspect = !!set; if (c->aspect) @@ -5846,13 +5747,15 @@ efl_wl_aspect_set(Evas_Object *obj, Eina_Bool set) evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_NONE, 0, 0); } -void -efl_wl_minmax_set(Evas_Object *obj, Eina_Bool set) +EOLIAN static Eina_Bool +_efl_wl_minmax_get(const Eo *obj EINA_UNUSED, Comp *c) { - Comp *c; + return c->minmax; +} - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); +EOLIAN static void +_efl_wl_minmax_set(Eo *obj, Comp *c, Eina_Bool set) +{ if (c->minmax == (!!set)) return; c->minmax = !!set; if (c->minmax) @@ -5864,19 +5767,15 @@ efl_wl_minmax_set(Evas_Object *obj, Eina_Bool set) } } -void * -efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t version, void *data, void *bind_cb) +EOLIAN static Efl_Wl_Global * +_efl_wl_global_add(Eo *obj, Comp *c, const Efl_Wl_Interface *interface, uint32_t version, Efl_Wl_Interface_Data *data, Efl_Wl_Interface_Bind_Cb *bind_cb) { - Comp *c; - - if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); EINA_SAFETY_ON_NULL_RETURN_VAL(interface, NULL); - c = evas_object_smart_data_get(obj); - return wl_global_create(c->display, interface, version, data, bind_cb); + return (void*)wl_global_create(c->display, (void*)interface, version, (void*)data, (void*)bind_cb); } static void -extracted_focus(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +extracted_focus(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Comp_Surface *cs = data; @@ -5890,10 +5789,10 @@ extracted_focus(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v } static void -extracted_unfocus(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +extracted_unfocus(void *data, Evas *e EINA_UNUSED, Eo *obj, void *event_info EINA_UNUSED) { Comp_Surface *cs = data; - Evas_Object *focus; + Eo *focus; if (cs->dead) return; focus = evas_focus_get(cs->c->evas); @@ -5903,7 +5802,7 @@ extracted_unfocus(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event } static void -extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +extracted_changed(void *data, Evas *e EINA_UNUSED, Eo *obj, void *event_info EINA_UNUSED) { Comp_Surface *cs = data; @@ -5912,7 +5811,7 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event } int32_t -efl_wl_surface_pid_get(Evas_Object *surface) +efl_wl_surface_pid_get(Eo *surface) { Comp_Surface *cs; int32_t pid; @@ -5924,7 +5823,7 @@ efl_wl_surface_pid_get(Evas_Object *surface) } Eina_Bool -efl_wl_surface_extract(Evas_Object *surface) +efl_wl_surface_extract(Eo *surface) { Comp_Surface *cs; if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort(); @@ -5940,7 +5839,7 @@ efl_wl_surface_extract(Evas_Object *surface) return EINA_TRUE; } -Evas_Object * +Eo * efl_wl_extracted_surface_object_find(void *surface_resource) { Comp_Surface *cs = wl_resource_get_user_data(surface_resource); @@ -5952,8 +5851,8 @@ efl_wl_extracted_surface_object_find(void *surface_resource) return cs->obj; } -Evas_Object * -efl_wl_extracted_surface_extracted_parent_get(Evas_Object *surface) +Eo * +efl_wl_extracted_surface_extracted_parent_get(Eo *surface) { Comp_Surface *cs; @@ -5973,13 +5872,13 @@ efl_wl_extracted_surface_extracted_parent_get(Evas_Object *surface) } void -efl_wl_seat_keymap_set(Evas_Object *obj, Eo *seat, void *state, char *str, void *key_array) +efl_wl_seat_keymap_set(Eo *obj, Eo *seat, void *state, char *str, void *key_array) { Comp *c; Comp_Seat *s; if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); + c = efl_data_scope_get(obj, MY_CLASS); EINA_INLIST_FOREACH(c->seats, s) { if (!seat) efl_wl_seat_keymap_set(obj, s->dev, state, str, key_array); @@ -6003,13 +5902,13 @@ efl_wl_seat_keymap_set(Evas_Object *obj, Eo *seat, void *state, char *str, void } void -efl_wl_seat_key_repeat_set(Evas_Object *obj, Eo *seat, int repeat_rate, int repeat_delay) +efl_wl_seat_key_repeat_set(Eo *obj, Eo *seat, int repeat_rate, int repeat_delay) { Comp *c; Comp_Seat *s; if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); - c = evas_object_smart_data_get(obj); + c = efl_data_scope_get(obj, MY_CLASS); EINA_INLIST_FOREACH(c->seats, s) { if (!seat) efl_wl_seat_key_repeat_set(obj, s->dev, repeat_rate, repeat_delay); @@ -6021,3 +5920,8 @@ efl_wl_seat_key_repeat_set(Evas_Object *obj, Eo *seat, int repeat_rate, int repe s->kbd.repeat_delay = repeat_delay; seat_kbd_repeat_rate_send(s); } + +#define EFL_WL_EXTRA_OPS \ + EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_wl), \ + +#include "efl_wl.eo.c" diff --git a/src/lib/efl_wl/efl_wl.eo b/src/lib/efl_wl/efl_wl.eo new file mode 100644 index 0000000000..1f28738c49 --- /dev/null +++ b/src/lib/efl_wl/efl_wl.eo @@ -0,0 +1,99 @@ +import efl_exe; +import efl_input_device; +import efl_wl_surface; + +struct @beta @extern Efl.Wl_Wl_Surface; [[ struct wl_surface. @since 1.24 ]] +struct @beta @extern Efl.Wl_Wl_Global; [[ struct wl_global. @since 1.24 ]] +struct @beta @extern Efl.Wl_Wl_Interface; [[ A libwayland callback interface struct. @since 1.24 ]] +struct @beta @extern Efl.Wl_Wl_Interface_Data; [[ A data pointer to send with the bind callback. @since 1.24 ]] +struct @beta @extern Efl.Wl_Wl_Interface_Bind_Cb; [[ A callback with the type (*void)(struct wl_client *client, void *data, uint32_t version, uint32_t id). @since 1.24 ]] + + +enum @beta Efl.Wl.Rotation +{ + [[Orientation of the internal compositor object in degrees. These values are COUNTER-CLOCKWISE. + ]] + rotate_0 = 0, + rotate_90 = 1, + rotate_180 = 2, + rotate_270 = 3 +} + +class @beta Efl.Wl extends Efl.Canvas.Group +{ + [[ + @since 1.24 + ]] + data: Comp; + methods { + run { + [[This runs a command in the compositor using the @Efl.Exe_Flags.term_with_parent flag. + ]] + params { + cmd: string; + } + return: Efl.Exe; + } + flags_run { + params { + cmd: string; + flags: Efl.Exe_Flags; + } + return: Efl.Exe; + } + allowed_pid_add { + params { + pid: int; + } + } + allowed_pid_del { + params { + pid: int; + } + } + surface_next { + return: bool; + } + surface_prev { + return: bool; + } + @property aspect { + values { + set: bool; + } + } + @property minmax { + values { + set: bool; + } + } + @property rotation { + values { + rotation: Efl.Wl.Rotation; + rtl: bool; + } + } + global_add { + params { + interface: const(Efl.Wl_Wl_Interface) @by_ref; + version: uint; + data: Efl.Wl_Wl_Interface_Data @by_ref; + bind_cb: Efl.Wl_Wl_Interface_Bind_Cb @by_ref; + } + return: Efl.Wl_Wl_Global @by_ref; + } + } + implements { + Efl.Object.constructor; + Efl.Gfx.Entity.visible { set; } + Efl.Gfx.Entity.size { set; } + Efl.Gfx.Entity.position { set; } + Efl.Gfx.Entity.scale { get; set; } + } + events { + toplevel,added: Efl.Gfx.Entity; [[]] + child,added: Efl.Gfx.Entity; [[]] + popup,added: Efl.Gfx.Entity; [[]] + seat,added: Efl.Input.Device; [[The seat object added.]] + } +} diff --git a/src/lib/efl_wl/meson.build b/src/lib/efl_wl/meson.build index 35f20ec404..3976b97ab0 100644 --- a/src/lib/efl_wl/meson.build +++ b/src/lib/efl_wl/meson.build @@ -1,32 +1,59 @@ -efl_wl_deps = [ecore_wl2, ecore_input, ecore, ecore_evas, evas, emile, eo, efl, eina] -efl_wl_pub_deps = [evas, dependency('wayland-server', version : '>= 1.11.0'), dependency('xkbcommon', version : '>= 0.6.0')] +efl_wl_deps = [ecore_wl2, ecore_input, ecore, ecore_evas, evas, emile, eina] +efl_wl_pub_deps = [eo, efl, evas, dependency('wayland-server', version : '>= 1.11.0'), dependency('xkbcommon', version : '>= 0.6.0')] if (get_option('x11')) efl_wl_deps += [ecore_x] efl_wl_pub_deps += [dependency('xkbcommon-x11')] endif +pub_eo_files = [ + 'efl_wl.eo', +] + +foreach eo_file : pub_eo_files + pub_eo_file_target += custom_target('eolian_gen_' + eo_file, + input : eo_file, + output : [eo_file + '.h'], + depfile : eo_file + '.d', + install : true, + install_dir : dir_package_include, + command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, + '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), + '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), + '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), + '-gchd', '@INPUT@']) +endforeach + efl_wl_src = [ 'dmabuf.c', - 'efl_wl.c' + 'efl_wl.c', ] efl_wl_header_src = ['Efl_Wl.h'] - +eolian_include_directories += ['-I', meson.current_source_dir()] efl_wl_lib = library('efl_wl', - efl_wl_src, + efl_wl_src, pub_eo_file_target, dependencies: [m, dl] + efl_wl_deps + efl_wl_pub_deps, include_directories : config_dir + [include_directories(join_paths('..','..'))], install: true, + c_args : package_c_args, version : meson.project_version() ) efl_wl = declare_dependency( include_directories: [include_directories('.')], link_with: efl_wl_lib, + sources: pub_eo_file_target, dependencies: efl_wl_pub_deps, ) install_headers(efl_wl_header_src, install_dir : dir_package_include, ) + +eolian_efl_wl_dir = join_paths(eolian_include_dir, package_version_name) +if get_option('install-eo-files') + install_data(pub_eo_files, + install_dir: eolian_efl_wl_dir + ) +endif