From: jinbong.lee Date: Fri, 2 Aug 2024 05:35:37 +0000 (+0900) Subject: Adapt e_view to e_client and some codes related with it. X-Git-Tag: accepted/tizen/unified/20240808.160418~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb4fdc6233ee996f49abc4d0ff87d3cdbae33352;p=platform%2Fupstream%2Fenlightenment.git Adapt e_view to e_client and some codes related with it. - change accessing e_comp_object from ec->frame to e_view_client for wrapping - add some new interface of e_view_client Change-Id: I96783f1e12ec6f786066566331d2f575e518a209 --- diff --git a/src/bin/compmgr/e_alpha_mask_rect.c b/src/bin/compmgr/e_alpha_mask_rect.c index 6f9fdfc..9b9f866 100644 --- a/src/bin/compmgr/e_alpha_mask_rect.c +++ b/src/bin/compmgr/e_alpha_mask_rect.c @@ -6,9 +6,10 @@ #include "e_comp_wl_subsurface_intern.h" #include "e_comp_object_intern.h" #include "e_map_intern.h" +#include "e_comp_canvas.h" +#include "e_view_rect.h" #include "e_view_intern.h" #include "e_view_client_intern.h" -#include "e_view_rect.h" struct _E_Alpha_Mask_Rect { @@ -21,7 +22,7 @@ struct _E_Alpha_Mask_Rect struct wl_listener transform_change; struct wl_listener show; struct wl_listener hide; - struct wl_listener reposition; + struct wl_listener move; struct wl_listener resize; }; @@ -37,11 +38,14 @@ _e_alpha_mask_rect_cb_client_destroy(struct wl_listener *listener, void *data) static void _e_alpha_mask_rect_map_apply(E_Alpha_Mask_Rect *rect) { + E_View *view; E_Map *map = NULL, *new_map = NULL; Eina_Bool enable; int w, h; - e_map_util_points_populate_from_object_full(rect->map, rect->ec->frame, 0); + view = e_view_rect_view_get(rect->view); + + e_map_util_points_populate_from_view_full(rect->map, view, 0); e_view_rect_size_get(rect->view, &w, &h); e_map_point_image_uv_set(rect->map, 0, 0, 0); @@ -51,7 +55,7 @@ _e_alpha_mask_rect_map_apply(E_Alpha_Mask_Rect *rect) enable = e_client_transform_core_enable_get(rect->ec); if (enable) - map = e_comp_object_map_get(rect->ec->frame); + map = (E_Map *)e_view_map_get(view); if ((enable) && (map)) { @@ -68,14 +72,14 @@ _e_alpha_mask_rect_map_apply(E_Alpha_Mask_Rect *rect) e_map_point_image_uv_set(new_map, 2, w, h); e_map_point_image_uv_set(new_map, 3, 0, h); - e_view_map_set(e_view_rect_view_get(rect->view), new_map); - e_view_map_enable_set(e_view_rect_view_get(rect->view), true); + e_view_map_set(view, new_map); + e_view_map_enable_set(view, true); e_map_free(new_map); } else { - e_view_map_set(e_view_rect_view_get(rect->view), rect->map); - e_view_map_enable_set(e_view_rect_view_get(rect->view), true); + e_view_map_set(view, rect->map); + e_view_map_enable_set(view, true); } if (map) e_map_free(map); @@ -98,9 +102,9 @@ _e_alpha_mask_rect_cb_view_client_hide(struct wl_listener *listener, void *data) } static void -_e_alpha_mask_rect_cb_view_client_reposition(struct wl_listener *listener, void *data) +_e_alpha_mask_rect_cb_view_client_move(struct wl_listener *listener, void *data) { - E_Alpha_Mask_Rect *rect = wl_container_of(listener, rect, reposition); + E_Alpha_Mask_Rect *rect = wl_container_of(listener, rect, move); e_view_position_set(e_view_rect_view_get(rect->view), rect->ec->x, rect->ec->y); _e_alpha_mask_rect_map_apply(rect); @@ -157,14 +161,21 @@ _e_alpha_mask_rect_try_from_ec(E_Client *ec) static void _e_alpha_mask_rect_destroy(E_Alpha_Mask_Rect *rect) { + E_View_Client *view_client = e_client_view_get(rect->ec); ELOGF("ALPHA_MASK", "Destroy E_Alpha_Mask_Rect(%p)", rect->ec, rect); e_comp_wl_hook_del(rect->subsurface_create_hook); evas_object_smart_callback_del(rect->ec->frame, "client_resize", _e_alpha_mask_rect_cb_client_resize); - wl_list_remove(&rect->show.link); - wl_list_remove(&rect->hide.link); - wl_list_remove(&rect->reposition.link); - wl_list_remove(&rect->resize.link); + + if (view_client) + { + E_View *view = e_view_client_view_get(view_client); + e_view_event_listener_del(view, E_VIEW_SHOW, &rect->show); + e_view_event_listener_del(view, E_VIEW_HIDE, &rect->hide); + e_view_event_listener_del(view, E_VIEW_MOVE, &rect->move); + e_view_event_listener_del(view, E_VIEW_RESIZE, &rect->resize); + } + wl_list_remove(&rect->transform_change.link); wl_list_remove(&rect->destroy.link); e_view_destroy(e_view_rect_view_get(rect->view)); @@ -175,10 +186,11 @@ _e_alpha_mask_rect_destroy(E_Alpha_Mask_Rect *rect) EINTERN E_Alpha_Mask_Rect * e_alpha_mask_rect_create(E_Client *ec) { + int layer_index; E_Alpha_Mask_Rect *rect; E_View_Client *view_client; - E_View_Tree *parent; - E_View *view; + E_View_Tree *layer_tree; + E_View *client_view, *rect_view; const int color[4] = {0, 0, 0, 0}; rect = E_NEW(E_Alpha_Mask_Rect, 1); @@ -186,31 +198,36 @@ e_alpha_mask_rect_create(E_Client *ec) return NULL; view_client = e_client_view_get(ec); - parent = e_view_parent_get(e_view_client_view_get(view_client)); - rect->view = e_view_rect_create(parent, 1, 1, color); + if (!view_client) return NULL; + + client_view = e_view_client_view_get(view_client); + + layer_index = e_view_layer_index_get(client_view); + layer_tree = e_canvas_layer_view_tree_get(e_comp_canvas_get(), layer_index); + + rect->view = e_view_rect_create(layer_tree, 1, 1, color); if (!rect->view) { free(rect); return NULL; } + rect_view = e_view_rect_view_get(rect->view); rect->map = e_map_new(); if (!rect->map) { ERR("Failed to new e_map ec:%p", ec); - e_view_destroy(e_view_rect_view_get(rect->view)); + e_view_destroy(rect_view); free(rect); return NULL; } - view = e_view_rect_view_get(rect->view); - /* This object doesn't care about mouse event. And It's also * to avoid events of mouse on the E_Client. */ - e_view_pass_events_set(view, true); - e_view_render_op_set(view, E_VIEW_RENDER_COPY); - e_view_position_set(view, ec->x, ec->y); - e_view_name_set(view, "below_bg_rectangle"); + e_view_pass_events_set(rect_view, true); + e_view_render_op_set(rect_view, E_VIEW_RENDER_COPY); + e_view_position_set(rect_view, ec->x, ec->y); + e_view_name_set(rect_view, "below_bg_rectangle"); rect->ec = ec; @@ -222,17 +239,17 @@ e_alpha_mask_rect_create(E_Client *ec) _e_alpha_mask_rect_map_apply(rect); - if (e_view_visible_get(e_view_client_view_get(e_client_view_get(ec)))) - e_view_show(e_view_rect_view_get(rect->view)); + if (e_view_visible_get(client_view)) + e_view_show(rect_view); rect->show.notify = _e_alpha_mask_rect_cb_view_client_show; - e_view_show_listener_add(e_view_client_view_get(view_client), &rect->show); + e_view_event_listener_add(client_view, E_VIEW_SHOW, &rect->show); rect->hide.notify = _e_alpha_mask_rect_cb_view_client_hide; - e_view_hide_listener_add(e_view_client_view_get(view_client), &rect->hide); - rect->reposition.notify = _e_alpha_mask_rect_cb_view_client_reposition; - e_view_reposition_listener_add(e_view_client_view_get(view_client), &rect->reposition); + e_view_event_listener_add(client_view, E_VIEW_HIDE, &rect->hide); + rect->move.notify = _e_alpha_mask_rect_cb_view_client_move; + e_view_event_listener_add(client_view, E_VIEW_MOVE, &rect->move); rect->resize.notify = _e_alpha_mask_rect_cb_view_client_resize; - e_view_client_resize_listener_add(view_client, &rect->resize); + e_view_event_listener_add(client_view, E_VIEW_RESIZE, &rect->resize); // TODO : view evas_object_smart_callback_add(ec->frame, "client_resize", _e_alpha_mask_rect_cb_client_resize, rect); @@ -246,7 +263,7 @@ e_alpha_mask_rect_create(E_Client *ec) * set before, changing alpha value can't be applied to egl image. */ // TODO : view - e_comp_object_native_surface_set(ec->frame, EINA_FALSE); + e_view_client_native_surface_set(view_client, false); e_pixmap_image_refresh(ec->pixmap); e_view_client_damage(view_client, 0, 0, ec->w, ec->h); e_view_client_dirty(view_client); diff --git a/src/bin/compmgr/e_comp_object.c b/src/bin/compmgr/e_comp_object.c index 1d318e3..7c4522c 100644 --- a/src/bin/compmgr/e_comp_object.c +++ b/src/bin/compmgr/e_comp_object.c @@ -1411,7 +1411,7 @@ _e_comp_intercept_move(void *data, Evas_Object *obj, int x, int y) } if ((cw->ec->resize_mode == E_POINTER_RESIZE_NONE) && - (cw->ec->manage_resize.resize_obj)) + (cw->ec->manage_resize.resize_view)) { e_client_pos_set(cw->ec, x, y); cw->ec->client.x = x + cw->client_inset.l; diff --git a/src/bin/core/e_client.c b/src/bin/core/e_client.c index 05caae2..3e0397f 100644 --- a/src/bin/core/e_client.c +++ b/src/bin/core/e_client.c @@ -20,6 +20,8 @@ #include "e_zone_intern.h" #include "e_config_intern.h" #include "e_input_thread_client_intern.h" +#include "e_view_image.h" +#include "e_view_rect.h" #include "e_view_intern.h" #include "e_view_client_intern.h" @@ -128,6 +130,12 @@ struct _E_Client_Private unsigned int w, h; Eina_Bool apply; } layout_info; + + struct wl_listener view_client_show_listener; + struct wl_listener view_client_hide_listener; + struct wl_listener view_client_move_listener; + struct wl_listener view_client_resize_listener; + struct wl_listener view_client_restack_listener; }; static int _e_client_hooks_delete = 0; @@ -177,12 +185,12 @@ static Ecore_Event_Handler *action_handler_mouse = NULL; static Ecore_Timer *action_timer = NULL; static Eina_Rectangle action_orig = {0, 0, 0, 0}; -static E_Client_Resize_Object_Create_Cb _e_client_resize_object_create_cb = NULL; +static E_Client_Resize_View_Create_Cb _e_client_resize_view_create_cb = NULL; EINTERN void e_client_focused_set(E_Client *ec); static void _e_client_transient_for_group_make(E_Client *ec, Eina_List **list); -static Evas_Object *_e_client_resize_object_create(E_Client *ec); -static void _e_client_resize_object_del(E_Client *ec); +static E_View *_e_client_resize_view_create(E_Client *ec, int x, int y, int w, int h); +static void _e_client_resize_view_del(E_Client *ec); static Eina_Inlist *_e_client_hooks[] = { @@ -525,6 +533,7 @@ _e_client_transform_geometry_save(E_Client *ec, E_Map *map) static void _e_client_transform_resize(E_Client *ec) { + E_View_Client *view_client; E_Map *map; int cx, cy; double dx = 0, dy = 0; @@ -590,7 +599,12 @@ _e_client_transform_resize(E_Client *ec) /* step 3: set each points of the quadrangle */ map = e_map_new_with_direct_render(ec->transform_core.direct_render); - e_map_util_points_populate_from_object_full(map, ec->frame, 0); + view_client = e_client_view_get(ec); + if (view_client) + { + E_View *view = e_view_client_view_get(view_client); + e_map_util_points_populate_from_view_full(map, view, 0); + } for (i = 0; i < 4; i++) e_map_point_precise_coord_set(map, i, px[i] + dx, py[i] + dy, 0); @@ -603,7 +617,6 @@ _e_client_transform_resize(E_Client *ec) static void _e_client_transform_resize_handle(E_Client *ec) { - int new_x, new_y, new_w, new_h; int org_w, org_h; int button_id; @@ -699,8 +712,7 @@ _e_client_transform_resize_handle(E_Client *ec) new_y += (new_h - org_h); /* step 5: set geometry to new value */ - e_view_position_set(e_view_client_view_get(PRI(ec)->view_client), new_x, new_y); - e_view_client_size_set(PRI(ec)->view_client, new_w, new_h); + e_view_client_geometry_set(e_client_view_get(ec), new_x, new_y, new_w, new_h); } void @@ -974,6 +986,17 @@ e_client_check_above_focused(E_Client *ec) return EINA_FALSE; } +static E_View_Client * +_e_client_view_init(E_Client *ec) +{ + E_View_Tree *tree = e_canvas_layer_view_tree_get(e_comp->canvas, + E_CANVAS_LAYER_CLIENT_NORMAL); + if (tree) + return e_view_client_create(ec, tree); + + return NULL; +} + static Eina_Bool _e_client_private_init(E_Client *ec) { @@ -1072,13 +1095,19 @@ _e_input_thread_client_free(void *data) static void _e_client_free(E_Client *ec) { + E_View *view; + E_View_Client *view_client; g_rec_mutex_lock(&e_comp->ec_list_mutex); + view_client = e_client_view_get(ec); E_Input_Thread_Request_EClient_Data ec_data; memset(&ec_data, 0, sizeof(E_Input_Thread_Request_EClient_Data)); - e_comp_object_redirected_set(ec->frame, 0); - e_comp_object_render_update_del(ec->frame); + if (view_client) + { + e_view_client_redirected_set(view_client, 0); + e_view_client_render_update_del(view_client); + } E_OBJECT(ec)->references++; @@ -1102,8 +1131,18 @@ _e_client_free(E_Client *ec) eina_stringshare_replace(&ec->icccm.window_role, NULL); e_client_netwm_name_set(ec, NULL); - e_view_destroy(e_view_client_view_get(PRI(ec)->view_client)); - E_FREE_FUNC(ec->frame, evas_object_del); + if (view_client) + { + E_Client_Private *priv = PRI(ec); + view = e_view_client_view_get(view_client); + e_view_event_listener_del(view, E_VIEW_SHOW, &priv->view_client_show_listener); + e_view_event_listener_del(view, E_VIEW_HIDE, &priv->view_client_hide_listener); + e_view_event_listener_del(view, E_VIEW_RESIZE, &priv->view_client_resize_listener); + e_view_event_listener_del(view, E_VIEW_MOVE, &priv->view_client_move_listener); + e_view_event_listener_del(view, E_VIEW_RESTACK, &priv->view_client_restack_listener); + + e_view_destroy(view); + } E_OBJECT(ec)->references--; ELOGF("COMP", "CLIENT FREE", ec); @@ -1138,6 +1177,7 @@ _e_client_del(E_Client *ec) { E_Client *child; E_Pixmap_Type type; + E_View_Client *view_client; E_Input_Thread_Request_EClient_Data ec_data; memset(&ec_data, 0, sizeof(E_Input_Thread_Request_EClient_Data)); @@ -1158,10 +1198,12 @@ _e_client_del(E_Client *ec) } if (action_client == ec) _e_client_action_finish(); + view_client = e_client_view_get(ec); if (!stopping) { e_client_comp_hidden_set(ec, 1); - e_view_pass_events_set(e_view_client_view_get(PRI(ec)->view_client), true); + if (view_client) + e_view_pass_events_set(e_view_client_view_get(view_client), true); } E_FREE_FUNC(ec->ping_poller, ecore_poller_del); @@ -1189,7 +1231,7 @@ _e_client_del(E_Client *ec) if (type < E_PIXMAP_TYPE_MAX) eina_hash_del_by_key(clients_hash[type], &ec->pixmap); e_comp->clients = eina_list_remove(e_comp->clients, ec); - e_comp_object_render_update_del(ec->frame); + if (view_client) e_view_client_render_update_del(view_client); e_comp_post_update_purge(ec); if (e_pixmap_free(ec->pixmap)) e_pixmap_client_set(ec->pixmap, NULL); @@ -1212,7 +1254,7 @@ _e_client_del(E_Client *ec) ec->transform_core.result.enable = EINA_FALSE; - _e_client_resize_object_del(ec); + _e_client_resize_view_del(ec); e_comp_visibility_calculation_set(EINA_TRUE); @@ -1419,33 +1461,39 @@ _e_client_moveinfo_gather(E_Client *ec, const char *source) } } -static Evas_Object * -_e_client_resize_object_rectangle_get(E_Client *ec) +static E_View * +_e_client_resize_view_rect_get(E_Client *ec, int layer_index, int x, int y, int w, int h) { - Evas_Object *resize_obj = NULL; - - resize_obj = evas_object_rectangle_add(evas_object_evas_get(ec->frame)); - EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL); + E_View_Rect *view_rect; + E_View_Tree *layer_tree; + E_Canvas *canvas = e_comp_canvas_get(); + int color[4] = {128, 128, 128, 100}; if (e_config->resize_object.customize) { - evas_object_color_set(resize_obj, - e_config->resize_object.r, - e_config->resize_object.g, - e_config->resize_object.b, - e_config->resize_object.a); + color[0] = e_config->resize_object.r; + color[1] = e_config->resize_object.g; + color[2] = e_config->resize_object.b; + color[3] = e_config->resize_object.a; } - else - evas_object_color_set(resize_obj, 128, 128, 128, 100); - return resize_obj; + layer_tree = e_canvas_layer_view_tree_get(canvas, layer_index); + if (!layer_tree) return NULL; + + view_rect = e_view_rect_create(layer_tree, w, h, color); + if (!view_rect) return NULL; + + e_view_position_set(e_view_rect_view_get(view_rect), x, y); + + return e_view_rect_view_get(view_rect); } -static Evas_Object * -_e_client_resize_object_image_get(E_Client *ec) +static E_View * +_e_client_resize_view_image_get(E_Client *ec, int layer_index, int x, int y, int w, int h) { - int err; - Evas_Object *resize_obj = NULL; + E_View_Load_Error err; + E_View_Image *view_image = NULL; + E_Canvas *canvas = e_comp_canvas_get(); if (!e_config->resize_object.image_path) { @@ -1453,74 +1501,74 @@ _e_client_resize_object_image_get(E_Client *ec) goto get_rectangle; } - resize_obj = evas_object_image_add(evas_object_evas_get(ec->frame)); - EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL); + view_image = e_view_image_create(e_canvas_layer_view_tree_get(canvas, layer_index)); + EINA_SAFETY_ON_NULL_RETURN_VAL(view_image, NULL); - evas_object_image_file_set(resize_obj, e_config->resize_object.image_path, NULL); - err = evas_object_image_load_error_get(resize_obj); - if (err != EVAS_LOAD_ERROR_NONE) + e_view_image_file_set(view_image, e_config->resize_object.image_path, NULL); + err = e_view_image_load_error_get(view_image); + if (err != E_VIEW_LOAD_ERROR_NONE) { ELOGF("COMP", "Image load error. path:%s, errno:%d. Make default resize_object", ec, e_config->resize_object.image_path, err); - evas_object_del(resize_obj); - resize_obj = NULL; + e_view_destroy(e_view_image_view_get(view_image)); goto get_rectangle; } - evas_object_image_fill_set(resize_obj, 0, 0, ec->w, ec->h); - evas_object_image_filled_set(resize_obj, EINA_TRUE); + e_view_image_fill_set(view_image, 0, 0, ec->w, ec->h); + e_view_image_filled_set(view_image, true); + e_view_image_border_set(view_image, + e_config->resize_object.border_width.l, + e_config->resize_object.border_width.r, + e_config->resize_object.border_width.t, + e_config->resize_object.border_width.b); - evas_object_image_border_set(resize_obj, - e_config->resize_object.border_width.l, - e_config->resize_object.border_width.r, - e_config->resize_object.border_width.t, - e_config->resize_object.border_width.b); + e_view_image_geometry_set(view_image, x, y, w, h); - return resize_obj; + return e_view_image_view_get(view_image); get_rectangle: - return _e_client_resize_object_rectangle_get(ec); + return _e_client_resize_view_rect_get(ec, layer_index, x, y, w, h); } -static Evas_Object * -_e_client_resize_object_create(E_Client *ec) +static E_View * +_e_client_resize_view_create(E_Client *ec, int x, int y, int w, int h) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, NULL); + E_View * resize_view = NULL; + E_View_Client *view_client; + E_Canvas_Layer layer_index; - Evas_Object *resize_obj = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (_e_client_resize_object_create_cb) - resize_obj = _e_client_resize_object_create_cb(ec); - else - { - if (e_config->resize_object.type == 1) // image object - { - resize_obj = _e_client_resize_object_image_get(ec); - } - else // rectangle - { - resize_obj = _e_client_resize_object_rectangle_get(ec); - } - } - EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL); + view_client = e_client_view_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(view_client, NULL); + + layer_index = e_view_layer_index_get(e_view_client_view_get(view_client)); + + if (_e_client_resize_view_create_cb) + resize_view = _e_client_resize_view_create_cb(ec, x, y, w, h); + else if (e_config->resize_object.type == 1) // image object + resize_view = _e_client_resize_view_image_get(ec, layer_index, x, y, w, h); + else // rectangle + resize_view = _e_client_resize_view_rect_get(ec, layer_index, x, y, w, h); - evas_object_pass_events_set(resize_obj, EINA_TRUE); - evas_object_layer_set(resize_obj, evas_object_layer_get(ec->frame)); - evas_object_stack_above(resize_obj, ec->frame); - evas_object_name_set(resize_obj, "resize_object"); + if(!resize_view) return NULL; - return resize_obj; + e_view_pass_events_set(resize_view, true); + e_view_place_above(resize_view, e_view_client_view_get(view_client)); + e_view_name_set(resize_view, "resize_object"); + + return resize_view; } static void -_e_client_resize_object_del(E_Client *ec) +_e_client_resize_view_del(E_Client *ec) { if (ec == NULL) return; - if (ec->manage_resize.resize_obj == NULL) return; + if (ec->manage_resize.resize_view == NULL) return; - evas_object_hide(ec->manage_resize.resize_obj); - evas_object_del(ec->manage_resize.resize_obj); - ec->manage_resize.resize_obj = NULL; + e_view_hide(ec->manage_resize.resize_view); + e_view_destroy(ec->manage_resize.resize_view); + ec->manage_resize.resize_view = NULL; } EINTERN void @@ -1651,26 +1699,40 @@ e_client_resize_handle(E_Client *ec) if (e_config->interactive_resize) { - e_view_position_set(e_view_client_view_get(PRI(ec)->view_client), new_x, new_y); - e_view_client_size_set(PRI(ec)->view_client, new_w, new_h); + E_View_Client *view_client = e_client_view_get(ec); + if (view_client) + e_view_client_geometry_set(view_client, new_x, new_y, new_w, new_h); } else { - if (ec->manage_resize.resize_obj == NULL) - { - ec->manage_resize.resize_obj = _e_client_resize_object_create(ec); - EINA_SAFETY_ON_NULL_RETURN(ec->manage_resize.resize_obj); - } + E_View_Rect *view_rect; + E_View_Image *view_image; if (e_client_transform_core_enable_get(ec)) { e_client_transform_core_input_inv_transform(ec, new_x, new_y, &trans_x, &trans_y); e_client_transform_core_input_inv_transform(ec, new_w, new_h, &trans_w, &trans_h); - evas_object_geometry_set(ec->manage_resize.resize_obj, trans_x, trans_y, trans_w, trans_h); } else - evas_object_geometry_set(ec->manage_resize.resize_obj, new_x, new_y, new_w, new_h); - evas_object_show(ec->manage_resize.resize_obj); + trans_x = new_x, trans_y = new_y, trans_w = new_w, trans_h = new_h; + + if (ec->manage_resize.resize_view == NULL) + { + ec->manage_resize.resize_view = _e_client_resize_view_create(ec, trans_x, trans_y, trans_w, trans_h); + if(!ec->manage_resize.resize_view) return; + } + else + { + if ((view_rect = e_view_rect_try_from_view(ec->manage_resize.resize_view)) != NULL) + { + e_view_position_set(ec->manage_resize.resize_view, trans_x, trans_y); + e_view_rect_size_set(view_rect, trans_w, trans_h); + } + else if ((view_image = e_view_image_try_from_view(ec->manage_resize.resize_view)) != NULL) + e_view_image_geometry_set(view_image, trans_x, trans_y, trans_w, trans_h); + } + + e_view_show(ec->manage_resize.resize_view); ec->manage_resize.x = new_x; ec->manage_resize.y = new_y; @@ -1741,7 +1803,7 @@ e_client_resize_end(E_Client *ec) if (!e_config->interactive_resize) { - if (ec->manage_resize.resize_obj) + if (ec->manage_resize.resize_view) { if (ec->manage_resize.unit_size > 1) _e_client_adjust_geometry_by_resize_ppu(ec); @@ -1751,7 +1813,7 @@ e_client_resize_end(E_Client *ec) ec->manage_resize.y, ec->manage_resize.w, ec->manage_resize.h); - _e_client_resize_object_del(ec); + _e_client_resize_view_del(ec); } } @@ -1800,7 +1862,7 @@ _e_client_position_inside_input_rect(E_Client *ec, int tx, int ty) EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); e_client_geometry_get(ec, &x, &y, &w, &h); - e_comp_object_input_rect_get(ec->frame, &list); + e_view_client_input_rect_get(e_client_view_get(ec), &list); if (list) { EINA_LIST_FOREACH(list, l, data) @@ -1832,7 +1894,7 @@ _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *ec) /* If a border was specified which should be excluded from the list * (because it will be closed shortly for example), skip */ if (e_client_util_ignored_get(ec) || (!e_desk_has_ec(desk, ec))) return EINA_TRUE; - if (!e_view_client_visible_get(PRI(ec)->view_client)) return EINA_TRUE; + if (!e_view_client_visible_get(e_client_view_get(ec))) return EINA_TRUE; if (e_policy_client_is_cursor(ec)) return EINA_TRUE; if (e_comp_wl->drag_client == ec) return EINA_TRUE; @@ -1874,7 +1936,7 @@ _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y) int ir_x, ir_y, ir_w, ir_h; e_client_geometry_get(cec, &cx, &cy, &cw, &ch); - e_comp_object_input_rect_get(cec->frame, &list); + e_view_client_input_rect_get(e_client_view_get(cec), &list); if (list) { EINA_LIST_FREE(list, rect) @@ -1940,12 +2002,19 @@ _e_client_transform_core_activate_set(E_Client *ec, Eina_Bool set) } static void -_e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_e_client_cb_view_client_hide(struct wl_listener *listener, void *data) { - E_Client *ec = data; + E_Client *ec; + E_Client_Private *priv; if (stopping) return; //ignore all of this if we're shutting down! - if (e_object_is_del(data)) return; //client is about to die + + priv = wl_container_of(listener, priv, view_client_hide_listener); + if (!priv->view_client) return; + + ec = e_view_data_get(e_view_client_view_get(priv->view_client), "E_Client"); + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; //client is about to die if (ec->cur_mouse_action) { if (ec->cur_mouse_action->func.end_mouse) @@ -1968,19 +2037,23 @@ _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN } static void -_e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_e_client_cb_view_client_move(struct wl_listener *listener, void *data) { - E_Client *ec = data; E_Map *map; Evas_Coord x, y; + E_Client *ec; + E_Client_Private *priv = wl_container_of(listener, priv, view_client_move_listener); + if (!priv->view_client) return; - if (e_object_is_del(data)) return; + ec = e_view_data_get(e_view_client_view_get(priv->view_client), "E_Client"); + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; ec->pre_res_change.valid = 0; _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE); - e_view_position_get(e_view_client_view_get(PRI(ec)->view_client), &x, &y); + e_view_position_get(e_view_client_view_get(priv->view_client), &x, &y); if ((e_config->transient.move) && (ec->transients)) { Eina_List *list = eina_list_clone(ec->transients); @@ -1997,7 +2070,7 @@ _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN } if (ec->moving || (ecmove == ec)) { - wl_signal_emit(&PRI(ec)->events.move_resize_update, NULL); + wl_signal_emit(&priv->events.move_resize_update, NULL); _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec); } @@ -2010,24 +2083,28 @@ _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN ec->pre_cb.x = x; ec->pre_cb.y = y; - wl_signal_emit(&PRI(ec)->events.move, NULL); + wl_signal_emit(&priv->events.move, NULL); e_comp_visibility_calculation_set(EINA_TRUE); } static void -_e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_e_client_cb_view_client_resize(struct wl_listener *listener, void *data) { - E_Client *ec = data; Evas_Coord x, y, w, h; + E_Client *ec; + E_Client_Private *priv = wl_container_of(listener, priv, view_client_resize_listener); + if (!priv->view_client) return; - if (e_object_is_del(data)) return; + ec = e_view_data_get(e_view_client_view_get(priv->view_client), "E_Client"); + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; ec->pre_res_change.valid = 0; _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE); - e_view_client_geometry_get(PRI(ec)->view_client, &x, &y, &w, &h); + e_view_client_geometry_get(priv->view_client, &x, &y, &w, &h); if ((e_config->transient.resize) && (ec->transients)) { Eina_List *list = eina_list_clone(ec->transients); @@ -2052,7 +2129,7 @@ _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ if (e_client_util_resizing_get(ec) || (ecresize == ec)) { - wl_signal_emit(&PRI(ec)->events.move_resize_update, NULL); + wl_signal_emit(&priv->events.move_resize_update, NULL); _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec); } ec->pre_cb.w = w; ec->pre_cb.h = h; @@ -2062,11 +2139,15 @@ _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ } static void -_e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_e_client_cb_view_client_show(struct wl_listener *listener, void *data) { - E_Client *ec = data; + E_Client *ec; + E_Client_Private *priv = wl_container_of(listener, priv, view_client_show_listener); + if (!priv->view_client) return; - if (e_object_is_del(data)) return; + ec = e_view_data_get(e_view_client_view_get(priv->view_client), "E_Client"); + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; _e_client_transform_core_activate_set(ec, EINA_TRUE); @@ -2077,12 +2158,16 @@ _e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN } static void -_e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_e_client_cb_view_client_restack(struct wl_listener *listener, void *data) { - E_Client *ec = data; E_Comp_Wl_Client_Data *child_cdata = NULL; + E_Client *ec; + E_Client_Private *priv = wl_container_of(listener, priv, view_client_restack_listener); + if (!priv->view_client) return; - if (e_object_is_del(data)) return; + ec = e_view_data_get(e_view_client_view_get(priv->view_client), "E_Client"); + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; if (ec->layer_block) return; if (ec->layer_pending) return; if (e_config->transient.raise && ec->transients) @@ -2171,6 +2256,7 @@ _e_client_eval(E_Client *ec) int send_event = 1; unsigned int prop = 0; int tx, ty; + E_View_Client *view_client; if (e_object_is_del(E_OBJECT(ec))) { @@ -2198,19 +2284,23 @@ _e_client_eval(E_Client *ec) } } - if (ec->changes.size) + view_client = e_client_view_get(ec); + if (view_client) { - ec->changes.size = 0; - e_view_client_size_set(PRI(ec)->view_client, ec->w, ec->h); + if (ec->changes.size) + { + ec->changes.size = 0; + e_view_client_size_set(view_client, ec->w, ec->h); - prop |= E_CLIENT_PROPERTY_SIZE; - } - if (ec->changes.pos) - { - ec->changes.tz_position = 0; - ec->changes.pos = 0; - e_view_position_set(e_view_client_view_get(PRI(ec)->view_client), ec->x, ec->y); - prop |= E_CLIENT_PROPERTY_POS; + prop |= E_CLIENT_PROPERTY_SIZE; + } + if (ec->changes.pos) + { + ec->changes.tz_position = 0; + ec->changes.pos = 0; + e_view_position_set(e_view_client_view_get(view_client), ec->x, ec->y); + prop |= E_CLIENT_PROPERTY_POS; + } } if (ec->changes.reset_gravity) @@ -2248,7 +2338,8 @@ _e_client_eval(E_Client *ec) { int t; tx = x - (ec->w >> 1); - e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL); + if (view_client) + e_view_client_frame_geometry_get(view_client, NULL, NULL, &t, NULL); ty = y - (t >> 1); e_client_pos_set(ec, tx, ty); EC_CHANGED(ec); @@ -2257,11 +2348,14 @@ _e_client_eval(E_Client *ec) } } - e_view_client_show(PRI(ec)->view_client); - if (e_view_client_visible_get(PRI(ec)->view_client)) + if (view_client) { - ec->changes.visible = 0; - _e_client_event_show(ec); + e_view_client_show(view_client); + if (e_view_client_visible_get(view_client)) + { + ec->changes.visible = 0; + _e_client_event_show(ec); + } } } else if ((ec->changes.visible) && (ec->new_client)) @@ -2334,13 +2428,17 @@ _e_client_eval(E_Client *ec) EINTERN void e_client_frame_update(E_Client *ec) { + E_View_Client *view_client; const char *bordername; EINA_SAFETY_ON_NULL_RETURN(ec); if (e_object_is_del(E_OBJECT(ec))) return; + view_client = e_client_view_get(ec); + if (!view_client) return; + ec->border.changed = 0; - if (!e_comp_object_frame_allowed(ec->frame)) return; + if (!e_view_client_frame_allowed(view_client)) return; if (ec->fullscreen || ec->borderless) bordername = "borderless"; else if (ec->bordername) @@ -2636,8 +2734,7 @@ _e_client_transform_core_check_change(E_Client *ec) Eina_Bool check = EINA_FALSE; if (!ec) return EINA_FALSE; - if (ec->frame) - e_view_client_geometry_get(PRI(ec)->view_client, NULL, NULL, &w, &h); + e_view_client_geometry_get(e_client_view_get(ec), NULL, NULL, &w, &h); // check client position or size change if (ec->x != ec->transform_core.backup.client_x || @@ -2736,7 +2833,6 @@ _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Ver int i; if (!ec) return; - if (!ec->frame) return; if (!ec->transform_core.result.enable) return; if (!vertices) return; @@ -2767,7 +2863,7 @@ _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Ver } static E_Map * -_e_client_transform_core_map_new(Evas_Object *obj, +_e_client_transform_core_map_new(E_View *view, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform *transform, Eina_Bool direct_render) @@ -2780,7 +2876,7 @@ _e_client_transform_core_map_new(Evas_Object *obj, map = e_map_new_with_direct_render(direct_render); EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL); - e_map_util_points_populate_from_object_full(map, obj, 0); + e_map_util_points_populate_from_view_full(map, view, 0); e_map_util_points_color_set(map, 255, 255, 255, 255); for (i = 0 ; i < 4 ; ++i) @@ -2806,75 +2902,79 @@ _e_client_transform_core_map_new(Evas_Object *obj, static void _e_client_transform_core_vertices_apply_with_zoom(E_Client *ec, - Evas_Object *obj, + E_View_Client *view_client, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform *transform, E_Util_Transform_Zoom zoom) { E_Map *map = NULL, *current_map = NULL; - if (!obj) return; + if (!ec) return; + if (!view_client) return; if (vertices) { if (!ec->transform_core.update_lock) { - map = _e_client_transform_core_map_new(obj, vertices, transform, + E_View *view = e_view_client_view_get(view_client); + map = _e_client_transform_core_map_new(view, vertices, transform, ec->transform_core.direct_render); EINA_SAFETY_ON_NULL_RETURN(map); e_map_util_zoom(map, zoom.zoom_x, zoom.zoom_y, zoom.cx, zoom.cy); - e_comp_object_map_set(obj, map); + e_view_client_map_set(view_client, map); } - current_map = e_comp_object_map_get(obj); + current_map = e_view_client_map_get(view_client); if ((ec->transform_core.activate) && (current_map)) - e_comp_object_map_enable_set(obj, EINA_TRUE); + e_view_client_map_enable_set(view_client, EINA_TRUE); else - e_comp_object_map_enable_set(obj, EINA_FALSE); + e_view_client_map_enable_set(view_client, EINA_FALSE); if (map) e_map_free(map); if (current_map) e_map_free(current_map); } else - evas_object_map_enable_set(obj, EINA_FALSE); + e_view_client_map_enable_set(view_client, EINA_FALSE); } static void _e_client_transform_core_vertices_apply(E_Client *ec, - Evas_Object *obj, + E_View_Client *view_client, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform *transform) { E_Map *map = NULL, *current_map = NULL; - if (!obj) return; + if (!ec) return; + if (!view_client) return; if (vertices) { if (!ec->transform_core.update_lock) { - map = _e_client_transform_core_map_new(obj, vertices, transform, + E_View *view = e_view_client_view_get(view_client); + map = _e_client_transform_core_map_new(view, vertices, transform, ec->transform_core.direct_render); EINA_SAFETY_ON_NULL_RETURN(map); - e_comp_object_map_set(obj, map); + e_view_client_map_set(view_client, map); } - current_map = e_comp_object_map_get(obj); + current_map = e_view_client_map_get(view_client); if ((ec->transform_core.activate) && (current_map)) - e_comp_object_map_enable_set(obj, EINA_TRUE); + e_view_client_map_enable_set(view_client, true); else - e_comp_object_map_enable_set(obj, EINA_FALSE); + e_view_client_map_enable_set(view_client, false); if (map) e_map_free(map); if (current_map) e_map_free(current_map); } else - evas_object_map_enable_set(obj, EINA_FALSE); + e_view_client_map_enable_set(view_client, false); } static void @@ -3061,6 +3161,7 @@ e_client_idler_before(Eina_Bool *check_focus) // pass 2 - show and hide windows needing hide and eval (main eval) E_CLIENT_FOREACH(ec) { + E_View_Client *view_client; if (e_object_is_del(E_OBJECT(ec))) continue; if (ec->ignored) { @@ -3074,7 +3175,8 @@ e_client_idler_before(Eina_Bool *check_focus) continue; } - if (ec->changes.visible) + view_client = e_client_view_get(ec); + if (view_client && ec->changes.visible) { if (ec->visible) { @@ -3082,13 +3184,13 @@ e_client_idler_before(Eina_Bool *check_focus) (!ec->changes.pos) && (!ec->changes.size)) { - e_view_client_show(PRI(ec)->view_client); - ec->changes.visible = !e_view_client_visible_get(PRI(ec)->view_client); + e_view_client_show(view_client); + ec->changes.visible = !e_view_client_visible_get(view_client); } } else { - e_view_client_hide(PRI(ec)->view_client); + e_view_client_hide(view_client); ec->changes.visible = 0; } } @@ -3108,10 +3210,10 @@ e_client_idler_before(Eina_Bool *check_focus) } } - if ((ec->changes.visible) && (ec->visible) && (!ec->changed)) + if (view_client && (ec->changes.visible) && (ec->visible) && (!ec->changed)) { - e_view_client_show(PRI(ec)->view_client); - ec->changes.visible = !e_view_client_visible_get(PRI(ec)->view_client); + e_view_client_show(view_client); + ec->changes.visible = !e_view_client_visible_get(view_client); ec->changed = ec->changes.visible; e_comp_visibility_calculation_set(EINA_TRUE); } @@ -3192,7 +3294,6 @@ e_client_shutdown(void) E_FREE_LIST(comp_hooks, e_comp_object_hook_del); E_FREE_LIST(hooks, e_comp_wl_hook_del); E_FREE_LIST(handlers, ecore_event_handler_del); - } E_API void @@ -3244,24 +3345,12 @@ _e_client_input_thread_clone_new(E_Client *ec) e_input_backend_thread_safe_call(_e_input_thread_client_new, &ec_new_data, sizeof(E_Input_Thread_Request_EClient_Data)); } -static void -_e_client_view_init(E_Client *ec) -{ - E_Client_Private *priv = PRI(ec); - E_View_Tree *tree; - - tree = e_canvas_layer_view_tree_get(e_comp->canvas, E_CANVAS_LAYER_CLIENT_NORMAL); - if (!tree) - return; - - priv->view_client = e_view_client_create(ec, tree); -} - E_API E_Client * e_client_new(E_Pixmap *cp, int first_map, int internal) { E_Client *ec; E_Pixmap_Type type; + E_View_Client *view_client; type = e_pixmap_type_get(cp); if (type >= E_PIXMAP_TYPE_MAX) return NULL; @@ -3373,22 +3462,37 @@ e_client_new(E_Pixmap *cp, int first_map, int internal) ELOGF("COMP", "CLIENT ADD. cp:%p, argb:%d, internal:%d, ignored:%d", ec, cp, ec->argb, internal, ec->ignored); if (!ec->ignored) _e_client_event_add(ec); - e_comp_object_client_add(ec); - if (ec->frame) + + view_client = _e_client_view_init(ec); + if (view_client) { - _e_client_view_init(ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec); + E_View *view; + E_Client_Private *priv = PRI(ec); + priv->view_client = view_client; + + view = e_view_client_view_get(view_client); + + priv->view_client_show_listener.notify = _e_client_cb_view_client_show; + e_view_event_listener_add(view, E_VIEW_SHOW, &priv->view_client_show_listener); + + priv->view_client_hide_listener.notify = _e_client_cb_view_client_hide; + e_view_event_listener_add(view, E_VIEW_HIDE, &priv->view_client_hide_listener); + + priv->view_client_resize_listener.notify = _e_client_cb_view_client_resize; + e_view_event_listener_add(view, E_VIEW_RESIZE, &priv->view_client_resize_listener); + + priv->view_client_move_listener.notify = _e_client_cb_view_client_move; + e_view_event_listener_add(view, E_VIEW_MOVE, &priv->view_client_move_listener); + + priv->view_client_restack_listener.notify = _e_client_cb_view_client_restack; + e_view_event_listener_add(view, E_VIEW_RESTACK, &priv->view_client_restack_listener); } #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_ _e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT_POST, ec); #endif - ec->manage_resize.resize_obj = NULL; + ec->manage_resize.resize_view = NULL; ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0; ec->manage_resize.enable_aspect_ratio = EINA_FALSE; ec->manage_resize.aw = ec->manage_resize.ah = 0; @@ -3665,8 +3769,7 @@ e_client_res_change_geometry_restore(E_Client *ec) x = zx + zw - w; if ((y + h) > (zy + zh)) y = zy + zh - h; - e_view_position_set(e_view_client_view_get(PRI(ec)->view_client), x, y); - e_view_client_size_set(PRI(ec)->view_client, w, h); + e_view_client_geometry_set(e_client_view_get(ec), x, y, w, h); } memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change)); } @@ -3722,51 +3825,35 @@ e_client_size_get(E_Client *ec, int *w, int *h) E_API void e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h) { - int gx = 0; - int gy = 0; - int gw = 0; - int gh = 0; E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); + E_View_Client *view_client = e_client_view_get(ec); if (e_client_transform_core_enable_get(ec)) { - gx = ec->transform_core.result.boundary.x; - gy = ec->transform_core.result.boundary.y; - gw = ec->transform_core.result.boundary.w; - gh = ec->transform_core.result.boundary.h; + if (x) *x = ec->transform_core.result.boundary.x; + if (y) *y = ec->transform_core.result.boundary.y; + if (w) *w = ec->transform_core.result.boundary.w; + if (h) *h = ec->transform_core.result.boundary.h; + return; } - else + else if (view_client) { - if (ec->frame) - { - e_view_client_geometry_get(PRI(ec)->view_client, &gx, &gy, &gw, &gh); - if (gw == 0 && gh == 0) - { - /* In this case, there is no image buffer in e_comp_object, thus it - * should return geometry value of ec itself. It usually happens if - * new ec is not mapped yet. - */ - gw = ec->w; - gh = ec->h; - gx = ec->x; - gy = ec->y; - } - } - else - { - gx = ec->x; - gy = ec->y; - gw = ec->w; - gh = ec->h; - } + e_view_client_geometry_get(view_client, x, y, w, h); + if (*w != 0 || *h != 0) + return; + + /* In this case (w == 0 && h == 0), there is no image buffer in e_comp_object, thus it + * should return geometry value of ec itself. It usually happens if + * new ec is not mapped yet. + */ } - if (x) *x = gx; - if (y) *y = gy; - if (w) *w = gw; - if (h) *h = gh; + if (x) *x = ec->x; + if (y) *y = ec->y; + if (w) *w = ec->w; + if (h) *h = ec->h; } E_API E_Client * @@ -4526,6 +4613,7 @@ e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden) EINTERN void e_client_act_move_keyboard(E_Client *ec) { + E_View_Client *view_client; EINA_SAFETY_ON_NULL_RETURN(ec); if (!_e_client_move_begin(ec)) @@ -4536,7 +4624,10 @@ e_client_act_move_keyboard(E_Client *ec) wl_signal_emit(&PRI(ec)->events.move_update, NULL); if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return; - e_view_freeze_events_set(e_view_client_view_get(PRI(ec)->view_client), true); + + view_client = e_client_view_get(ec); + if (view_client) + e_view_freeze_events_set(e_view_client_view_get(view_client), true); if (!action_handler_mouse) action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL); @@ -4545,6 +4636,7 @@ e_client_act_move_keyboard(E_Client *ec) EINTERN void e_client_act_resize_keyboard(E_Client *ec) { + E_View_Client *view_client; EINA_SAFETY_ON_NULL_RETURN(ec); ec->resize_mode = E_POINTER_RESIZE_TL; @@ -4557,7 +4649,9 @@ e_client_act_resize_keyboard(E_Client *ec) _e_client_action_init(ec); _e_client_action_resize_timeout_add(); - e_view_freeze_events_set(e_view_client_view_get(PRI(ec)->view_client), true); + view_client = e_client_view_get(ec); + if (view_client) + e_view_freeze_events_set(e_view_client_view_get(view_client), true); if (!action_handler_mouse) action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL); @@ -4889,11 +4983,13 @@ e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char EINTERN void e_client_resize_limit(E_Client *ec, int *w, int *h) { + E_View_Client *view_client; + E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); - if (ec->frame) - e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h); + view_client = e_client_view_get(ec); + e_view_client_frame_wh_unadjust(view_client, *w, *h, w, h); if (*h < 1) *h = 1; if (*w < 1) *w = 1; @@ -4904,8 +5000,7 @@ e_client_resize_limit(E_Client *ec, int *w, int *h) else if (*h < ec->icccm.min_h) *h = ec->icccm.min_h; - if (ec->frame) - e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h); + e_view_client_frame_wh_unadjust(view_client, *w, *h, w, h); } //////////////////////////////////////////// @@ -4977,7 +5072,7 @@ e_client_redirected_set(E_Client *ec, Eina_Bool set) wl_signal_emit(&PRI(ec)->events.unredirect, NULL); if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return; } - e_comp_object_redirected_set(ec->frame, set); + e_view_client_redirected_set(e_client_view_get(ec), set); ec->redirected = !!set; } @@ -4996,9 +5091,10 @@ EINTERN void e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy) { E_Map *map; - E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); - E_Client *subc; Eina_List *l; + E_Client *subc; + E_View_Client *view_client; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); if (e_comp_wl_subsurface_check(ec)) return; @@ -5030,7 +5126,12 @@ e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy } map = e_map_new_with_direct_render(ec->transform_core.direct_render); - e_map_util_points_populate_from_object_full(map, ec->frame, 0); + view_client = e_client_view_get(ec); + if (view_client) + { + E_View *view = e_view_client_view_get(view_client); + e_map_util_points_populate_from_view_full(map, view, 0); + } e_map_util_rotate(map, angle, cx, cy); _e_client_transform_geometry_save(ec, map); @@ -5123,10 +5224,13 @@ e_client_transform_core_remove(E_Client *ec, E_Util_Transform *transform) E_API void e_client_transform_core_update(E_Client *ec) { + E_View_Client *view_client; + if (!ec) return; if (ec->new_client) return; if (!_e_client_transform_core_check_change(ec)) return; + view_client = e_client_view_get(ec); if (ec->transform_core.transform_list || ec->transform_core.parent.enable) { E_Util_Transform_Rect source_rect; @@ -5170,16 +5274,9 @@ e_client_transform_core_update(E_Client *ec) boundary_matrix = matrix; } - if (background != ec->transform_core.background) + if (background != ec->transform_core.background && view_client) { - if (background) - { - e_comp_object_transform_bg_set(ec->frame, EINA_TRUE); - } - else - { - e_comp_object_transform_bg_set(ec->frame, EINA_FALSE); - } + e_view_client_transform_bg_set(view_client, background); ec->transform_core.background = background; } @@ -5190,15 +5287,12 @@ e_client_transform_core_update(E_Client *ec) int angle = 0; e_util_transform_rotation_round_get(&ec->transform_core.result.transform, 0, 0, &angle); - angle %= 90; - if (angle == 0) // when transform angle is 0, 90, 180, 270, 360. then set transp rect - e_comp_object_transform_transp_set(ec->frame, EINA_TRUE); - else - e_comp_object_transform_transp_set(ec->frame, EINA_FALSE); + angle %= 90; // when transform angle is 0, 90, 180, 270, 360. then set transp rect + e_view_client_transform_transp_set(view_client, !angle); } else - e_comp_object_transform_transp_set(ec->frame, EINA_FALSE); + e_view_client_transform_transp_set(view_client, false); // 3.5 parent matrix multiply if (ec->transform_core.parent.enable) @@ -5230,20 +5324,20 @@ e_client_transform_core_update(E_Client *ec) if (ec->transform_core.result.transform.use_zoom) { // TODO: apply zoom values to vertices - e_comp_object_transform_transp_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.vertices, + e_view_client_transform_transp_vertices_set_with_zoom(view_client, &ec->transform_core.result.vertices, ec->transform_core.result.transform.zoom); - e_comp_object_transform_bg_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.boundary.vertices, + e_view_client_transform_bg_vertices_set_with_zoom(view_client, &ec->transform_core.result.boundary.vertices, ec->transform_core.result.transform.zoom); _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices); - _e_client_transform_core_vertices_apply_with_zoom(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform, + _e_client_transform_core_vertices_apply_with_zoom(ec, view_client, &ec->transform_core.result.vertices, &ec->transform_core.result.transform, ec->transform_core.result.transform.zoom); } else { - e_comp_object_transform_transp_vertices_set(ec->frame, &ec->transform_core.result.vertices); - e_comp_object_transform_bg_vertices_set(ec->frame, &ec->transform_core.result.boundary.vertices); + e_view_client_transform_transp_vertices_set(view_client, &ec->transform_core.result.vertices); + e_view_client_transform_bg_vertices_set(view_client, &ec->transform_core.result.boundary.vertices); _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices); - _e_client_transform_core_vertices_apply(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform); + _e_client_transform_core_vertices_apply(ec, view_client, &ec->transform_core.result.vertices, &ec->transform_core.result.transform); } // 6. subsurface update @@ -5260,10 +5354,10 @@ e_client_transform_core_update(E_Client *ec) if (ec->transform_core.result.enable) { ec->transform_core.result.enable = EINA_FALSE; - _e_client_transform_core_vertices_apply(ec, ec->frame, NULL, NULL); - e_comp_object_transform_bg_set(ec->frame, EINA_FALSE); + _e_client_transform_core_vertices_apply(ec, view_client, NULL, NULL); + e_view_client_transform_bg_set(view_client, false); ec->transform_core.background = EINA_FALSE; - e_comp_object_transform_transp_set(ec->frame, EINA_FALSE); + e_view_client_transform_transp_set(view_client, false); _e_client_transform_core_sub_update(ec, NULL); if (!e_object_is_del(E_OBJECT(ec))) @@ -5649,7 +5743,6 @@ E_API E_View_Client * e_client_view_get(E_Client *ec) { E_OBJECT_CHECK_RETURN(ec, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(PRI(ec)->view_client, NULL); return PRI(ec)->view_client; } @@ -5801,19 +5894,21 @@ E_API void e_client_frame_focus_set(E_Client *ec, Eina_Bool focus) { if (!ec) return; - e_view_client_focus_set(PRI(ec)->view_client, focus); + + e_view_client_focus_set(e_client_view_get(ec), focus); } E_API void e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h) { + E_View_Client *view_client; + if (!ec) return; + view_client = e_client_view_get(ec); + if (ec->internal || ec->input_only) - { - e_view_position_set(e_view_client_view_get(PRI(ec)->view_client), x, y); - e_view_client_size_set(PRI(ec)->view_client, w, h); - } + e_view_client_geometry_set(view_client, x, y, w, h); else { if ((ec->w != w) || (ec->h != h)) @@ -5822,13 +5917,10 @@ e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h) ec->move_after_resize = EINA_TRUE; e_client_pos_set(ec, x, y); - e_view_client_size_set(PRI(ec)->view_client, w, h); + e_view_client_size_set(view_client, w, h); } else - { - e_view_position_set(e_view_client_view_get(PRI(ec)->view_client), x, y); - e_view_client_size_set(PRI(ec)->view_client, w, h); - } + e_view_client_geometry_set(view_client, x, y, w, h); } } @@ -5868,7 +5960,7 @@ e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h ELOGF("POSSIZE", "Set move_after_resize. old(%d,%d,%dx%d), new(%d,%d,%dx%d)", ec, ec->x, ec->y, ec->w, ec->h, x, y, w, h); ec->move_after_resize = EINA_TRUE; - e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y); + e_view_client_frame_xy_adjust(e_client_view_get(ec), x, y, &x, &y); e_client_pos_set(ec, x, y); e_client_util_resize_without_frame(ec, w, h); } @@ -5990,9 +6082,12 @@ E_API Eina_Bool e_client_layer_set(E_Client *ec, E_Layer layer) { + E_View_Client *view_client; E_OBJECT_CHECK_RETURN(ec, EINA_FALSE); E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE); - if (!ec->frame) return EINA_FALSE; + + view_client = e_client_view_get(ec); + if (!view_client) return EINA_FALSE; if (e_comp_canvas_client_layer_map(layer) == 9999) return EINA_FALSE; //invalid layer is not allowed @@ -6000,10 +6095,11 @@ e_client_layer_set(E_Client *ec, if (ec->layer != layer) { int w, h; - e_view_client_geometry_get(PRI(ec)->view_client, NULL, NULL, &w, &h); - e_view_client_geometry_set(PRI(ec)->view_client, ec->x, ec->y, w, h); + e_view_client_geometry_get(view_client, NULL, NULL, &w, &h); + e_view_client_geometry_set(view_client, ec->x, ec->y, w, h); } - e_view_client_layer_set(PRI(ec)->view_client, e_canvas_util_e_layer_map(layer)); + + e_view_client_layer_set(view_client, e_canvas_util_e_layer_map(layer)); if (ec->layer != layer) { /* check exceptional case */ @@ -6036,12 +6132,15 @@ E_API E_Layer e_client_layer_get(E_Client *ec) { short layer; + E_View_Client *view_client; E_OBJECT_CHECK_RETURN(ec, E_LAYER_BOTTOM); E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, E_LAYER_BOTTOM); - if (!ec->frame) return E_LAYER_BOTTOM; - layer = e_view_layer_index_get(e_view_client_view_get(PRI(ec)->view_client)); + view_client = e_client_view_get(ec); + if (!view_client) return E_LAYER_BOTTOM; + + layer = e_view_layer_index_get(e_view_client_view_get(view_client)); if (ec->layer != layer) { /* client could be on temperory layer while pending or block, @@ -6106,7 +6205,11 @@ e_client_raise(E_Client *ec) if (ec->parent && e_client_is_belong_to_parent(ec)) _raise_belong_to_parent(ec); else - e_view_raise_to_top(e_view_client_view_get(PRI(ec)->view_client)); + { + E_View_Client *view_client = e_client_view_get(ec); + if (view_client) + e_view_raise_to_top(e_view_client_view_get(view_client)); + } wl_signal_emit(&PRI(ec)->events.raise, NULL); } @@ -6215,7 +6318,11 @@ e_client_lower(E_Client *ec) if (ec->parent && e_client_is_belong_to_parent(ec)) _lower_belong_to_parent(ec); else - e_view_lower_to_bottom(e_view_client_view_get(PRI(ec)->view_client)); + { + E_View_Client *view_client = e_client_view_get(ec); + if (view_client) + e_view_lower_to_bottom(e_view_client_view_get(view_client)); + } wl_signal_emit(&PRI(ec)->events.lower, NULL); } @@ -6224,14 +6331,19 @@ E_API void e_client_stack_above(E_Client *ec, E_Client *above) { E_View *ec_view, *above_view; + E_View_Client *ec_view_client, *above_view_client; if (!ec) return; - if (!ec->frame) return; if (!above) return; - if (!above->frame) return; + + ec_view_client = e_client_view_get(ec); + if (!ec_view_client) return; + + above_view_client = e_client_view_get(above); + if (!above_view_client) return; - ec_view = e_view_client_view_get(PRI(ec)->view_client); - above_view = e_view_client_view_get(PRI(above)->view_client); + ec_view = e_view_client_view_get(ec_view_client); + above_view = e_view_client_view_get(above_view_client); if (e_view_parent_get(ec_view) != e_view_parent_get(above_view)) e_view_reparent(ec_view, e_view_parent_get(above_view)); @@ -6245,14 +6357,19 @@ E_API void e_client_stack_below(E_Client *ec, E_Client *below) { E_View *ec_view, *below_view; + E_View_Client *ec_view_client, *below_view_client; if (!ec) return; - if (!ec->frame) return; if (!below) return; - if (!below->frame) return; - ec_view = e_view_client_view_get(PRI(ec)->view_client); - below_view = e_view_client_view_get(PRI(below)->view_client); + ec_view_client = e_client_view_get(ec); + if (!ec_view_client) return; + + below_view_client = e_client_view_get(below); + if (!below_view_client) return; + + ec_view = e_view_client_view_get(ec_view_client); + below_view = e_view_client_view_get(below_view_client); if (e_view_parent_get(ec_view) != e_view_parent_get(below_view)) e_view_reparent(ec_view, e_view_parent_get(below_view)); @@ -6282,12 +6399,14 @@ e_client_show_pending_unset(E_Client *ec) ELOGF("E_CLIENT", "UNSET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running); if (ec->show_pending.count == 0 && ec->show_pending.running) { + E_View_Client *view_client = e_client_view_get(ec); ec->show_pending.running = EINA_FALSE; - if (ec->frame) + + if (view_client) { ELOGF("E_CLIENT", "e_view_client_show by unset show_pending", ec); - e_view_client_show(PRI(ec)->view_client); - //e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); + e_view_client_show(view_client); + //e_view_client_damage(view_client, 0, 0, ec->w, ec->h); EC_CHANGED(ec); } } @@ -6380,7 +6499,7 @@ e_client_map_set(E_Client *ec, E_Map *em) { EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - return e_map_set_to_comp_object(em, ec->frame); + return e_view_client_map_set(e_client_view_get(ec), em); } E_API E_Map * @@ -6388,18 +6507,15 @@ e_client_map_get(const E_Client *ec) { EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - return e_map_get_from_comp_object(ec->frame); + return e_view_client_map_get(e_client_view_get((E_Client *)ec)); } EINTERN Eina_Bool e_client_map_enable_set(E_Client *ec, Eina_Bool enable) { EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE); - e_view_map_enable_set(e_view_client_view_get(PRI(ec)->view_client), enable); - - return EINA_TRUE; + return e_view_client_map_enable_set(e_client_view_get(ec), enable); } EINTERN void @@ -6431,11 +6547,11 @@ e_client_transient_policy_get(E_Client *ec) } EINTERN void -e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb) +e_client_resize_view_create_cb_set(E_Client_Resize_View_Create_Cb cb) { - if (_e_client_resize_object_create_cb && cb) - CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE OBJECT CREATE HOOK!!!"); - _e_client_resize_object_create_cb = cb; + if (_e_client_resize_view_create_cb && cb) + CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE VIEW CREATE HOOK!!!"); + _e_client_resize_view_create_cb = cb; } EINTERN void @@ -7264,7 +7380,7 @@ e_client_show(E_Client *ec) ec, ec->internal, (ec == e_comp_wl->drag_client)); ec->visible = EINA_TRUE; ec->ignored = 0; - e_view_client_show(PRI(ec)->view_client); + e_view_client_show(e_client_view_get(ec)); ec->comp_data->mapped = 1; } } @@ -7307,7 +7423,7 @@ e_client_hide(E_Client *ec) ELOGF("E_CLIENT", "Unmap. internal:%d, sub:%p, drag:%d", ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client)); ec->visible = EINA_FALSE; - e_view_client_hide(PRI(ec)->view_client); + e_view_client_hide(e_client_view_get(ec)); ec->comp_data->mapped = 0; } } @@ -7349,12 +7465,13 @@ e_client_aot_type_set(E_Client *ec, E_Aot_Type type) API_ENTRY; priv->aot_type = type; - if (type == E_AOT_TYPE_LAUNCHER) + if (type == E_AOT_TYPE_LAUNCHER && priv->view_client) { - if (ec->frame) + ELOGF("TZPOL", "AOT Launcher window. Set to skip compositing", ec); + if (priv->view_client) { - ELOGF("TZPOL", "AOT Launcher window. Set to skip compositing", ec); - evas_object_color_set(ec->frame, 0, 0, 0, 0); + E_View *view = e_view_client_view_get(priv->view_client); + e_view_color_set(view, 0, 0, 0, 0); } } } diff --git a/src/bin/core/e_client_intern.h b/src/bin/core/e_client_intern.h index 021f5d3..3794170 100644 --- a/src/bin/core/e_client_intern.h +++ b/src/bin/core/e_client_intern.h @@ -71,7 +71,7 @@ EINTERN void e_client_move_cancel(void); EINTERN Eina_Bool e_client_resize_begin(E_Client *ec); EINTERN void e_client_resize_cancel(void); -EINTERN void e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb); +EINTERN void e_client_resize_view_create_cb_set(E_Client_Resize_View_Create_Cb cb); EINTERN void e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size); EINTERN void e_client_resize_limit(E_Client *ec, int *w, int *h); diff --git a/src/bin/core/e_client_video.c b/src/bin/core/e_client_video.c index f2d9448..4292efa 100644 --- a/src/bin/core/e_client_video.c +++ b/src/bin/core/e_client_video.c @@ -9,13 +9,17 @@ #include "e_video_fallback_intern.h" #include "e_comp_wl_rsm_intern.h" #include "e_eom_intern.h" +#include "e_view_intern.h" +#include "e_view_client_intern.h" #include "e_client_intern.h" #define EO_DATA_KEY "E_Client_Video" -#define INTERNAL_DATA_GET \ - E_Client_Video *ecv; \ - ecv = evas_object_data_get(ec->frame, EO_DATA_KEY) +#define INTERNAL_DATA_GET \ + E_Client_Video *ecv = NULL; \ + E_View_Client *view_client = e_client_view_get(ec); \ + if (view_client) \ + ecv = e_view_data_get(e_view_client_view_get(view_client), EO_DATA_KEY) #define IFACE_CHECK_RET(iname, ret) \ INTERNAL_DATA_GET; \ @@ -149,9 +153,13 @@ _e_client_video_deinit(E_Client_Video *ecv) static void _e_client_video_del(E_Client_Video *ecv) { + E_View_Client *view_client; _e_client_video_deinit(ecv); - evas_object_data_del(ecv->ec->frame, EO_DATA_KEY); + view_client = e_client_view_get(ecv->ec); + if (view_client) + e_view_data_del(e_view_client_view_get(view_client), EO_DATA_KEY); + e_object_unref(E_OBJECT(ecv->ec)); free(ecv); @@ -332,10 +340,10 @@ _e_client_video_cb_remote_surface_provider_visibility_change(void *data, int typ switch (e_client_visibility_get(ev->ec)) { case E_VISIBILITY_FULLY_OBSCURED: - evas_object_hide(ecv->ec->frame); + e_view_client_hide(e_client_view_get(ecv->ec)); break; case E_VISIBILITY_UNOBSCURED: - evas_object_show(ecv->ec->frame); + e_view_client_show(e_client_view_get(ecv->ec)); break; default: VER("Not implemented", ecv->ec); @@ -411,11 +419,15 @@ e_client_video_set(E_Client *ec) { E_Client_Video *ecv; Eina_Bool res; + E_View *view; + E_View_Client *view_client; VIN("Set video client", ec); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE); + + view_client = e_client_view_get(ec); + if (!view_client) return EINA_FALSE; if (e_object_is_del(E_OBJECT(ec))) { @@ -423,7 +435,8 @@ e_client_video_set(E_Client *ec) return EINA_FALSE; } - ecv = evas_object_data_get(ec->frame, EO_DATA_KEY); + view = e_view_client_view_get(view_client); + ecv = e_view_data_get(view, EO_DATA_KEY); if (ecv) { VER("Given client was already set as Video client", ec); @@ -445,7 +458,7 @@ e_client_video_set(E_Client *ec) return EINA_FALSE; } - evas_object_data_set(ec->frame, EO_DATA_KEY, ecv); + e_view_data_set(view, EO_DATA_KEY, ecv); e_object_ref(E_OBJECT(ec)); return EINA_TRUE; diff --git a/src/bin/core/e_view_client.c b/src/bin/core/e_view_client.c index f3a8978..fec5576 100644 --- a/src/bin/core/e_view_client.c +++ b/src/bin/core/e_view_client.c @@ -20,6 +20,17 @@ typedef struct _E_View_Client_Effect void *data; } E_View_Client_Effect; +typedef struct _E_View_Client_Signal +{ + E_View_Client *client; + E_View_Client_Signal_Cb cb; + const char *sig; + const char *src; + void *data; + + struct wl_list link; +} E_View_Client_Signal; + static E_View_Client * _view_client_from_view(E_View *view) { @@ -35,6 +46,7 @@ _view_client_handle_destroy(E_View *view) E_View_Client *client = _view_client_from_view(view); e_view_data_del(&client->view, "E_Client"); + evas_object_del(client->view.eo); free(client); } @@ -78,21 +90,27 @@ E_View_Tree_Impl view_client_tree_impl = { EINTERN E_View_Client * e_view_client_create(E_Client *ec, E_View_Tree *parent) { + Evas_Object *frame; E_View_Client *client; - if (ec == NULL || ec->frame == NULL) - return NULL; + if (!ec) return NULL; client = malloc(sizeof(*client)); - if (!client) - return NULL; + if (!client) return NULL; + + frame = e_comp_object_client_add(ec); + if (!frame) + { + free(client); + return NULL; + } client->width = 1; client->height = 1; wl_signal_init(&client->events.resize); - e_view_init(&client->view, E_VIEW_TYPE_CLIENT, (E_View_Impl*)&view_client_impl, ec->frame, parent); + e_view_init(&client->view, E_VIEW_TYPE_CLIENT, (E_View_Impl*)&view_client_impl, frame, parent); e_view_tree_init(&client->tree, &view_client_tree_impl, NULL); e_view_reorderable_set(&client->tree.view, false); @@ -270,12 +288,14 @@ e_view_client_effect_set(E_View_Client *client, const char *effect) } static void -_view_client_effect_end(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) +_view_client_effect_end(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *source) { - E_View_Client_Effect *effect = data; - E_View_Client *client = effect->client; + E_View_Client_Effect *effect; + + if (!data) return; - effect->cb(effect->data, client, emission, source); + effect = (E_View_Client_Effect *)data; + effect->cb(effect->data, effect->client, emission, source); free(effect); } @@ -343,6 +363,38 @@ e_view_client_effect_unclip(E_View_Client *client) e_comp_object_effect_unclip(client->view.eo); } +EINTERN void +e_view_client_transform_bg_vertices_set(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices) +{ + if (client == NULL) return; + + e_comp_object_transform_bg_vertices_set(client->view.eo, vertices); +} + +EINTERN void +e_view_client_transform_bg_vertices_set_with_zoom(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform_Zoom zoom) +{ + if (client == NULL) return; + + e_comp_object_transform_bg_vertices_set_with_zoom(client->view.eo, vertices, zoom); +} + +EINTERN void +e_view_client_transform_transp_vertices_set(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices) +{ + if (client == NULL) return; + + e_comp_object_transform_transp_vertices_set(client->view.eo, vertices); +} + +EINTERN void +e_view_client_transform_transp_vertices_set_with_zoom(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform_Zoom zoom) +{ + if (client == NULL) return; + + e_comp_object_transform_transp_vertices_set_with_zoom(client->view.eo, vertices, zoom); +} + E_API bool e_view_client_render(E_View_Client *client) { @@ -494,30 +546,56 @@ e_view_client_size_hint_align_get(E_View_Client *client, double *x, double *y) E_API bool e_view_client_visible_get(E_View_Client *client) { + if (client == NULL) return false; + return evas_object_visible_get(client->view.eo); //TODO : change visible get from e_view } E_API unsigned int e_view_client_is_animating(E_View_Client *client) { + if (client == NULL) return 0; + return e_comp_object_is_animating(client->view.eo); } E_API void e_view_client_hwc_update_set(E_View_Client *client, bool set) { + if (client == NULL) return; + e_comp_object_hwc_update_set(client->view.eo, set); } E_API bool +e_view_client_render_update_lock(E_View_Client *client) +{ + if (client == NULL) return false; + + return e_comp_object_render_update_lock(client->view.eo); +} + +E_API void +e_view_client_render_update_unlock(E_View_Client *client) +{ + if (client == NULL) return; + + e_comp_object_render_update_unlock(client->view.eo); +} + +E_API bool e_view_client_render_update_lock_get(E_View_Client *client) { + if (client == NULL) return false; + return e_comp_object_render_update_lock_get(client->view.eo); } E_API void e_view_client_geometry_get(E_View_Client *client, int *x, int *y, int *width, int *height) { + if (client == NULL) return; + if (width) *width = client->width; @@ -530,6 +608,8 @@ e_view_client_geometry_get(E_View_Client *client, int *x, int *y, int *width, in E_API void e_view_client_geometry_set(E_View_Client *client, int x, int y, int width, int height) { + if (client == NULL) return; + e_view_position_set(&client->view, x, y); e_view_client_size_set(client, width, height); } @@ -537,6 +617,7 @@ e_view_client_geometry_set(E_View_Client *client, int x, int y, int width, int h E_API void e_view_client_size_set(E_View_Client *client, int width, int height) { + if (client == NULL) return; if (client->width == width && client->height == height) return; @@ -549,6 +630,31 @@ e_view_client_size_set(E_View_Client *client, int width, int height) } E_API void +e_view_client_transform_bg_set(E_View_Client *client, bool set) +{ + if (client == NULL) return; + + e_comp_object_transform_bg_set(client->view.eo, set); +} + +E_API void +e_view_client_transform_bg_color_set(E_View_Client *client, int r, int g, int b, int a) +{ + if (client == NULL) return; + + e_comp_object_transform_bg_color_set(client->view.eo, r, g, b, a); +} + +E_API void +e_view_client_transform_transp_set(E_View_Client *client, bool set) +{ + if (client == NULL) return; + + e_comp_object_transform_transp_set(client->view.eo, set); +} + + +E_API void e_view_client_mask_set(E_View_Client *client, bool set) { if (client == NULL) return; @@ -599,26 +705,50 @@ e_view_client_frame_wh_unadjust(E_View_Client *client, int width, int height, in EINTERN bool e_view_client_hwc_update_exists(E_View_Client *client) { + if (client == NULL) return false; + return e_comp_object_hwc_update_exists(client->view.eo); } EINTERN bool e_view_client_redirected_get(E_View_Client *client) { + if (client == NULL) return false; + return e_comp_object_redirected_get(client->view.eo); } EINTERN void e_view_client_redirected_set(E_View_Client *client, bool set) { + if (client == NULL) return; + e_comp_object_redirected_set(client->view.eo, set); } EINTERN E_Map * e_view_client_map_get(E_View_Client *client) { + if (client == NULL) return NULL; + return e_comp_object_map_get(client->view.eo); } +E_API bool +e_view_client_map_set(E_View_Client *client, E_Map *em) +{ + if (client == NULL) return false; + + return e_comp_object_map_set(client->view.eo, em); +} + +E_API bool +e_view_client_map_enable_set(E_View_Client *client, Eina_Bool enabled) +{ + if (client == NULL) return false; + + return e_comp_object_map_enable_set(client->view.eo, enabled); +} + EINTERN void e_view_client_map_update(E_View_Client *client) { @@ -652,30 +782,40 @@ e_view_client_unfullscreen(E_View_Client *client) EINTERN void e_view_client_lower_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_lower_listener_add(client->view.eo, listener); } EINTERN void e_view_client_lower_done_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_lower_done_listener_add(client->view.eo, listener); } EINTERN void e_view_client_raise_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_raise_listener_add(client->view.eo, listener); } EINTERN void e_view_client_show_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_show_listener_add(client->view.eo, listener); } EINTERN void e_view_client_hide_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_hide_listener_add(client->view.eo, listener); } @@ -683,18 +823,24 @@ e_view_client_hide_listener_add(E_View_Client *client, struct wl_listener *liste EINTERN void e_view_client_set_layer_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_set_layer_listener_add(client->view.eo, listener); } EINTERN void e_view_client_stack_above_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_stack_above_listener_add(client->view.eo, listener); } EINTERN void e_view_client_stack_below_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_stack_below_listener_add(client->view.eo, listener); } #endif @@ -702,30 +848,40 @@ e_view_client_stack_below_listener_add(E_View_Client *client, struct wl_listener EINTERN void e_view_client_image_filter_set_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_image_filter_set_listener_add(client->view.eo, listener); } EINTERN void e_view_client_render_op_set_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_render_op_set_listener_add(client->view.eo, listener); } EINTERN void e_view_client_content_type_set_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_content_type_set_listener_add(client->view.eo, listener); } EINTERN void e_view_client_color_set_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_color_set_listener_add(client->view.eo, listener); } EINTERN void e_view_client_color_visible_set_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + e_comp_object_color_visible_set_listener_add(client->view.eo, listener); } @@ -739,42 +895,120 @@ e_view_client_recalc(E_View_Client *client) EINTERN E_View_Tree * e_view_client_tree_get(E_View_Client *client) { + if (client == NULL) return NULL; + return &client->tree; } E_API void e_view_client_resize_listener_add(E_View_Client *client, struct wl_listener *listener) { + if (client == NULL) return; + wl_signal_add(&client->events.resize, listener); } +static void +_view_client_signal_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *sig, const char *src) +{ + E_View_Client_Signal *signal; + + if (data == NULL) return; + + signal = (E_View_Client_Signal *)data; + if (signal->cb) + signal->cb(signal->data, signal->client, sig, src); +} + E_API void e_view_client_signal_emit(E_View_Client *client, const char *sig, const char *src) { + if (client == NULL) return; + e_comp_object_signal_emit(client->view.eo, sig, src); } E_API void +e_view_client_signal_callback_add(E_View_Client *client, const char *sig, const char *src, E_View_Client_Signal_Cb cb, const void *data) +{ + E_View_Client_Signal *signal; + + if (client == NULL) return; + + signal = malloc(sizeof(*signal)); + if (!signal) return; + + signal->client = client; + signal->sig = sig; + signal->src = src; + signal->cb = cb; + signal->data = (void*)data; + + wl_list_insert(client->signals.prev, &signal->link); + + e_comp_object_signal_callback_add(client->view.eo, sig, src, _view_client_signal_cb, signal); +} + +E_API void +e_view_client_signal_callback_del(E_View_Client *client, const char *sig, const char *src, E_View_Client_Signal_Cb cb) +{ + if (client == NULL) return; + + e_view_client_signal_callback_del_full(client, sig, src, cb, NULL); +} + +E_API void +e_view_client_signal_callback_del_full(E_View_Client *client, const char *sig, const char *src, E_View_Client_Signal_Cb cb, const void *data) +{ + E_View_Client_Signal *signal = NULL, *signal_tmp; + + if (client == NULL) return; + + if (wl_list_empty(&client->signals)) return; + + wl_list_for_each(signal_tmp, &client->signals, link) + { + if ((signal_tmp->sig == sig) && (signal_tmp->src == src) && (signal_tmp->cb == cb) && (signal_tmp->data == data)) + signal = signal_tmp; + } + + if (!signal) return; + + e_comp_object_signal_callback_del_full(client->view.eo, sig, src, _view_client_signal_cb, (void *)signal); + + wl_list_remove(&signal->link); + free(signal); +} + +E_API void e_view_client_input_area_set(E_View_Client *client, int x, int y, int w, int h) { + if (client == NULL) return; + e_comp_object_input_area_set(client->view.eo, x, y, w, h); } EINTERN void e_view_client_input_objs_del(E_View_Client *client) { + if (client == NULL) return; + e_comp_object_input_objs_del(client->view.eo); } EINTERN void e_view_client_clear(E_View_Client *client) { + if (client == NULL) return; + e_comp_object_clear(client->view.eo); } EINTERN void e_view_client_size_update(E_View_Client *client, int w, int h) { + if (client == NULL) return; + e_comp_object_size_update(client->view.eo, w, h); } @@ -783,6 +1017,8 @@ e_view_client_layer_set(E_View_Client *client, E_Canvas_Layer layer) { E_View_Tree *layer_tree; + if (client == NULL) return; + layer_tree = e_canvas_layer_view_tree_get(e_view_root_get(&client->view), layer); e_view_reparent(&client->view, layer_tree); evas_object_layer_set(client->view.eo, e_canvas_util_layer_map(layer)); @@ -791,6 +1027,8 @@ e_view_client_layer_set(E_View_Client *client, E_Canvas_Layer layer) EINTERN void e_view_client_show(E_View_Client *client) { + if (client == NULL) return; + if (e_view_visible_get(&client->view)) evas_object_show(client->view.eo); else @@ -801,8 +1039,26 @@ e_view_client_show(E_View_Client *client) EINTERN void e_view_client_hide(E_View_Client *client) { + if (client == NULL) return; + if (!e_view_visible_get(&client->view)) evas_object_hide(client->view.eo); else e_view_hide(&client->view); } + +EINTERN void +e_view_client_native_surface_set(E_View_Client *client, bool set) +{ + if (client == NULL) return; + + e_comp_object_native_surface_set(client->view.eo, set); +} + +EINTERN void +e_view_client_input_rect_get(E_View_Client *client, Eina_List **list) +{ + if (client == NULL) return; + + e_comp_object_input_rect_get(client->view.eo, list); +} diff --git a/src/bin/core/e_view_client_intern.h b/src/bin/core/e_view_client_intern.h index 44b6e48..8367080 100644 --- a/src/bin/core/e_view_client_intern.h +++ b/src/bin/core/e_view_client_intern.h @@ -19,6 +19,12 @@ bool e_view_client_damage_exists(E_View_Client *client); void e_view_client_dim_mask_set(E_View_Client *client, bool set); void e_view_client_effect_clip(E_View_Client *client); void e_view_client_effect_unclip(E_View_Client *client); + +void e_view_client_transform_bg_vertices_set(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices); +void e_view_client_transform_bg_vertices_set_with_zoom(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform_Zoom zoom); +void e_view_client_transform_transp_vertices_set(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices); +void e_view_client_transform_transp_vertices_set_with_zoom(E_View_Client *client, E_Util_Transform_Rect_Vertex *vertices, E_Util_Transform_Zoom zoom); + E_View_Render_Op e_view_client_render_op_get(E_View_Client *client); void e_view_client_render_op_set(E_View_Client *client, E_View_Render_Op op); bool e_view_client_frame_allowed(E_View_Client *client); @@ -54,6 +60,8 @@ void e_view_client_color_visible_set_listener_add(E_View_Client *client, struct void e_view_client_input_objs_del(E_View_Client *client); void e_view_client_clear(E_View_Client *client); void e_view_client_size_update(E_View_Client *client, int w, int h); +void e_view_client_native_surface_set(E_View_Client *client, bool set); +void e_view_client_input_rect_get(E_View_Client *client, Eina_List **list); #ifdef __cplusplus } diff --git a/src/bin/core/e_view_intern.h b/src/bin/core/e_view_intern.h index 7b4bac6..46423b2 100644 --- a/src/bin/core/e_view_intern.h +++ b/src/bin/core/e_view_intern.h @@ -111,6 +111,7 @@ struct _E_View_Client int width, height; + struct wl_list signals; struct { struct wl_signal resize; diff --git a/src/bin/displaymgr/e_output.c b/src/bin/displaymgr/e_output.c index e2a1b6b..5a8c335 100644 --- a/src/bin/displaymgr/e_output.c +++ b/src/bin/displaymgr/e_output.c @@ -15,6 +15,7 @@ #include "e_zone_intern.h" #include "e_video_debug_intern.h" #include "e_display_intern.h" +#include "e_comp_canvas.h" #include "e_view_client_intern.h" #include diff --git a/src/bin/server/e_comp_wl.c b/src/bin/server/e_comp_wl.c index 936f991..d90c2ba 100644 --- a/src/bin/server/e_comp_wl.c +++ b/src/bin/server/e_comp_wl.c @@ -61,6 +61,7 @@ #include #define E_COM_WL_PREPARE_GAP_LOG_TIME 2000 +#define E_COMP_WL_EVENT_DATA_KEY "comp_wl_event_data" /* Resource Data Mapping: (wl_resource_get_user_data) * @@ -70,7 +71,8 @@ * */ -typedef struct _E_Comp_Data E_Comp_Data; +typedef struct _E_Comp_Data E_Comp_Data; +typedef struct _E_Comp_Wl_Event_Data E_Comp_Wl_Event_Data; struct _E_Comp_Data { @@ -97,6 +99,15 @@ struct _E_Comp_Wl_Evas_Gl Evas_GL_API *glapi; }; +struct _E_Comp_Wl_Event_Data +{ + E_Client *ec; + + struct wl_listener comp_object_show; + struct wl_listener comp_object_hide; + struct wl_listener comp_object_move; +}; + static Eina_List *handlers = NULL; static E_Client *cursor_timer_ec = NULL; static Eina_Bool need_send_released = EINA_FALSE; @@ -549,6 +560,7 @@ e_comp_wl_topmost_parent_get(E_Client *ec) E_API void e_comp_wl_map_apply(E_Client *ec) { + E_View_Client *view_client; E_Comp_Wl_Buffer_Viewport *vp; E_Comp_Wl_Subsurf_Data *sdata; E_Comp_Wl_Client_Data *cdata; @@ -559,7 +571,10 @@ e_comp_wl_map_apply(E_Client *ec) if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) return; - e_view_client_map_update(e_client_view_get(ec)); + view_client = e_client_view_get(ec); + if (!view_client) return; + + e_view_client_map_update(view_client); cdata = ec->comp_data; vp = &cdata->scaler.buffer_viewport; @@ -591,7 +606,7 @@ e_comp_wl_map_apply(E_Client *ec) } } - e_view_client_geometry_get(e_client_view_get(ec), &x, &y, NULL, NULL); + e_view_client_geometry_get(view_client, &x, &y, NULL, NULL); if (x != dx || y != dy) e_subsurface_view_position_set(subsurface, dx, dy); } @@ -600,9 +615,9 @@ e_comp_wl_map_apply(E_Client *ec) dx = ec->x; dy = ec->y; - e_view_client_geometry_get(e_client_view_get(ec), &x, &y, NULL, NULL); + e_view_client_geometry_get(view_client, &x, &y, NULL, NULL); if (x != dx || y != dy) - e_view_position_set(e_view_client_view_get(e_client_view_get(ec)), dx, dy); + e_view_position_set(e_view_client_view_get(view_client), dx, dy); } if (!cdata->viewport_transform) @@ -696,13 +711,14 @@ e_comp_wl_map_inv_coord_get(E_Client *ec, int x, int y, int *mx, int *my) } static void -_e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +_e_comp_wl_view_client_cb_show(struct wl_listener *listener, void *data) { - E_Client *ec; E_Client *topmost; + E_Comp_Wl_Event_Data *ev_data = wl_container_of(listener, ev_data, comp_object_show); + E_Client *ec = ev_data->ec; - if (!(ec = data)) return; - if (e_object_is_del(data)) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->override) e_hints_window_visible_set(ec); @@ -720,13 +736,14 @@ _e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN if (!ec->comp_data->need_reparent) { + E_View_Client *view_client = e_client_view_get(ec); if ((ec->hidden) || (ec->iconic)) { - e_view_client_hide(e_client_view_get(ec)); -// e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); + e_view_client_hide(view_client); +// e_view_client_damage(view_client, 0, 0, ec->w, ec->h); } else - e_view_client_show(e_client_view_get(ec)); + e_view_client_show(view_client); } topmost = e_comp_wl_topmost_parent_get(ec); @@ -735,17 +752,18 @@ _e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN } static void -_e_comp_wl_evas_cb_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +_e_comp_wl_view_client_cb_hide(struct wl_listener *listener, void *data) { - E_Client *ec; E_Client *topmost; + E_Comp_Wl_Event_Data *ev_data = wl_container_of(listener, ev_data, comp_object_hide); + E_Client *ec = ev_data->ec; - if (!(ec = data)) return; + if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; /* Uncommonly some clients's final buffer can be skipped if the client * requests unmap of its surface right after wl_surface@commit. - * So if this client evas object is hidden state and client is already + * So if this client is hidden state and client is already * unmmapped, we can consider to clear pixmap image here mandatorily. */ if (!ec->comp_data->mapped) @@ -759,14 +777,15 @@ _e_comp_wl_evas_cb_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN } static void -_e_comp_wl_evas_cb_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_e_comp_wl_view_client_cb_move(struct wl_listener *listener, void *data) { - E_Client *ec; - E_Client *subc; Eina_List *l; + E_Client *subc; E_Subsurface *subsurface; + E_Comp_Wl_Event_Data *ev_data = wl_container_of(listener, ev_data, comp_object_move); + E_Client *ec = ev_data->ec; - if (!(ec = data)) return; + if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) @@ -2210,14 +2229,29 @@ _e_comp_wl_buffer_damage_set(E_Comp_Wl_Buffer *buffer, Eina_List *buffer_damages static void _e_comp_wl_client_evas_init(E_Client *ec) { + E_View *view; + E_View_Client *view_client; if (!ec || !ec->comp_data) return; if (ec->comp_data->evas_init) return; - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_comp_wl_evas_cb_show, ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_comp_wl_evas_cb_hide, ec); - evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_comp_wl_evas_cb_move, ec); + view_client = e_client_view_get(ec); + if (!view_client) return; + + view = e_view_client_view_get(view_client); + E_Comp_Wl_Event_Data *comp_wl_event_data = E_NEW(E_Comp_Wl_Event_Data, 1); + if (!comp_wl_event_data) return; + comp_wl_event_data->ec = ec; + comp_wl_event_data->comp_object_show.notify = _e_comp_wl_view_client_cb_show; + comp_wl_event_data->comp_object_hide.notify = _e_comp_wl_view_client_cb_hide; + comp_wl_event_data->comp_object_move.notify = _e_comp_wl_view_client_cb_move; + e_view_data_set(view, E_COMP_WL_EVENT_DATA_KEY, comp_wl_event_data); + + e_view_event_listener_add(view, E_VIEW_SHOW, &comp_wl_event_data->comp_object_show); + e_view_event_listener_add(view, E_VIEW_HIDE, &comp_wl_event_data->comp_object_hide); + e_view_event_listener_add(view, E_VIEW_MOVE, &comp_wl_event_data->comp_object_move); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_IN, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_mouse_in, ec); evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_OUT, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_mouse_out, ec); evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_MOVE, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_mouse_move, ec); @@ -2238,12 +2272,26 @@ _e_comp_wl_client_evas_init(E_Client *ec) static void _e_comp_wl_client_evas_deinit(E_Client *ec) { + E_View *view; + E_View_Client *view_client; + E_Comp_Wl_Event_Data *comp_wl_event_data; + if (!ec || !ec->comp_data) return; if (!ec->comp_data->evas_init) return; - evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_SHOW, _e_comp_wl_evas_cb_show); - evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_HIDE, _e_comp_wl_evas_cb_hide); - evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_MOVE, _e_comp_wl_evas_cb_move); + view_client = e_client_view_get(ec); + if (!view_client) return; + + view = e_view_client_view_get(view_client); + comp_wl_event_data = e_view_data_get(view, E_COMP_WL_EVENT_DATA_KEY); + if (comp_wl_event_data) + { + e_view_event_listener_del(view, E_VIEW_SHOW, &comp_wl_event_data->comp_object_show); + e_view_event_listener_del(view, E_VIEW_HIDE, &comp_wl_event_data->comp_object_hide); + e_view_event_listener_del(view, E_VIEW_MOVE, &comp_wl_event_data->comp_object_move); + e_view_data_del(view, E_COMP_WL_EVENT_DATA_KEY); + free(comp_wl_event_data); + } evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_MOUSE_IN, _e_comp_wl_evas_cb_mouse_in); evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_MOUSE_OUT, _e_comp_wl_evas_cb_mouse_out); @@ -2462,6 +2510,8 @@ _e_comp_wl_surface_state_size_update(E_Client *ec, E_Comp_Wl_Surface_State *stat { int prev_w, prev_h; Eina_Rectangle *window; + E_View_Client *view_client = e_client_view_get(ec); + if (!view_client) return; prev_w = state->bw; prev_h = state->bh; @@ -2474,20 +2524,20 @@ _e_comp_wl_surface_state_size_update(E_Client *ec, E_Comp_Wl_Surface_State *stat ec->changes.buf_size = EINA_TRUE; } - if (e_view_client_frame_exists(e_client_view_get(ec))) return; + if (e_view_client_frame_exists(view_client)) return; window = &ec->comp_data->shell.window; if ((!ec->borderless) && /* FIXME temporarily added this check code * to prevent updating E_Client's size by frame */ (window->x || window->y || window->w || window->h)) { - e_view_client_frame_geometry_set(e_client_view_get(ec), + e_view_client_frame_geometry_set(view_client, -window->x, (window->x + window->w) - state->bw, -window->y, (window->y + window->h) - state->bh); } else - e_view_client_frame_geometry_set(e_client_view_get(ec), 0, 0, 0, 0); + e_view_client_frame_geometry_set(view_client, 0, 0, 0, 0); } static void @@ -2602,9 +2652,10 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) E_Comp_Wl_Buffer *buffer; struct wl_resource *cb; Eina_List *l, *ll; + E_Zone *zone; E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; - E_Zone *zone; + E_View_Client *view_client = e_client_view_get(ec); if (ec->ignored) { @@ -2675,7 +2726,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) /* update the position */ if (ec->changes.pos) { - e_view_client_frame_xy_unadjust(e_client_view_get(ec), + e_view_client_frame_xy_unadjust(view_client, ec->x, ec->y, &x, &y); } @@ -2695,7 +2746,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) ec->client.w = state->bw; ec->client.h = state->bh; - e_view_client_frame_wh_adjust(e_client_view_get(ec), + e_view_client_frame_wh_adjust(view_client, ec->client.w, ec->client.h, &nw, &nh); e_client_size_set(ec, nw, nh); @@ -2801,7 +2852,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) buffer = e_pixmap_resource_get(ec->pixmap); /* put state damages into surface */ - if (e_client_view_get(ec)) + if (view_client) { /* FIXME: workaround for bad wayland egl driver which doesn't send damage request */ if (!eina_list_count(state->damages) && !eina_list_count(state->buffer_damages)) @@ -2810,7 +2861,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) ((cdata->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) || (cdata->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_TBM))) { - e_view_client_damage(e_client_view_get(ec), + e_view_client_damage(view_client, 0, 0, cdata->buffer_ref.buffer->w, cdata->buffer_ref.buffer->h); @@ -2846,7 +2897,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) if (state->buffer_viewport.changed || !e_comp->wl_comp_data->available_hw_accel.underlay || !buffer || buffer->type != E_COMP_WL_BUFFER_TYPE_VIDEO) - e_view_client_damage(e_client_view_get(ec), dmg->x, dmg->y, dmg->w, dmg->h); + e_view_client_damage(view_client, dmg->x, dmg->y, dmg->w, dmg->h); eina_rectangle_free(dmg); } @@ -2894,14 +2945,14 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) Eina_Rectangle *rect; Eina_Iterator *itr; - e_view_client_input_objs_del(e_client_view_get(ec)); + e_view_client_input_objs_del(view_client); itr = eina_tiler_iterator_new(src); EINA_ITERATOR_FOREACH(itr, rect) { ELOGF("COMP", "Set Input Area x:%d, y:%d, w:%d, h:%d, ec(%dx%d), state(%dx%d)", ec, rect->x, rect->y, rect->w, rect->h, ec->w, ec->h, state->bw, state->bh); - e_view_client_input_area_set(e_client_view_get(ec), + e_view_client_input_area_set(view_client, rect->x, rect->y, rect->w, rect->h); } @@ -2910,7 +2961,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) eina_tiler_free(src); } else - e_view_client_input_area_set(e_client_view_get(ec), 0, 0, ec->w, ec->h); + e_view_client_input_area_set(view_client, 0, 0, ec->w, ec->h); eina_tiler_free(tmp); @@ -2943,16 +2994,18 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) static void _e_comp_wl_surface_render_stop(E_Client *ec) { + E_View_Client *view_client = e_client_view_get(ec); + if (!view_client) return; /* FIXME: this may be fine after e_pixmap can create textures for wl clients? */ //if ((!ec->internal) && (!e_comp_gl_get())) ec->dead = 1; /* check if internal animation is running */ - if (e_view_client_is_animating(e_client_view_get(ec))) return; + if (e_view_client_is_animating(view_client)) return; /* check if external animation is running */ - if (e_view_data_get(e_view_client_view_get(e_client_view_get(ec)), "effect_running")) return; + if (e_view_data_get(e_view_client_view_get(view_client), "effect_running")) return; - e_view_client_hide(e_client_view_get(ec)); + e_view_client_hide(view_client); } EINTERN void @@ -5852,6 +5905,7 @@ static void _e_comp_wl_surface_output_viewport_get(E_Client *ec, Eina_Rectangle *out) { E_Subsurface *subsurface; + E_View_Client *view_client = e_client_view_get(ec); if (!out) return; @@ -5874,8 +5928,11 @@ _e_comp_wl_surface_output_viewport_get(E_Client *ec, Eina_Rectangle *out) out->w = (out->w + 1) & ~1; out->h = ec->comp_data->height_from_viewport; - e_view_client_frame_xy_unadjust(e_client_view_get(ec), out->x, out->y, &out->x, &out->y); - e_view_client_frame_wh_unadjust(e_client_view_get(ec), out->w, out->h, &out->w, &out->h); + if (view_client) + { + e_view_client_frame_xy_unadjust(view_client, out->x, out->y, &out->x, &out->y); + e_view_client_frame_wh_unadjust(view_client, out->w, out->h, &out->w, &out->h); + } } EINTERN Eina_Bool @@ -6074,9 +6131,13 @@ e_comp_wl_client_surface_pending_input_region_set(E_Client *ec, Eina_Tiler *regi { if (eina_tiler_empty(region)) { - ELOGF("COMP", " |unset input rect", NULL); - e_view_client_input_objs_del(e_client_view_get(ec)); - e_view_client_input_area_set(e_client_view_get(ec), -1, -1, 1, 1); + E_View_Client *view_client = e_client_view_get(ec); + if (view_client) + { + ELOGF("COMP", " |unset input rect", NULL); + e_view_client_input_objs_del(view_client); + e_view_client_input_area_set(view_client, -1, -1, 1, 1); + } } else eina_tiler_union(ec->comp_data->pending.input, region); diff --git a/src/bin/server/e_policy_wl.c b/src/bin/server/e_policy_wl.c index 009fc52..2740018 100644 --- a/src/bin/server/e_policy_wl.c +++ b/src/bin/server/e_policy_wl.c @@ -8488,7 +8488,7 @@ _e_policy_wl_client_cb_resize_end(void *data EINA_UNUSED, E_Client *ec) if (e_object_is_del(E_OBJECT(ec))) return; if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; - if (ec->manage_resize.resize_obj) + if (ec->manage_resize.resize_view) { x = ec->manage_resize.x; y = ec->manage_resize.y; diff --git a/src/bin/windowmgr/e_policy_visibility.c b/src/bin/windowmgr/e_policy_visibility.c index c0e2045..69da38a 100644 --- a/src/bin/windowmgr/e_policy_visibility.c +++ b/src/bin/windowmgr/e_policy_visibility.c @@ -2036,10 +2036,15 @@ static void _e_vis_ec_setup(E_Client *ec) { E_View *view; + E_View_Client *view_client; e_object_delay_del_set(E_OBJECT(ec), _e_vis_client_delay_del); - view = e_view_client_view_get(e_client_view_get(ec)); + view_client = e_client_view_get(ec); + if (!view_client) return; + + view = e_view_client_view_get(view_client); + ec->visibility.show_listener.notify = _e_vis_client_cb_show; e_view_event_listener_add(view, E_VIEW_SHOW, &ec->visibility.show_listener); diff --git a/src/include/e_client.h b/src/include/e_client.h index f529cd9..b967310 100644 --- a/src/include/e_client.h +++ b/src/include/e_client.h @@ -309,7 +309,7 @@ typedef enum _E_Client_Intercept_Hook_Point typedef void (*E_Client_Move_Intercept_Cb)(E_Client *, int x, int y); typedef void (*E_Client_Hook_Cb)(void *data, E_Client *ec); typedef Eina_Bool (*E_Client_Intercept_Hook_Cb)(void *data, E_Client *ec); -typedef Evas_Object* (*E_Client_Resize_Object_Create_Cb)(E_Client *ec); +typedef E_View* (*E_Client_Resize_View_Create_Cb)(E_Client *ec, int x, int y, int w, int h); #define E_CLIENT_TYPE (int)0xE0b01002 @@ -979,7 +979,7 @@ struct _E_Client { int x, y, w, h; Eina_Bool enable_aspect_ratio; - Evas_Object *resize_obj; + E_View *resize_view; float aw, ah; int header_h, footer_h; unsigned int unit_size; diff --git a/src/include/e_view_client.h b/src/include/e_view_client.h index 120f30a..a18ed25 100644 --- a/src/include/e_view_client.h +++ b/src/include/e_view_client.h @@ -33,11 +33,22 @@ void e_view_client_size_hint_align_get(E_View_Client *client, double *x, double bool e_view_client_visible_get(E_View_Client *client); unsigned int e_view_client_is_animating(E_View_Client *client); void e_view_client_hwc_update_set(E_View_Client *client, bool set); + +bool e_view_client_map_set(E_View_Client *client, E_Map *em); +bool e_view_client_map_enable_set(E_View_Client *client, Eina_Bool enabled); + +bool e_view_client_render_update_lock(E_View_Client *client); +void e_view_client_render_update_unlock(E_View_Client *client); bool e_view_client_render_update_lock_get(E_View_Client *client); + void e_view_client_geometry_get(E_View_Client *client, int *x, int *y, int *width, int *height); void e_view_client_geometry_set(E_View_Client *client, int x, int y, int width, int height); void e_view_client_size_set(E_View_Client *client, int width, int height); +void e_view_client_transform_bg_set(E_View_Client *client, bool set); +void e_view_client_transform_bg_color_set(E_View_Client *client, int r, int g, int b, int a); +void e_view_client_transform_transp_set(E_View_Client *client, bool set); + void e_view_client_mask_set(E_View_Client *client, bool set); bool e_view_client_mask_has(E_View_Client *client); @@ -49,6 +60,10 @@ void e_view_client_frame_wh_unadjust(E_View_Client *client, int width, int heigh void e_view_client_resize_listener_add(E_View_Client *client, struct wl_listener *listener); void e_view_client_signal_emit(E_View_Client *client, const char *sig, const char *src); +void e_view_client_signal_callback_add(E_View_Client *client, const char *sig, const char *src, E_View_Client_Signal_Cb cb, const void *data); +void e_view_client_signal_callback_del(E_View_Client *client, const char *sig, const char *src, E_View_Client_Signal_Cb cb); +void e_view_client_signal_callback_del_full(E_View_Client *client, const char *sig, const char *src, E_View_Client_Signal_Cb cb, const void *data); + void e_view_client_input_area_set(E_View_Client *client, int x, int y, int w, int h); #ifdef __cplusplus