From: SooChan Lim Date: Thu, 24 Sep 2020 00:00:44 +0000 (+0900) Subject: e_client: use e_client_cdata_get instead of using ec->comp_data. X-Git-Tag: submit/tizen/20201102.081405~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f6b3211a4fd1b6b9ea2d76ae0264fdba3156f4a;p=platform%2Fupstream%2Fenlightenment.git e_client: use e_client_cdata_get instead of using ec->comp_data. E20 can gets the E_Comp_Wl_Client_Data of E_Client by e_client_cdata_get function. Change-Id: Ib4b825871ad82251384dc2d44b9a16b5b6e2a498 --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 817767f86d..207c89fd8e 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -2258,6 +2258,7 @@ 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 *ec = data; + E_Comp_Wl_Client_Data *child_cdata = NULL; if (e_object_is_del(data)) return; if (ec->layer_block) return; @@ -2272,7 +2273,8 @@ _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA /* Don't stack vkbd if parent is splitted */ if (child->vkbd.vkbd && ec->layout.splited) continue; - if (child->comp_data && !child->comp_data->mapped) + child_cdata = e_client_cdata_get(child); + if (child_cdata && !child_cdata->mapped) { ELOGF("COMP", "STACK CHANGE CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", ec, child, e_client_util_win_get(child)); continue; @@ -2502,7 +2504,7 @@ _e_client_aux_hint_eval(E_Client *ec) { if (!ec) return; - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); Eina_List *l, *ll; E_Comp_Wl_Aux_Hint *hint; @@ -3117,7 +3119,7 @@ _e_client_type_get(E_Client *ec) static void _e_client_transform_sub_apply(E_Client *ec, E_Client *epc, double zoom) { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Comp_Wl_Subsurf_Data *sdata = cdata->sub.data; E_Client *subc; Eina_List *l; @@ -3336,7 +3338,7 @@ _e_client_visibility_zone_calculate(E_Zone *zone) if (ec->visibility.skip) continue; if (ec->is_cursor) continue; /* if ec is subsurface, skip this */ - cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + cdata = e_client_cdata_get(ec); if (cdata && cdata->sub.data) continue; if ((!ec->first_mapped) && (e_comp_object_content_type_get(ec->frame) == E_COMP_OBJECT_CONTENT_TYPE_INT_IMAGE)) continue; @@ -3735,15 +3737,17 @@ _e_client_transform_core_check_change(E_Client *ec) int w = 0; int h = 0; Eina_Bool check = EINA_FALSE; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return EINA_FALSE; if (ec->frame) evas_object_geometry_get(ec->frame, 0, 0, &w, &h); + cdata = e_client_cdata_get(ec); if ((ec->transform_core.transform_list) && - (ec->comp_data && ec->comp_data->sub.below_obj)) + (cdata && cdata->sub.below_obj)) { - const Evas_Map *map_ = evas_object_map_get(ec->comp_data->sub.below_obj); + const Evas_Map *map_ = evas_object_map_get(cdata->sub.below_obj); if (!map_) check = EINA_TRUE; } @@ -3802,10 +3806,8 @@ _e_client_transform_core_check_change(E_Client *ec) } // check parent matrix change - if (ec->comp_data) + if (cdata) { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->sub.data) { E_Client *parent = cdata->sub.data->parent; @@ -3969,9 +3971,9 @@ _e_client_transform_core_sub_update(E_Client *ec, E_Util_Transform_Rect_Vertex * E_Comp_Wl_Client_Data *cdata; if (!ec) return; - if (!ec->comp_data) return; - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (cdata->sub.below_obj) _e_client_transform_core_vertices_apply(ec, cdata->sub.below_obj, vertices, NULL); @@ -3989,9 +3991,9 @@ _e_client_transform_core_sub_update_with_zoom(E_Client *ec, E_Util_Transform_Rec E_Comp_Wl_Client_Data *cdata; if (!ec) return; - if (!ec->comp_data) return; - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (cdata->sub.below_obj) _e_client_transform_core_vertices_apply_with_zoom(ec, cdata->sub.below_obj, vertices, NULL, zoomx, zoomy, cx, cy); @@ -4127,7 +4129,8 @@ e_client_idler_before(void) // ignored client but needing eval (aux hint) such as remote surfaces if (ec->changed) { - if (ec->comp_data && ec->comp_data->first_commit) + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + if (cdata && cdata->first_commit) _e_client_aux_hint_eval(ec); } continue; @@ -6087,6 +6090,8 @@ e_client_iconify(E_Client *ec) E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + ELOGF("TZVIS", "ICONIFY |iconic:%d |argb:%d |not_raise:%d |by_client:%d", ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise, ec->exp_iconify.by_client); @@ -6095,7 +6100,7 @@ e_client_iconify(E_Client *ec) if (ec->shading || ec->iconic) return; if (ec->exp_iconify.skip_iconify && !ec->exp_iconify.by_client) return; if (ec->exp_iconify.skip_by_remote) return; - if (!ec->comp_data || !ec->comp_data->mapped) + if (!cdata || !cdata->mapped) { if (!ec->exp_iconify.by_client) { @@ -6146,10 +6151,12 @@ e_client_uniconify(E_Client *ec) E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d |mapped:%d", ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise, ec->exp_iconify.by_client, - ec->comp_data ? ec->comp_data->mapped : 0); + cdata ? cdata->mapped : 0); if (!ec->zone) return; if (ec->shading || (!ec->iconic)) return; @@ -6188,7 +6195,7 @@ e_client_uniconify(E_Client *ec) if (ec->pixmap && e_pixmap_usable_get(ec->pixmap)) { - if (ec->comp_data && ec->comp_data->mapped) + if (cdata && cdata->mapped) { ELOGF("TZVIS", "UNICONIFY|object show", ec); evas_object_show(ec->frame); @@ -7050,7 +7057,7 @@ E_API void e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy) { Evas_Map *map; - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Client *subc; Eina_List *l; @@ -7120,7 +7127,7 @@ e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy E_API void e_client_transform_clear(E_Client *ec) { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Client *subc; Eina_List *l; @@ -7645,6 +7652,7 @@ E_API Eina_Bool e_client_base_output_resolution_update(E_Client *ec) { E_Appinfo *eai = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; int configured_width, configured_height; int width, height; @@ -7653,12 +7661,14 @@ e_client_base_output_resolution_update(E_Client *ec) if (!e_config->configured_output_resolution.use) return EINA_TRUE; if (ec->base_output_resolution.use) return EINA_TRUE; + cdata = e_client_cdata_get(ec); + /* Check whether it's subsurface or not * The resolution of subsurface will follow the resolution of its toplevel surface. * Transform for subsurface will be applied when toplevel surface does by * implementation of e_client_transform_core. */ - if (ec->comp_data->sub.data) return EINA_FALSE; + if (cdata->sub.data) return EINA_FALSE; configured_width = e_config->configured_output_resolution.w; configured_height = e_config->configured_output_resolution.h; @@ -8137,6 +8147,8 @@ e_client_lower(E_Client *ec) E_API void e_client_stack_above(E_Client *ec, E_Client *above) { + E_Comp_Wl_Client_Data *above_cdata = NULL; + if (!ec) return; if (!ec->frame) return; if (!above) return; @@ -8170,16 +8182,21 @@ e_client_stack_above(E_Client *ec, E_Client *above) evas_object_stack_above(ec->frame, above->frame); + above_cdata = e_client_cdata_get(above); + if (!above_cdata) return; + /* Since calling evas_object_stack_above() messes up the stacking order of * sub-surface of above, it should be updated. */ - if ((above->comp_data->sub.list) && - (eina_list_count(above->comp_data->sub.list) > 0)) + if ((above_cdata->sub.list) && + (eina_list_count(above_cdata->sub.list) > 0)) e_comp_wl_subsurface_stack_update(above); } E_API void e_client_stack_below(E_Client *ec, E_Client *below) { + E_Comp_Wl_Client_Data *below_cdata = NULL; + if (!ec) return; if (!ec->frame) return; if (!below) return; @@ -8213,10 +8230,13 @@ e_client_stack_below(E_Client *ec, E_Client *below) evas_object_stack_below(ec->frame, below->frame); + below_cdata = e_client_cdata_get(below); + if (!below_cdata) return; + /* Since calling evas_object_stack_below() messes up the stacking order of * sub-surface of below, it should be updated. */ - if ((below->comp_data->sub.below_list) && - (eina_list_count(below->comp_data->sub.below_list) > 0)) + if ((below_cdata->sub.below_list) && + (eina_list_count(below_cdata->sub.below_list) > 0)) e_comp_wl_subsurface_stack_update(below); } @@ -8258,11 +8278,12 @@ _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreac E_Client *subc; Eina_List *l, *ll; Eina_Bool res = EINA_TRUE; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); - if ((e_object_is_del(E_OBJECT(ec))) || (!ec->comp_data)) + if ((e_object_is_del(E_OBJECT(ec))) || (!cdata)) return res; - EINA_LIST_FOREACH_SAFE(ec->comp_data->sub.below_list, l, ll, subc) + EINA_LIST_FOREACH_SAFE(cdata->sub.below_list, l, ll, subc) { res = _e_client_surface_tree_foreach_helper(subc, func, data); if (!res) @@ -8274,7 +8295,7 @@ _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreac res = func(data, ec); if (res) { - EINA_LIST_FOREACH_SAFE(ec->comp_data->sub.list, l, ll, subc) + EINA_LIST_FOREACH_SAFE(cdata->sub.list, l, ll, subc) { res = _e_client_surface_tree_foreach_helper(subc, func, diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index a943cc1c58..abc9ad9a35 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -646,23 +646,26 @@ static void _e_comp_object_map_transform_pos(E_Client *ec, int sx, int sy, int *dx, int *dy) { E_Comp_Wl_Buffer_Viewport *vp; + E_Comp_Wl_Client_Data *cdata = NULL; int transform; int bw, bh, tx, ty; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) + cdata = e_client_cdata_get(ec); + + if (!ec || !cdata || e_object_is_del(E_OBJECT(ec))) { *dx = sx; *dy = sy; return; } - vp = &ec->comp_data->scaler.buffer_viewport; + vp = &cdata->scaler.buffer_viewport; transform = e_comp_wl_output_buffer_transform_get(ec); e_pixmap_size_get(ec->pixmap, &bw, &bh); /* for subsurface, it should be swap 90 and 270 */ - if (ec->comp_data->sub.data) + if (cdata->sub.data) switch (transform) { case WL_OUTPUT_TRANSFORM_90: transform = WL_OUTPUT_TRANSFORM_270; break; @@ -1747,6 +1750,8 @@ static void _e_comp_intercept_layer_set(void *data, Evas_Object *obj, int layer) { E_Comp_Object *cw = data; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *child_cdata = NULL; unsigned int l = e_comp_canvas_layer_map(layer); int oldraise; @@ -1767,14 +1772,15 @@ _e_comp_intercept_layer_set(void *data, Evas_Object *obj, int layer) e_comp_render_queue(); } ec = e_client_above_get(cw->ec); + cdata = e_client_cdata_get(ec); /* skip subsurface: stacking subsurface is handled by e_comp_wl */ - while ((ec) && (ec->comp_data) && (ec->comp_data->sub.data)) + while ((ec) && (cdata) && (cdata->sub.data)) ec = e_client_above_get(ec); if (ec && (evas_object_layer_get(ec->frame) != evas_object_layer_get(obj))) { ec = e_client_below_get(cw->ec); /* skip subsurface: stacking subsurface is handled by e_comp_wl */ - while ((ec) && (ec->comp_data) && (ec->comp_data->sub.data)) + while ((ec) && (cdata) && (cdata->sub.data)) ec = e_client_below_get(ec); if (ec && (evas_object_layer_get(ec->frame) == evas_object_layer_get(cw->smart_obj))) { @@ -1823,7 +1829,8 @@ layer_set: e_config->transient.raise = 1; EINA_LIST_FREE(list, child) { - if (child->comp_data && !child->comp_data->mapped) + child_cdata = e_client_cdata_get(child); + if (child_cdata && !child_cdata->mapped) { ELOGF("COMP", "LAYER_SET CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", cw->ec, child, e_client_util_win_get(child)); continue; @@ -6072,22 +6079,27 @@ e_comp_object_map_update(Evas_Object *obj) { API_ENTRY; E_Client *ec = cw->ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Map *map; int x1, y1, x2, y2, x, y, bw, bh, tw, th; char buffer[128]; char *p = buffer; int l, remain = sizeof buffer; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) return; + if (!ec) return; + if (!e_object_is_del(E_OBJECT(ec))) return; + + cdata = e_client_cdata_get(ec); + if (!cdata) return; /* if buffer had been flushed, buffer could be NULL. Then map will be applied * when new buffer is attached. */ - if (!ec->comp_data->buffer_ref.buffer) return; + if (!cdata->buffer_ref.buffer) return; if ((!cw->redirected) || (!e_comp_wl_output_buffer_transform_get(ec) && - ec->comp_data->scaler.buffer_viewport.buffer.scale == 1)) + cdata->scaler.buffer_viewport.buffer.scale == 1)) { if (evas_object_map_enable_get(cw->effect_obj)) { @@ -6192,8 +6204,9 @@ e_comp_object_image_filter_set(Evas_Object *obj, E_Comp_Image_Filter filter) API_ENTRY EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN_VAL(cw->ec, EINA_FALSE); - if ((!cw->ec) || (!cw->ec->comp_data) || (e_object_is_del(E_OBJECT(cw->ec)))) - return EINA_FALSE; + if (!cw->ec) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(cw->ec))) return EINA_FALSE; + if (!e_client_cdata_get(cw->ec)) return EINA_FALSE; switch (filter) { @@ -6223,8 +6236,8 @@ e_comp_object_image_filter_get(Evas_Object *obj) API_ENTRY E_COMP_IMAGE_FILTER_NONE; EINA_SAFETY_ON_NULL_RETURN_VAL(cw->ec, E_COMP_IMAGE_FILTER_NONE); - if ((!cw->ec->comp_data) || (e_object_is_del(E_OBJECT(cw->ec)))) - return E_COMP_IMAGE_FILTER_NONE; + if (e_object_is_del(E_OBJECT(cw->ec))) return E_COMP_IMAGE_FILTER_NONE; + if (!e_client_cdata_get(cw->ec)) return E_COMP_IMAGE_FILTER_NONE; return cw->image_filter; } diff --git a/src/bin/e_comp_screen.c b/src/bin/e_comp_screen.c index 78ec7cac54..2c161796ab 100644 --- a/src/bin/e_comp_screen.c +++ b/src/bin/e_comp_screen.c @@ -1358,6 +1358,7 @@ E_API void e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool ignore) { E_Comp_Screen_Tzsr *tzsr = _tz_surface_rotation_find(ec); + E_Comp_Wl_Client_Data *cdata = NULL; if (!tzsr) return; @@ -1380,7 +1381,8 @@ e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool igno ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform(%d)", ec, tzsr, ignore); - tizen_screen_rotation_send_ignore_output_transform(tzsr->resource, ec->comp_data->surface, ignore); + cdata = e_client_cdata_get(ec); + tizen_screen_rotation_send_ignore_output_transform(tzsr->resource, cdata->surface, ignore); } EINTERN Eina_Bool diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 50cfd387ba..3e76459685 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -205,6 +205,7 @@ _e_comp_wl_intercept_hook_call(E_Comp_Wl_Intercept_Hook_Point hookpoint, E_Clien static void _e_comp_wl_configure_send(E_Client *ec, Eina_Bool edges, Eina_Bool send_size) { + E_Comp_Wl_Client_Data *cdata = NULL; int w, h; if (send_size) @@ -217,7 +218,8 @@ _e_comp_wl_configure_send(E_Client *ec, Eina_Bool edges, Eina_Bool send_size) else w = h = 0; - ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, + cdata = e_client_cdata_get(ec); + cdata->shell.configure_send(cdata->shell.surface, edges * e_comp_wl->resize.edges, w, h); } @@ -258,19 +260,21 @@ _e_comp_wl_cb_prepare(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED E_API enum wl_output_transform e_comp_wl_output_buffer_transform_get(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer_Viewport *vp; E_Comp_Wl_Buffer *buffer; enum wl_output_transform transform, rotation; if (!ec) return WL_OUTPUT_TRANSFORM_NORMAL; if (e_object_is_del(E_OBJECT(ec))) return WL_OUTPUT_TRANSFORM_NORMAL; - if (!ec->comp_data) return WL_OUTPUT_TRANSFORM_NORMAL; + cdata = e_client_cdata_get(ec); + if (!cdata) return WL_OUTPUT_TRANSFORM_NORMAL; - vp = &ec->comp_data->scaler.buffer_viewport; - if (ec->comp_data->sub.data) + vp = &cdata->scaler.buffer_viewport; + if (cdata->sub.data) return vp->buffer.transform; - buffer = ec->comp_data->buffer_ref.buffer; + buffer = cdata->buffer_ref.buffer; if (!buffer || (buffer->type != E_COMP_WL_BUFFER_TYPE_NATIVE && buffer->type != E_COMP_WL_BUFFER_TYPE_TBM)) @@ -294,19 +298,21 @@ e_comp_wl_output_buffer_transform_get(E_Client *ec) EINTERN enum wl_output_transform e_comp_wl_output_pending_buffer_transform_get(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer_Viewport *vp; E_Comp_Wl_Buffer *buffer; enum wl_output_transform transform, rotation; if (!ec) return WL_OUTPUT_TRANSFORM_NORMAL; if (e_object_is_del(E_OBJECT(ec))) return WL_OUTPUT_TRANSFORM_NORMAL; - if (!ec->comp_data) return WL_OUTPUT_TRANSFORM_NORMAL; + cdata = e_client_cdata_get(ec); + if (!cdata) return WL_OUTPUT_TRANSFORM_NORMAL; - vp = &ec->comp_data->pending.buffer_viewport; - if (ec->comp_data->sub.data) + vp = &cdata->pending.buffer_viewport; + if (cdata->sub.data) return vp->buffer.transform; - buffer = ec->comp_data->pending.buffer; + buffer = cdata->pending.buffer; if (!buffer || (buffer->type != E_COMP_WL_BUFFER_TYPE_NATIVE && buffer->type != E_COMP_WL_BUFFER_TYPE_TBM)) @@ -330,15 +336,21 @@ e_comp_wl_output_pending_buffer_transform_get(E_Client *ec) E_API void e_comp_wl_map_size_cal_from_buffer(E_Client *ec) { - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Buffer_Viewport *vp = NULL; E_Comp_Wl_Buffer *buffer; int32_t width, height; + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + vp = &cdata->scaler.buffer_viewport; + buffer = e_pixmap_resource_get(ec->pixmap); if (!buffer) { - ec->comp_data->width_from_buffer = 0; - ec->comp_data->height_from_buffer = 0; + cdata->width_from_buffer = 0; + cdata->height_from_buffer = 0; return; } @@ -357,25 +369,31 @@ e_comp_wl_map_size_cal_from_buffer(E_Client *ec) break; } - ec->comp_data->width_from_buffer = width; - ec->comp_data->height_from_buffer = height; + cdata->width_from_buffer = width; + cdata->height_from_buffer = height; } E_API void e_comp_wl_map_size_cal_from_viewport(E_Client *ec) { - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Buffer_Viewport *vp = NULL; int32_t width, height; - width = ec->comp_data->width_from_buffer; - height = ec->comp_data->height_from_buffer; + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + vp = &cdata->scaler.buffer_viewport; + + width = cdata->width_from_buffer; + height = cdata->height_from_buffer; if (width == 0 && height == 0) return; if (width != 0 && vp->surface.width != -1) { - ec->comp_data->width_from_viewport = vp->surface.width; - ec->comp_data->height_from_viewport = vp->surface.height; + cdata->width_from_viewport = vp->surface.width; + cdata->height_from_viewport = vp->surface.height; return; } @@ -383,30 +401,33 @@ e_comp_wl_map_size_cal_from_viewport(E_Client *ec) { int32_t w = wl_fixed_to_int(wl_fixed_from_int(1) - 1 + vp->buffer.src_width); int32_t h = wl_fixed_to_int(wl_fixed_from_int(1) - 1 + vp->buffer.src_height); - ec->comp_data->width_from_viewport = w ?: 1; - ec->comp_data->height_from_viewport = h ?: 1; + cdata->width_from_viewport = w ?: 1; + cdata->height_from_viewport = h ?: 1; return; } - ec->comp_data->width_from_viewport = width; - ec->comp_data->height_from_viewport = height; + cdata->width_from_viewport = width; + cdata->height_from_viewport = height; } E_API E_Client* e_comp_wl_topmost_parent_get(E_Client *ec) { E_Client *parent = NULL; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + E_Comp_Wl_Client_Data *parent_cdata = NULL; - if (!ec->comp_data || !ec->comp_data->sub.data) + if (!cdata || !cdata->sub.data) return ec; - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; while (parent) { - if (!parent->comp_data || !parent->comp_data->sub.data) + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata || !parent_cdata->sub.data) return parent; - parent = parent->comp_data->sub.data->parent; + parent = parent_cdata->sub.data->parent; } return ec; @@ -421,15 +442,17 @@ e_comp_wl_map_apply(E_Client *ec) int x1, y1, x2, y2, x, y; int dx, dy; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; e_comp_object_map_update(ec->frame); - vp = &ec->comp_data->scaler.buffer_viewport; + vp = &cdata->scaler.buffer_viewport; if (vp->buffer.src_width == wl_fixed_from_int(-1)) return; - cdata = ec->comp_data; - sdata = ec->comp_data->sub.data; + sdata = cdata->sub.data; if (sdata) { dx = sdata->position.x; @@ -444,10 +467,11 @@ e_comp_wl_map_apply(E_Client *ec) if (sdata->remote_surface.offscreen_parent) { E_Client *offscreen_parent = sdata->remote_surface.offscreen_parent; + E_Comp_Wl_Client_Data *off_screen_parent_cdata = e_client_cdata_get(offscreen_parent); Eina_Rectangle *rect; Eina_List *l; - EINA_LIST_FOREACH(offscreen_parent->comp_data->remote_surface.regions, l, rect) + EINA_LIST_FOREACH(off_screen_parent_cdata->remote_surface.regions, l, rect) { /* TODO: If there are one more regions, it means that provider's offscreen * is displayed by one more remote_surfaces. Have to consider it later. At @@ -476,8 +500,8 @@ e_comp_wl_map_apply(E_Client *ec) } e_util_transform_viewport_set(cdata->viewport_transform, dx, dy, - ec->comp_data->width_from_viewport, - ec->comp_data->height_from_viewport); + cdata->width_from_viewport, + cdata->height_from_viewport); x1 = wl_fixed_to_int(vp->buffer.src_x); y1 = wl_fixed_to_int(vp->buffer.src_y); @@ -490,8 +514,8 @@ e_comp_wl_map_apply(E_Client *ec) e_util_transform_texcoord_set(cdata->viewport_transform, 3, x1, y2); ELOGF("TRANSFORM", "viewport map: point(%d,%d %dx%d) uv(%d,%d %d,%d %d,%d %d,%d)", - ec, ec->x, ec->y, ec->comp_data->width_from_viewport, - ec->comp_data->height_from_viewport, x1, y1, x2, y1, x2, y2, x1, y2); + ec, ec->x, ec->y, cdata->width_from_viewport, + cdata->height_from_viewport, x1, y1, x2, y1, x2, y2, x1, y2); e_client_transform_core_update(ec); } @@ -540,18 +564,21 @@ static void _e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec, *tmp; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; E_Client *topmost; if (!(ec = data)) return; if (e_object_is_del(data)) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (!ec->override) e_hints_window_visible_set(ec); - if ((!ec->override) && (!ec->re_manage) && (!ec->comp_data->reparented) && - (!ec->comp_data->need_reparent)) + if ((!ec->override) && (!ec->re_manage) && (!cdata->reparented) && + (!cdata->need_reparent)) { - ec->comp_data->need_reparent = EINA_TRUE; + cdata->need_reparent = EINA_TRUE; ec->visible = EINA_TRUE; } if (!e_client_util_ignored_get(ec)) @@ -560,7 +587,7 @@ _e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN EC_CHANGED(ec); } - if (!ec->comp_data->need_reparent) + if (!cdata->need_reparent) { if ((ec->hidden) || (ec->iconic)) { @@ -575,40 +602,43 @@ _e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN evas_object_show(tmp->frame); topmost = e_comp_wl_topmost_parent_get(ec); - if (topmost == ec && (ec->comp_data->sub.list || ec->comp_data->sub.below_list)) + if (topmost == ec && (cdata->sub.list || cdata->sub.below_list)) e_comp_wl_subsurface_show(ec); - if (ec->comp_data->sub.below_obj) - evas_object_show(ec->comp_data->sub.below_obj); + if (cdata->sub.below_obj) + evas_object_show(cdata->sub.below_obj); } static void _e_comp_wl_evas_cb_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec, *tmp; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; E_Client *topmost; if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) 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 * unmmapped, we can consider to clear pixmap image here mandatorily. */ - if (!ec->comp_data->mapped) + if (!cdata->mapped) e_pixmap_image_clear(ec->pixmap, 1); EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp) evas_object_hide(tmp->frame); topmost = e_comp_wl_topmost_parent_get(ec); - if (topmost == ec && (ec->comp_data->sub.list || ec->comp_data->sub.below_list)) + if (topmost == ec && (cdata->sub.list || cdata->sub.below_list)) e_comp_wl_subsurface_hide(ec); - if (ec->comp_data->sub.below_obj) - evas_object_hide(ec->comp_data->sub.below_obj); + if (cdata->sub.below_obj) + evas_object_hide(cdata->sub.below_obj); } static void @@ -616,44 +646,48 @@ _e_comp_wl_evas_cb_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U { E_Client *ec; E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *subc_cdata = NULL; Eina_List *l; int x, y; if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { - if (!subc->comp_data || !subc->comp_data->sub.data) continue; - x = ec->x + subc->comp_data->sub.data->position.x; - y = ec->y + subc->comp_data->sub.data->position.y; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata || !subc_cdata->sub.data) continue; + x = ec->x + subc_cdata->sub.data->position.x; + y = ec->y + subc_cdata->sub.data->position.y; evas_object_move(subc->frame, x, y); - if (subc->comp_data->scaler.viewport) + if (subc_cdata->scaler.viewport) { - E_Comp_Wl_Client_Data *cdata = subc->comp_data; - if (cdata->viewport_transform) + if (subc_cdata->viewport_transform) e_comp_wl_map_apply(subc); } } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { - if (!subc->comp_data || !subc->comp_data->sub.data) continue; - x = ec->x + subc->comp_data->sub.data->position.x; - y = ec->y + subc->comp_data->sub.data->position.y; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata || !subc_cdata->sub.data) continue; + x = ec->x + subc_cdata->sub.data->position.x; + y = ec->y + subc_cdata->sub.data->position.y; evas_object_move(subc->frame, x, y); - if (subc->comp_data->scaler.viewport) + if (subc_cdata->scaler.viewport) { - E_Comp_Wl_Client_Data *cdata = subc->comp_data; - if (cdata->viewport_transform) + if (subc_cdata->viewport_transform) e_comp_wl_map_apply(subc); } } - if (ec->comp_data->sub.below_obj) - evas_object_move(ec->comp_data->sub.below_obj, ec->x, ec->y); + if (cdata->sub.below_obj) + evas_object_move(cdata->sub.below_obj, ec->x, ec->y); } static void @@ -663,13 +697,15 @@ _e_comp_wl_send_touch_cancel(E_Client *ec) struct wl_resource *res; struct wl_client *wc; E_Comp_Config *comp_conf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata|| !cdata->surface) return; if ((ec->ignored) && (!ec->remote_surface.provider)) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); comp_conf = e_comp_config_get(); @@ -736,14 +772,15 @@ _e_comp_wl_device_last_device_set(Ecore_Device_Class dev_class, E_Devicemgr_Inpu static E_Devicemgr_Input_Device * _e_comp_wl_device_client_last_device_get(E_Client *ec, Ecore_Device_Class dev_class) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); switch (dev_class) { case ECORE_DEVICE_CLASS_MOUSE: - return ec->comp_data->last_device_ptr; + return cdata->last_device_ptr; case ECORE_DEVICE_CLASS_KEYBOARD: - return ec->comp_data->last_device_kbd; + return cdata->last_device_kbd; case ECORE_DEVICE_CLASS_TOUCH: - return ec->comp_data->last_device_touch; + return cdata->last_device_touch; default: return NULL;; } @@ -753,16 +790,17 @@ _e_comp_wl_device_client_last_device_get(E_Client *ec, Ecore_Device_Class dev_cl static void _e_comp_wl_device_client_last_device_set(E_Client *ec, Ecore_Device_Class dev_class, E_Devicemgr_Input_Device *device) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); switch (dev_class) { case ECORE_DEVICE_CLASS_MOUSE: - ec->comp_data->last_device_ptr = device; + cdata->last_device_ptr = device; break; case ECORE_DEVICE_CLASS_KEYBOARD: - ec->comp_data->last_device_kbd = device; + cdata->last_device_kbd = device; break; case ECORE_DEVICE_CLASS_TOUCH: - ec->comp_data->last_device_touch = device; + cdata->last_device_touch = device; break; default: break; @@ -779,6 +817,7 @@ _e_comp_wl_device_send_event_device(E_Client *ec, Evas_Device *dev, uint32_t tim struct wl_client *wc; uint32_t serial; Eina_List *l, *ll; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN(dev); @@ -787,7 +826,8 @@ _e_comp_wl_device_send_event_device(E_Client *ec, Evas_Device *dev, uint32_t tim return; if (e_object_is_del(E_OBJECT(ec))) return; if ((ec->ignored) && (!ec->remote_surface.provider)) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; dev_class = (Ecore_Device_Class)evas_device_class_get(dev); dev_name = evas_device_description_get(dev); @@ -795,7 +835,7 @@ _e_comp_wl_device_send_event_device(E_Client *ec, Evas_Device *dev, uint32_t tim ec_last_device = _e_comp_wl_device_client_last_device_get(ec, dev_class); serial = wl_display_next_serial(e_comp_wl->wl.disp); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(e_devicemgr->device_list, l, input_dev) { if (!eina_streq(input_dev->identifier, dev_name) || (input_dev->clas != dev_class)) continue; @@ -821,8 +861,10 @@ _e_comp_wl_device_send_last_event_device(E_Client *ec, Ecore_Device_Class dev_cl struct wl_client *wc; uint32_t serial; Eina_List *l; + E_Comp_Wl_Client_Data *cdata = NULL; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; last_device = _e_comp_wl_device_last_device_get(dev_class); if (!last_device) return; @@ -830,7 +872,7 @@ _e_comp_wl_device_send_last_event_device(E_Client *ec, Ecore_Device_Class dev_cl _e_comp_wl_device_client_last_device_set(ec, dev_class, last_device); serial = wl_display_next_serial(e_comp_wl->wl.disp); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(last_device->resources, l, dev_res) { if (wl_resource_get_client(dev_res) != wc) continue; @@ -872,13 +914,15 @@ _e_comp_wl_cursor_reload(E_Client *ec) Eina_List *l; uint32_t serial; int cx, cy, px, py; + E_Comp_Wl_Client_Data *cdata = NULL; if (e_comp->pointer->o_ptr && (!evas_object_visible_get(e_comp->pointer->o_ptr))) e_pointer_object_set(e_comp->pointer, NULL, 0, 0); if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; px = wl_fixed_to_int(e_comp_wl->ptr.x); py = wl_fixed_to_int(e_comp_wl->ptr.y); @@ -894,13 +938,13 @@ _e_comp_wl_cursor_reload(E_Client *ec) cx = px - ec->client.x; cy = py - ec->client.y; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; - wl_pointer_send_enter(res, serial, ec->comp_data->surface, + wl_pointer_send_enter(res, serial, cdata->surface, wl_fixed_from_int(cx), wl_fixed_from_int(cy)); ec->pointer_enter_sent = EINA_TRUE; } @@ -924,13 +968,15 @@ _e_comp_wl_device_send_axis(const char *dev_name, Evas_Device_Class dev_class, E struct wl_client *wc; Eina_List *l, *ll; wl_fixed_t f_value; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; f_value = wl_fixed_from_double(value); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(e_devicemgr->device_list, l, input_dev) { @@ -1038,12 +1084,13 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj struct wl_client *wc; Eina_List *l; uint32_t serial; + E_Comp_Wl_Client_Data *cdata = NULL; ev = event; if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; - - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; e_comp_wl->ptr.ec = ec; if (e_comp_wl->drag) @@ -1059,7 +1106,7 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj } if (!eina_list_count(e_comp_wl->ptr.resources)) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { @@ -1068,7 +1115,7 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj _e_comp_wl_device_send_last_event_device(ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp); - wl_pointer_send_enter(res, serial, ec->comp_data->surface, + wl_pointer_send_enter(res, serial, cdata->surface, wl_fixed_from_int(ev->canvas.x - ec->client.x), wl_fixed_from_int(ev->canvas.y - ec->client.y)); ec->pointer_enter_sent = EINA_TRUE; @@ -1079,6 +1126,7 @@ static void _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Event_Mouse_Out *ev; struct wl_resource *res; struct wl_client *wc; @@ -1109,8 +1157,8 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob if (e_comp_wl->ptr.ec == ec) e_comp_wl->ptr.ec = NULL; if (e_object_is_del(E_OBJECT(ec))) return; - - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; if (e_comp_wl->drag) { @@ -1126,7 +1174,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob if (!eina_list_count(e_comp_wl->ptr.resources)) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { @@ -1136,7 +1184,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob _e_comp_wl_device_send_last_event_device(ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp); - wl_pointer_send_leave(res, serial, ec->comp_data->surface); + wl_pointer_send_leave(res, serial, cdata->surface); } ec->pointer_enter_sent = EINA_FALSE; } @@ -1150,12 +1198,14 @@ _e_comp_wl_send_touch(E_Client *ec, int idx, int canvas_x, int canvas_y, uint32_ wl_fixed_t x, y; uint32_t serial; E_Comp_Config *comp_conf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); if (pressed) @@ -1176,7 +1226,7 @@ _e_comp_wl_send_touch(E_Client *ec, int idx, int canvas_x, int canvas_y, uint32_ if (comp_conf && comp_conf->input_log_enable) ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d, name:%20s)", ec, idx, timestamp, canvas_x - ec->client.x, canvas_y - ec->client.y, e_client_util_name_get(ec)); - wl_touch_send_down(res, serial, timestamp, ec->comp_data->surface, idx, x, y); //id 0 for the 1st finger + wl_touch_send_down(res, serial, timestamp, cdata->surface, idx, x, y); //id 0 for the 1st finger } else { @@ -1196,12 +1246,14 @@ _e_comp_wl_send_touch_move(E_Client *ec, int idx, int canvas_x, int canvas_y, ui struct wl_client *wc; struct wl_resource *res; wl_fixed_t x, y; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); x = wl_fixed_from_int(canvas_x - ec->client.x); y = wl_fixed_from_int(canvas_y - ec->client.y); @@ -1220,12 +1272,14 @@ _e_comp_wl_send_mouse_move(E_Client *ec, int x, int y, unsigned int timestamp) struct wl_resource *res; struct wl_client *wc; Eina_List *l; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; @@ -1264,6 +1318,7 @@ static void _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Event_Mouse_Move *ev; Evas_Device *dev = NULL; const char *dev_name; @@ -1277,7 +1332,8 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (ec->cur_mouse_action) return; if (e_object_is_del(E_OBJECT(ec))) return; if ((ec->ignored) && (!ec->remote_surface.provider)) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; if ((!need_send_motion) && (!need_send_released) && (ec->visibility.obscured == E_VISIBILITY_FULLY_OBSCURED)) return; @@ -1322,9 +1378,12 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o static void _e_comp_wl_evas_handle_mouse_button_to_touch(E_Client *ec, uint32_t timestamp, int canvas_x, int canvas_y, Eina_Bool flag) { + E_Comp_Wl_Client_Data *cdata = NULL; + if (ec->cur_mouse_action || e_comp_wl->drag) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; if ((ec->ignored) && (!ec->remote_surface.provider)) return; e_comp_wl->ptr.button = BTN_LEFT; @@ -1451,6 +1510,7 @@ finish: static void _e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, int timestamp) { + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; struct wl_client *wc; Eina_List *l; @@ -1468,9 +1528,10 @@ _e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, int timestamp) if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; @@ -1483,6 +1544,7 @@ static void _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Event_Mouse_Wheel *ev; ev = event; @@ -1491,7 +1553,8 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object * if (e_object_is_del(E_OBJECT(ec))) return; if ((ec->ignored) && (!ec->remote_surface.provider)) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; if (!eina_list_count(e_comp_wl->ptr.resources)) return; @@ -1505,6 +1568,7 @@ static void _e_comp_wl_evas_cb_multi_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event) { E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Event_Multi_Down *ev = event; Evas_Device *dev = NULL; const char *dev_name; @@ -1513,7 +1577,8 @@ _e_comp_wl_evas_cb_multi_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; /* Do not deliver emulated single touch events to client */ if (ev->device == 0) return; @@ -1541,6 +1606,7 @@ static void _e_comp_wl_evas_cb_multi_up(void *data, Evas *evas, Evas_Object *obj EINA_UNUSED, void *event) { E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Event_Multi_Up *ev = event; Evas_Device *dev = NULL; const char *dev_name; @@ -1550,7 +1616,8 @@ _e_comp_wl_evas_cb_multi_up(void *data, Evas *evas, Evas_Object *obj EINA_UNUSED if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; /* Do not deliver emulated single touch events to client */ if (ev->device == 0) return; @@ -1583,6 +1650,7 @@ static void _e_comp_wl_evas_cb_multi_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Event_Multi_Move *ev = event; Evas_Device *dev = NULL; const char *dev_name; @@ -1590,7 +1658,8 @@ _e_comp_wl_evas_cb_multi_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; /* Do not deliver emulated single touch events to client */ if (ev->device == 0) return; @@ -1680,6 +1749,7 @@ _e_comp_wl_client_priority_normal(E_Client *ec) static Eina_Bool _e_comp_wl_evas_cb_focus_in_timer(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; uint32_t serial; E_Comp_Wl_Key_Data *k; struct wl_resource *res; @@ -1688,9 +1758,10 @@ _e_comp_wl_evas_cb_focus_in_timer(E_Client *ec) if (!ec) return EINA_FALSE; if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; - if (!ec->comp_data) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; - ec->comp_data->on_focus_timer = NULL; + cdata->on_focus_timer = NULL; if (!e_comp_wl->kbd.focused) return EINA_FALSE; serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -1716,12 +1787,15 @@ EINTERN void e_comp_wl_feed_focus_in(E_Client *ec) { E_Client *focused; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; struct wl_client *wc; Eina_List *l; if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (ec->iconic) return; /* block spurious focus events */ @@ -1731,7 +1805,7 @@ e_comp_wl_feed_focus_in(E_Client *ec) /* raise client priority */ _e_comp_wl_client_priority_raise(ec); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(e_comp_wl->kbd.resources, l, res) { @@ -1743,10 +1817,10 @@ e_comp_wl_feed_focus_in(E_Client *ec) } if (!e_comp_wl->kbd.focused) return; - e_comp_wl->kbd.focus = ec->comp_data->surface; + e_comp_wl->kbd.focus = cdata->surface; e_comp_wl_input_keyboard_enter_send(ec); e_comp_wl_data_device_keyboard_focus_set(); - ec->comp_data->on_focus_timer = + cdata->on_focus_timer = ecore_timer_add(((e_config->xkb.delay_held_key_input_to_focus)/1000.0), (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec); int rotation = ec->e.state.rot.ang.curr; @@ -1766,6 +1840,7 @@ static void _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; uint32_t serial; E_Comp_Wl_Key_Data *k; @@ -1774,9 +1849,10 @@ _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob if (!(ec = data)) return; - if (!ec->comp_data) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); + E_FREE_FUNC(cdata->on_focus_timer, ecore_timer_del); /* lower client priority */ if (!e_object_is_del(data)) @@ -1787,7 +1863,7 @@ _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob wl_array_for_each(k, &e_comp_wl->kbd.keys) e_comp_wl_input_keyboard_state_update(k->key, EINA_FALSE); - if (!ec->comp_data->surface) return; + if (!cdata->surface) return; if (!eina_list_count(e_comp_wl->kbd.resources)) return; @@ -1803,7 +1879,7 @@ _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob wl_keyboard_send_key(res, serial, t, k->key, WL_KEYBOARD_KEY_STATE_RELEASED); } - wl_keyboard_send_leave(res, serial, ec->comp_data->surface); + wl_keyboard_send_leave(res, serial, cdata->surface); e_comp_wl->kbd.focused = eina_list_remove_list(e_comp_wl->kbd.focused, l); } @@ -1813,11 +1889,13 @@ static void _e_comp_wl_evas_cb_resize(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = data)) return; - if ((ec->shading) || (ec->shaded)) return; - if (!ec->comp_data->shell.configure_send) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->shell.configure_send) return; /* TODO: calculate x, y with transfrom object */ if ((e_client_util_resizing_get(ec)) && (!ec->transformed) && (e_comp_wl->resize.edges)) @@ -1863,38 +1941,47 @@ _e_comp_wl_evas_cb_resize(void *data, Evas_Object *obj EINA_UNUSED, void *event } x = E_CLAMP(x, 1, x); y = E_CLAMP(y, 1, y); - ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, + cdata->shell.configure_send(cdata->shell.surface, e_comp_wl->resize.edges, x, y); } else if ((!ec->fullscreen) && (!ec->maximized) && - (!ec->comp_data->maximize_pre)) + (!cdata->maximize_pre)) _e_comp_wl_configure_send(ec, 1, 1); - if (ec->comp_data->sub.below_obj) - evas_object_resize(ec->comp_data->sub.below_obj, ec->w, ec->h); + if (cdata->sub.below_obj) + evas_object_resize(cdata->sub.below_obj, ec->w, ec->h); } static void _e_comp_wl_evas_cb_state_update(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; /* check for wayland pixmap */ - if (ec->comp_data->shell.configure_send) + if (cdata->shell.configure_send) _e_comp_wl_configure_send(ec, 0, 0); - ec->comp_data->maximize_pre = 0; + cdata->maximize_pre = 0; } static void _e_comp_wl_evas_cb_maximize_pre(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; - ec->comp_data->maximize_pre = 1; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + cdata->maximize_pre = 1; } static void @@ -1917,14 +2004,17 @@ _e_comp_wl_evas_cb_delete_request(void *data, Evas_Object *obj EINA_UNUSED, void static void _e_comp_wl_evas_cb_kill_request(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { - E_Client *ec; + E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; - if (!(ec = data)) return; + if (!ec) return; e_comp_ignore_win_del(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ec->pixmap)); - if (ec->comp_data) + + cdata = e_client_cdata_get(ec); + if (cdata) { - if (ec->comp_data->reparented) + if (cdata->reparented) e_client_comp_hidden_set(ec, EINA_TRUE); } @@ -1938,14 +2028,16 @@ _e_comp_wl_evas_cb_kill_request(void *data, Evas_Object *obj EINA_UNUSED, void * static void _e_comp_wl_evas_cb_ping(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { - E_Client *ec; + E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; - if (!(ec = data)) return; - if (!(ec->comp_data)) return; - if (!(ec->comp_data->shell.ping)) return; - if (!(ec->comp_data->shell.surface)) return; + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->shell.ping) return; + if (!cdata->shell.surface) return; - ec->comp_data->shell.ping(ec->comp_data->shell.surface); + cdata->shell.ping(cdata->shell.surface); } static void @@ -2040,8 +2132,12 @@ _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) { - if (!ec || !ec->comp_data) return; - if (ec->comp_data->evas_init) return; + E_Comp_Wl_Client_Data *cdata = NULL; + + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (cdata->evas_init) return; /* Workaround: * Updating stack order of subsurface has to be done for safety, because @@ -2091,7 +2187,7 @@ _e_comp_wl_client_evas_init(E_Client *ec) evas_object_smart_callback_add(ec->frame, "ping", _e_comp_wl_evas_cb_ping, ec); evas_object_smart_callback_add(ec->frame, "color_set", _e_comp_wl_evas_cb_color_set, ec); - ec->comp_data->evas_init = EINA_TRUE; + cdata->evas_init = EINA_TRUE; } static Eina_Bool @@ -2147,6 +2243,7 @@ static Eina_Bool _e_comp_wl_cb_comp_object_add(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Comp_Object *ev) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; /* try to get the client from the object */ if (!(ec = e_comp_object_client_get(ev->comp_object))) @@ -2160,7 +2257,8 @@ _e_comp_wl_cb_comp_object_add(void *data EINA_UNUSED, int type EINA_UNUSED, E_Ev return ECORE_CALLBACK_RENEW; /* if we have not setup evas callbacks for this client, do it */ - if (!ec->comp_data->evas_init) _e_comp_wl_client_evas_init(ec); + cdata = e_client_cdata_get(ec); + if (!cdata->evas_init) _e_comp_wl_client_evas_init(ec); return ECORE_CALLBACK_RENEW; } @@ -2173,10 +2271,11 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou if (e_comp_wl->selection.target && e_comp_wl->drag) { + E_Comp_Wl_Client_Data *selection_target_cdata = e_client_cdata_get(e_comp_wl->selection.target); struct wl_resource *res; int x, y; - res = e_comp_wl_data_find_for_client(wl_resource_get_client(e_comp_wl->selection.target->comp_data->surface)); + res = e_comp_wl_data_find_for_client(wl_resource_get_client(selection_target_cdata->surface)); EINA_SAFETY_ON_NULL_RETURN_VAL(res, ECORE_CALLBACK_RENEW); x = ev->x - e_comp_wl->selection.target->client.x; @@ -2211,15 +2310,17 @@ static Eina_Bool _e_comp_wl_cb_client_rot_change_begin(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Rotation_Change_Begin *ev) { E_Client *ec = ev->ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer_Viewport *vp; if (!ec) return ECORE_CALLBACK_PASS_ON; if (e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_PASS_ON; - if (!ec->comp_data) return ECORE_CALLBACK_PASS_ON; - if (ec->comp_data->sub.data) return ECORE_CALLBACK_PASS_ON; + cdata = e_client_cdata_get(ec); + if (!cdata) return ECORE_CALLBACK_PASS_ON; + if (cdata->sub.data) return ECORE_CALLBACK_PASS_ON; if (ec->e.state.rot.ang.next < 0) return ECORE_CALLBACK_PASS_ON; - vp = &ec->comp_data->scaler.buffer_viewport; + vp = &cdata->scaler.buffer_viewport; vp->wait_for_transform_change = ((360 + ec->e.state.rot.ang.next - ec->e.state.rot.ang.curr) % 360) / 90; DBG("ec(%p) wait_for_transform_change(%d)", ec, vp->wait_for_transform_change); @@ -2231,14 +2332,16 @@ static Eina_Bool _e_comp_wl_cb_client_rot_change_cancel(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Rotation_Change_Cancel *ev) { E_Client *ec = ev->ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer_Viewport *vp; if (!ec) return ECORE_CALLBACK_PASS_ON; if (e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_PASS_ON; - if (!ec->comp_data) return ECORE_CALLBACK_PASS_ON; - if (ec->comp_data->sub.data) return ECORE_CALLBACK_PASS_ON; + cdata = e_client_cdata_get(ec); + if (!cdata) return ECORE_CALLBACK_PASS_ON; + if (cdata->sub.data) return ECORE_CALLBACK_PASS_ON; - vp = &ec->comp_data->scaler.buffer_viewport; + vp = &cdata->scaler.buffer_viewport; vp->wait_for_transform_change = 0; DBG("ec(%p) wait_for_transform_change(%d) reset", ec, vp->wait_for_transform_change); @@ -2265,6 +2368,7 @@ _e_comp_wl_cb_client_rot_change_end(void *d EINA_UNUSED, int t EINA_UNUSED, E_Ev static void _e_comp_wl_surface_state_size_update(E_Client *ec, E_Comp_Wl_Surface_State *state) { + E_Comp_Wl_Client_Data *cdata = NULL; int prev_w, prev_h; Eina_Rectangle *window; @@ -2280,7 +2384,8 @@ _e_comp_wl_surface_state_size_update(E_Client *ec, E_Comp_Wl_Surface_State *stat } if (e_comp_object_frame_exists(ec->frame)) return; - window = &ec->comp_data->shell.window; + cdata = e_client_cdata_get(ec); + window = &cdata->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)) @@ -2379,12 +2484,13 @@ _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_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; if (ec->ignored) { if ((ec->internal) || - (ec->comp_data->shell.surface && state->new_attach)) + (cdata->shell.surface && state->new_attach)) { EC_CHANGED(ec); ec->new_client = 1; @@ -2423,7 +2529,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) } } - ec->comp_data->scaler.buffer_viewport = state->buffer_viewport; + cdata->scaler.buffer_viewport = state->buffer_viewport; if (state->new_attach) { @@ -2432,8 +2538,8 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) } /* emit a apply_viewport signal when the information of viewport and buffer is ready */ - wl_signal_emit(&ec->comp_data->apply_viewport_signal, - &ec->comp_data->surface); + wl_signal_emit(&cdata->apply_viewport_signal, + &cdata->surface); _e_comp_wl_surface_state_buffer_set(state, NULL); @@ -2489,10 +2595,10 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) if (!e_pixmap_usable_get(ec->pixmap)) { /* unmap ec */ - if (ec->comp_data->mapped) + if (cdata->mapped) { - if ((ec->comp_data->shell.surface) && - (ec->comp_data->shell.unmap)) + if ((cdata->shell.surface) && + (cdata->shell.unmap)) { ELOGF("COMP", "Try to unmap. Call shell.unmap.", ec); if (ec->show_pending.count > 0) @@ -2508,37 +2614,37 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) } ec->show_pending.running = EINA_FALSE; } - ec->comp_data->shell.unmap(ec->comp_data->shell.surface); + cdata->shell.unmap(cdata->shell.surface); } else if ((ec->internal) || - (ec->comp_data->sub.data) || + (cdata->sub.data) || (ec == e_comp_wl->drag_client)) { ELOGF("COMP", "Try to unmap. Hide window. internal:%d, sub:%p, drag:%d", - ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client)); + ec, ec->internal, cdata->sub.data, (ec == e_comp_wl->drag_client)); ec->visible = EINA_FALSE; evas_object_hide(ec->frame); - ec->comp_data->mapped = 0; + cdata->mapped = 0; } } - if ((ec->comp_data->sub.below_obj) && - (evas_object_visible_get(ec->comp_data->sub.below_obj))) + if ((cdata->sub.below_obj) && + (evas_object_visible_get(cdata->sub.below_obj))) { - evas_object_hide(ec->comp_data->sub.below_obj); + evas_object_hide(cdata->sub.below_obj); } } else { /* map ec */ - if (!ec->comp_data->mapped) + if (!cdata->mapped) { - if ((ec->comp_data->shell.surface) && - (ec->comp_data->shell.map) && + if ((cdata->shell.surface) && + (cdata->shell.map) && (!ec->ignored)) { ELOGF("COMP", "Try to map. Call shell.map.", ec); - ec->comp_data->shell.map(ec->comp_data->shell.surface); + cdata->shell.map(cdata->shell.surface); } else if ((ec->internal) || (e_comp_wl_subsurface_can_show(ec)) || @@ -2549,23 +2655,23 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) ec->visible = EINA_TRUE; ec->ignored = 0; evas_object_show(ec->frame); - ec->comp_data->mapped = 1; + cdata->mapped = 1; } } - if ((ec->comp_data->sub.below_obj) && - (!evas_object_visible_get(ec->comp_data->sub.below_obj)) && + if ((cdata->sub.below_obj) && + (!evas_object_visible_get(cdata->sub.below_obj)) && (evas_object_visible_get(ec->frame))) { - evas_object_show(ec->comp_data->sub.below_obj); + evas_object_show(cdata->sub.below_obj); } } if ((state->new_attach) || (state->buffer_viewport.changed)) { - if ((ec->comp_data->shell.surface) && - (ec->comp_data->shell.configure)) + if ((cdata->shell.surface) && + (cdata->shell.configure)) { e_comp_wl_commit_sync_configure(ec); } @@ -2598,7 +2704,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) } } - if (ec->comp_data->scaler.buffer_viewport.changed) + if (cdata->scaler.buffer_viewport.changed) { if (e_comp_wl->touch.pressed && !e_policy_client_is_keyboard_sub(ec)) e_comp_wl_touch_cancel(); @@ -2614,20 +2720,19 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) state->sy = 0; state->new_attach = EINA_FALSE; - EINA_LIST_FOREACH_SAFE(ec->comp_data->frames, l, ll, cb) + EINA_LIST_FOREACH_SAFE(cdata->frames, l, ll, cb) { wl_callback_send_done(cb, (unsigned int)(ecore_loop_time_get() * 1000)); wl_resource_destroy(cb); } - /* insert state frame callbacks into comp_data->frames + /* insert state frame callbacks into cdata->frames * NB: This clears state->frames list */ - ec->comp_data->frames = eina_list_merge(ec->comp_data->frames, - state->frames); + cdata->frames = eina_list_merge(cdata->frames, state->frames); state->frames = NULL; - e_presentation_time_container_feedback_discard(&ec->comp_data->presentation_container); - e_presentation_time_container_feedback_merge(&ec->comp_data->presentation_container, + e_presentation_time_container_feedback_discard(&cdata->presentation_container); + e_presentation_time_container_feedback_merge(&cdata->presentation_container, &state->presentation_container); buffer = e_pixmap_resource_get(ec->pixmap); @@ -2638,14 +2743,14 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) /* 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)) { - if ((ec->comp_data->buffer_ref.buffer) && - ((ec->comp_data->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) || - (ec->comp_data->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_TBM))) + if ((cdata->buffer_ref.buffer) && + ((cdata->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) || + (cdata->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_TBM))) { e_comp_object_damage(ec->frame, 0, 0, - ec->comp_data->buffer_ref.buffer->w, - ec->comp_data->buffer_ref.buffer->h); + cdata->buffer_ref.buffer->w, + cdata->buffer_ref.buffer->h); } } else @@ -2754,7 +2859,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state) e_comp_wl_subsurface_check_below_bg_rectangle(ec); - if ((ec->comp_data->video_client) && + if ((cdata->video_client) && ((buffer) && (buffer->type == E_COMP_WL_BUFFER_TYPE_VIDEO)) && (e_comp->wl_comp_data->available_hw_accel.underlay)) @@ -2783,10 +2888,13 @@ static void _e_comp_wl_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *buffer_resource, int32_t sx, int32_t sy) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer *buffer = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (buffer_resource) { @@ -2798,10 +2906,10 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_res } } - if (!ec->comp_data->mapped) + if (!cdata->mapped) { - if (ec->comp_data->shell.surface && - !ec->internal && !ec->comp_data->sub.data && !ec->remote_surface.provider) + if (cdata->shell.surface && + !ec->internal && !cdata->sub.data && !ec->remote_surface.provider) { ELOGF("COMP", "Current unmapped. ATTACH buffer:%p", ec, buffer); } @@ -2809,39 +2917,42 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_res if (!buffer) { - if (ec->comp_data->mapped) + if (cdata->mapped) { /* will be unmapped. so run capture */ e_comp_wl_remote_surface_image_save(ec); } } - _e_comp_wl_surface_state_buffer_set(&ec->comp_data->pending, buffer); + _e_comp_wl_surface_state_buffer_set(&cdata->pending, buffer); - ec->comp_data->pending.sx = sx; - ec->comp_data->pending.sy = sy; - ec->comp_data->pending.new_attach = EINA_TRUE; + cdata->pending.sx = sx; + cdata->pending.sy = sy; + cdata->pending.new_attach = EINA_TRUE; } static void _e_comp_wl_surface_cb_damage(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Rectangle *dmg = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (!(dmg = eina_rectangle_new(x, y, w, h))) return; - ec->comp_data->pending.damages = - eina_list_append(ec->comp_data->pending.damages, dmg); + cdata->pending.damages = eina_list_append(cdata->pending.damages, dmg); } static void _e_comp_wl_frame_cb_destroy(struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; if (!(ec = wl_resource_get_user_data(resource))) return; @@ -2850,21 +2961,16 @@ _e_comp_wl_frame_cb_destroy(struct wl_resource *resource) if (!e_object_delay_del_ref_get(E_OBJECT(ec))) return; } - if (!ec->comp_data) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data->frames) - { - ec->comp_data->frames = - eina_list_remove(ec->comp_data->frames, resource); - } + if (cdata->frames) + cdata->frames = eina_list_remove(cdata->frames, resource); - if (ec->comp_data->pending.frames) - { - ec->comp_data->pending.frames = - eina_list_remove(ec->comp_data->pending.frames, resource); - } + if (cdata->pending.frames) + cdata->pending.frames = eina_list_remove(cdata->pending.frames, resource); - sdata = ec->comp_data->sub.data; + sdata = cdata->sub.data; if ((sdata) && (sdata->cached.frames)) { sdata->cached.frames = @@ -2876,10 +2982,13 @@ static void _e_comp_wl_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, uint32_t callback) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; /* create frame callback */ if (!(res = @@ -2891,20 +3000,22 @@ _e_comp_wl_surface_cb_frame(struct wl_client *client, struct wl_resource *resour wl_resource_set_implementation(res, NULL, ec, _e_comp_wl_frame_cb_destroy); - ec->comp_data->pending.frames = - eina_list_prepend(ec->comp_data->pending.frames, res); + cdata->pending.frames = eina_list_prepend(cdata->pending.frames, res); } static void _e_comp_wl_surface_cb_opaque_region_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data->pending.opaque) - eina_tiler_clear(ec->comp_data->pending.opaque); + if (cdata->pending.opaque) + eina_tiler_clear(cdata->pending.opaque); if (region_resource) { Eina_Tiler *tmp; @@ -2912,9 +3023,9 @@ _e_comp_wl_surface_cb_opaque_region_set(struct wl_client *client EINA_UNUSED, st if (!(tmp = wl_resource_get_user_data(region_resource))) return; - eina_tiler_union(ec->comp_data->pending.opaque, tmp); + eina_tiler_union(cdata->pending.opaque, tmp); - if (!eina_tiler_empty(ec->comp_data->pending.opaque)) + if (!eina_tiler_empty(cdata->pending.opaque)) { if (ec->argb) { @@ -2941,12 +3052,15 @@ static void _e_comp_wl_surface_cb_input_region_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data->pending.input) - eina_tiler_clear(ec->comp_data->pending.input); + if (cdata->pending.input) + eina_tiler_clear(cdata->pending.input); if (region_resource) { Eina_Tiler *tmp; @@ -2961,11 +3075,11 @@ _e_comp_wl_surface_cb_input_region_set(struct wl_client *client EINA_UNUSED, str e_comp_object_input_area_set(ec->frame, -1, -1, 1, 1); } else - eina_tiler_union(ec->comp_data->pending.input, tmp); + eina_tiler_union(cdata->pending.input, tmp); } else { - eina_tiler_rect_add(ec->comp_data->pending.input, + eina_tiler_rect_add(cdata->pending.input, &(Eina_Rectangle){0, 0, ec->client.w, ec->client.h}); } } @@ -2974,19 +3088,22 @@ static void _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) { E_Client *ec, *subc; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; E_Comp_Config *comp_conf = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (!ec->comp_data->first_commit) - ec->comp_data->first_commit = EINA_TRUE; + if (!cdata->first_commit) + cdata->first_commit = EINA_TRUE; - if (!ec->comp_data->mapped) + if (!cdata->mapped) { - if (ec->comp_data->shell.surface && ec->comp_data->pending.new_attach && - !ec->internal && !ec->comp_data->sub.data && !ec->remote_surface.provider) + if (cdata->shell.surface && cdata->pending.new_attach && + !ec->internal && !cdata->sub.data && !ec->remote_surface.provider) { ELOGF("COMP", "Current unmapped. COMMIT. pixmap_usable:%d", ec, e_pixmap_usable_get(ec->pixmap)); @@ -3005,13 +3122,13 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res e_comp_wl_surface_commit(ec); - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { if (ec != subc) e_comp_wl_subsurface_parent_commit(subc, EINA_FALSE); } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { if (ec != subc) e_comp_wl_subsurface_parent_commit(subc, EINA_FALSE); @@ -3022,9 +3139,12 @@ static void _e_comp_wl_surface_cb_buffer_transform_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t transform) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (transform < 0 || transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) { @@ -3035,17 +3155,20 @@ _e_comp_wl_surface_cb_buffer_transform_set(struct wl_client *client EINA_UNUSED, return; } - ec->comp_data->pending.buffer_viewport.buffer.transform = transform; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.buffer.transform = transform; + cdata->pending.buffer_viewport.changed = 1; } static void _e_comp_wl_surface_cb_buffer_scale_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t scale) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (scale < 1) { @@ -3056,23 +3179,25 @@ _e_comp_wl_surface_cb_buffer_scale_set(struct wl_client *client EINA_UNUSED, str return; } - ec->comp_data->pending.buffer_viewport.buffer.scale = scale; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.buffer.scale = scale; + cdata->pending.buffer_viewport.changed = 1; } static void _e_comp_wl_surface_cb_damage_buffer(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Rectangle *dmg = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (!(dmg = eina_rectangle_new(x, y, w, h))) return; - ec->comp_data->pending.buffer_damages = - eina_list_append(ec->comp_data->pending.buffer_damages, dmg); + cdata->pending.buffer_damages = eina_list_append(cdata->pending.buffer_damages, dmg); } static const struct wl_surface_interface _e_surface_interface = @@ -3108,24 +3233,27 @@ static void _e_comp_wl_surface_destroy(struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; Eina_List *l, *ll; if (!(ec = wl_resource_get_user_data(resource))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (ec == e_client_focused_get()) { EINA_LIST_FOREACH_SAFE(e_comp_wl->kbd.focused, l, ll, res) { if (wl_resource_get_client(res) == - wl_resource_get_client(ec->comp_data->surface)) + wl_resource_get_client(cdata->surface)) e_comp_wl->kbd.focused = eina_list_remove_list(e_comp_wl->kbd.focused, l); } } - ec->comp_data->surface = NULL; - ec->comp_data->wl_surface = NULL; + cdata->surface = NULL; + cdata->wl_surface = NULL; e_pixmap_win_id_del(ec->pixmap); _e_comp_wl_surface_render_stop(ec); @@ -3203,6 +3331,7 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso } if (ec) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); if (!ec->netwm.pid) ec->netwm.pid = pid; if (ec->new_client) @@ -3210,7 +3339,7 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso ec->new_client = 0; if ((!ec->client.w) && (ec->client.h)) ec->client.w = ec->client.h = 1; - ec->comp_data->surface = res; + cdata->surface = res; ec->icccm.accepts_focus = 1; } @@ -3497,6 +3626,7 @@ static void _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec) { Ecore_Window win; + E_Comp_Wl_Client_Data *cdata = NULL; /* make sure this is a wayland client */ if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; @@ -3515,17 +3645,18 @@ _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec) return; } - if (!(ec->comp_data = E_NEW(E_Comp_Client_Data, 1))) + if (!(cdata = E_NEW(E_Comp_Wl_Client_Data, 1))) { ERR("Could not allocate new client data structure"); TRACE_DS_END(); return; } + ec->comp_data = cdata; - wl_signal_init(&ec->comp_data->destroy_signal); - wl_signal_init(&ec->comp_data->apply_viewport_signal); + wl_signal_init(&cdata->destroy_signal); + wl_signal_init(&cdata->apply_viewport_signal); - _e_comp_wl_surface_state_init(&ec->comp_data->pending, ec->w, ec->h); + _e_comp_wl_surface_state_init(&cdata->pending, ec->w, ec->h); /* set initial client properties */ ec->argb = EINA_FALSE; @@ -3540,23 +3671,23 @@ _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec) ec->icccm.delete_request = EINA_TRUE; /* set initial client data properties */ - ec->comp_data->mapped = EINA_FALSE; - ec->comp_data->first_damage = ec->internal; + cdata->mapped = EINA_FALSE; + cdata->first_damage = ec->internal; - ec->comp_data->need_reparent = !ec->internal; + cdata->need_reparent = !ec->internal; /* set initial value of scaler */ - ec->comp_data->scaler.buffer_viewport.buffer.transform = WL_OUTPUT_TRANSFORM_NORMAL; - ec->comp_data->scaler.buffer_viewport.buffer.scale = 1; - ec->comp_data->scaler.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); - ec->comp_data->scaler.buffer_viewport.surface.width = -1; + cdata->scaler.buffer_viewport.buffer.transform = WL_OUTPUT_TRANSFORM_NORMAL; + cdata->scaler.buffer_viewport.buffer.scale = 1; + cdata->scaler.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); + cdata->scaler.buffer_viewport.surface.width = -1; - e_presentation_time_container_init(&ec->comp_data->presentation_container); + e_presentation_time_container_init(&cdata->presentation_container); - E_Comp_Client_Data *p_cdata = e_pixmap_cdata_get(ec->pixmap); + E_Comp_Wl_Client_Data *p_cdata = e_pixmap_cdata_get(ec->pixmap); EINA_SAFETY_ON_NULL_GOTO(p_cdata, end); - e_pixmap_cdata_set(ec->pixmap, ec->comp_data); + e_pixmap_cdata_set(ec->pixmap, cdata); end: TRACE_DS_END(); @@ -3565,7 +3696,7 @@ end: static void _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec) { - /* Eina_Rectangle *dmg; */ + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *cb; /* make sure this is a wayland client */ @@ -3573,18 +3704,19 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec) TRACE_DS_BEGIN(COMP_WL:CLIENT DEL CB); - if ((!ec->already_unparented) && (ec->comp_data->reparented)) + cdata = e_client_cdata_get(ec); + if ((!ec->already_unparented) && (cdata->reparented)) _e_comp_wl_focus_down_set(ec); ec->already_unparented = EINA_TRUE; - if (ec->comp_data->reparented) + if (cdata->reparented) { /* reset pixmap parent window */ e_pixmap_parent_window_set(ec->pixmap, 0); } - if (ec->comp_data->sub.watcher) - wl_resource_destroy(ec->comp_data->sub.watcher); + if (cdata->sub.watcher) + wl_resource_destroy(cdata->sub.watcher); if ((ec->parent) && (ec->parent->modal == ec)) { @@ -3592,29 +3724,29 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec) ec->parent->modal = NULL; } - wl_signal_emit(&ec->comp_data->destroy_signal, &ec->comp_data->surface); + wl_signal_emit(&cdata->destroy_signal, &cdata->surface); - _e_comp_wl_surface_state_finish(&ec->comp_data->pending); + _e_comp_wl_surface_state_finish(&cdata->pending); - e_comp_wl_buffer_reference(&ec->comp_data->buffer_ref, NULL); + e_comp_wl_buffer_reference(&cdata->buffer_ref, NULL); - EINA_LIST_FREE(ec->comp_data->frames, cb) + EINA_LIST_FREE(cdata->frames, cb) wl_resource_destroy(cb); - EINA_LIST_FREE(ec->comp_data->pending.frames, cb) + EINA_LIST_FREE(cdata->pending.frames, cb) wl_resource_destroy(cb); - if (ec->comp_data->surface) - wl_resource_set_user_data(ec->comp_data->surface, NULL); + if (cdata->surface) + wl_resource_set_user_data(cdata->surface, NULL); if (ec->internal_elm_win) _e_comp_wl_surface_render_stop(ec); _e_comp_wl_focus_check(); - if (ec->comp_data->aux_hint.hints) + if (cdata->aux_hint.hints) { E_Comp_Wl_Aux_Hint *hint; - EINA_LIST_FREE(ec->comp_data->aux_hint.hints, hint) + EINA_LIST_FREE(cdata->aux_hint.hints, hint) { eina_stringshare_del(hint->hint); eina_stringshare_del(hint->val); @@ -3628,23 +3760,24 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec) cursor_timer_ec = NULL; } - if (e_comp_wl->selection.cbhm == ec->comp_data->surface) + if (e_comp_wl->selection.cbhm == cdata->surface) e_comp_wl->selection.cbhm = NULL; - if (ec->comp_data->viewport_transform) + if (cdata->viewport_transform) { - e_client_transform_core_remove(ec, ec->comp_data->viewport_transform); - e_util_transform_del(ec->comp_data->viewport_transform); - ec->comp_data->viewport_transform = NULL; + e_client_transform_core_remove(ec, cdata->viewport_transform); + e_util_transform_del(cdata->viewport_transform); + cdata->viewport_transform = NULL; } - e_presentation_time_container_finish(&ec->comp_data->presentation_container); + e_presentation_time_container_finish(&cdata->presentation_container); e_pixmap_cdata_set(ec->pixmap, NULL); - E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); + E_FREE_FUNC(cdata->on_focus_timer, ecore_timer_del); - E_FREE(ec->comp_data); + E_FREE(cdata); + ec->comp_data = NULL; _e_comp_wl_focus_check(); @@ -3654,33 +3787,37 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec) static void _e_comp_wl_client_cb_focus_set(void *data EINA_UNUSED, E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + if (!cdata) return; if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; /* send configure */ - if (ec->comp_data->shell.configure_send) + if (cdata->shell.configure_send) { - if (ec->comp_data->shell.surface) + if (cdata->shell.surface) _e_comp_wl_configure_send(ec, 0, 0); } - e_comp_wl->kbd.focus = ec->comp_data->surface; + e_comp_wl->kbd.focus = cdata->surface; } static void _e_comp_wl_client_cb_focus_unset(void *data EINA_UNUSED, E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + if (!cdata) return; if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; /* send configure */ - if (ec->comp_data->shell.configure_send) + if (cdata->shell.configure_send) { - if (ec->comp_data->shell.surface) + if (cdata->shell.surface) _e_comp_wl_configure_send(ec, 0, 0); } _e_comp_wl_focus_check(); - if (e_comp_wl->kbd.focus == ec->comp_data->surface) + if (e_comp_wl->kbd.focus == cdata->surface) e_comp_wl->kbd.focus = NULL; } @@ -3745,8 +3882,9 @@ _e_comp_wl_client_usable_get(pid_t pid, E_Pixmap *ep) if (ec) { E_Pixmap *oldep = NULL; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); - if (ec->comp_data) + if (cdata) { /* do NOT replace with the client having comp data */ return NULL; @@ -3767,7 +3905,7 @@ _e_comp_wl_client_usable_get(pid_t pid, E_Pixmap *ep) /* to set-up comp data */ _e_comp_wl_client_cb_new(NULL, ec); ec->ignored = 0; - if (!ec->comp_data) return NULL; + if (!cdata) return NULL; _e_comp_wl_client_evas_init(ec); ELOGF("COMP", "Reusable ec. new_pixmap:%p", ec, ec->pixmap); @@ -4317,14 +4455,16 @@ e_comp_wl_surface_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev) EINTERN void e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Event_Client *ev; ev = E_NEW(E_Event_Client, 1); if (!ev) return; - e_comp_wl_buffer_reference(&ec->comp_data->buffer_ref, buffer); + cdata = e_client_cdata_get(ec); + e_comp_wl_buffer_reference(&cdata->buffer_ref, buffer); /* set usable early because shell module checks this */ - if (ec->comp_data->shell.surface || ec->comp_data->sub.data) + if (cdata->shell.surface || cdata->sub.data) e_pixmap_usable_set(ec->pixmap, (buffer != NULL)); e_pixmap_resource_set(ec->pixmap, buffer); @@ -4332,7 +4472,7 @@ e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer) e_pixmap_refresh(ec->pixmap); e_comp_wl_map_size_cal_from_buffer(ec); - _e_comp_wl_surface_state_size_update(ec, &ec->comp_data->pending); + _e_comp_wl_surface_state_size_update(ec, &cdata->pending); /* wm-policy module uses it */ _e_comp_wl_hook_call(E_COMP_WL_HOOK_BUFFER_CHANGE, ec); @@ -4346,13 +4486,15 @@ e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer) E_API Eina_Bool e_comp_wl_surface_commit(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Bool ignored; int x = 0, y = 0; - _e_comp_wl_surface_state_commit(ec, &ec->comp_data->pending); + cdata = e_client_cdata_get(ec); + _e_comp_wl_surface_state_commit(ec, &cdata->pending); if (!e_comp_object_damage_exists(ec->frame)) { - if ((ec->comp_data->video_client) || + if ((cdata->video_client) || (!e_client_video_hw_composition_check(ec))) e_pixmap_image_clear(ec->pixmap, 1); } @@ -4366,36 +4508,36 @@ e_comp_wl_surface_commit(E_Client *ec) if (!e_pixmap_usable_get(ec->pixmap)) { - if (ec->comp_data->mapped) + if (cdata->mapped) { - if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap)) + if ((cdata->shell.surface) && (cdata->shell.unmap)) { ELOGF("COMP", "Try to unmap2. Call shell.unmap.", ec); - ec->comp_data->shell.unmap(ec->comp_data->shell.surface); + cdata->shell.unmap(cdata->shell.surface); } - else if (e_client_has_xwindow(ec) || ec->internal || ec->comp_data->sub.data || + else if (e_client_has_xwindow(ec) || ec->internal || cdata->sub.data || (ec == e_comp_wl->drag_client)) { ELOGF("COMP", "Try to unmap2. Hide window. internal:%d, sub:%p, drag:%d", - ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client)); + ec, ec->internal, cdata->sub.data, (ec == e_comp_wl->drag_client)); ec->visible = EINA_FALSE; evas_object_hide(ec->frame); - ec->comp_data->mapped = 0; + cdata->mapped = 0; } } - if (ec->comp_data->sub.below_obj && evas_object_visible_get(ec->comp_data->sub.below_obj)) - evas_object_hide(ec->comp_data->sub.below_obj); + if (cdata->sub.below_obj && evas_object_visible_get(cdata->sub.below_obj)) + evas_object_hide(cdata->sub.below_obj); } else { - if (!ec->comp_data->mapped) + if (!cdata->mapped) { - if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.map) && + if ((cdata->shell.surface) && (cdata->shell.map) && (!ec->ignored)) { ELOGF("COMP", "Try to map2. Call shell.map.", ec); - ec->comp_data->shell.map(ec->comp_data->shell.surface); + cdata->shell.map(cdata->shell.surface); } else if (e_client_has_xwindow(ec) || ec->internal || e_comp_wl_subsurface_can_show(ec) || (ec == e_comp_wl->drag_client)) @@ -4405,13 +4547,13 @@ e_comp_wl_surface_commit(E_Client *ec) ec->visible = EINA_TRUE; ec->ignored = 0; evas_object_show(ec->frame); - ec->comp_data->mapped = 1; + cdata->mapped = 1; } } - if (ec->comp_data->sub.below_obj && !evas_object_visible_get(ec->comp_data->sub.below_obj) + if (cdata->sub.below_obj && !evas_object_visible_get(cdata->sub.below_obj) && evas_object_visible_get(ec->frame)) - evas_object_show(ec->comp_data->sub.below_obj); + evas_object_show(cdata->sub.below_obj); } ec->ignored = ignored; @@ -4494,6 +4636,7 @@ EINTERN E_Comp_Wl_Buffer * e_comp_wl_buffer_get(struct wl_resource *resource, E_Client *ec) { E_Comp_Wl_Buffer *buffer = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_listener *listener; struct wl_shm_buffer *shmbuff; Eina_Bool res; @@ -4525,7 +4668,8 @@ e_comp_wl_buffer_get(struct wl_resource *resource, E_Client *ec) } else { - if ((ec) && (ec->comp_data->video_client)) + cdata = e_client_cdata_get(ec); + if ((ec) && (cdata->video_client)) { buffer->type = E_COMP_WL_BUFFER_TYPE_VIDEO; buffer->w = buffer->h = 1; @@ -4598,7 +4742,8 @@ e_comp_wl_buffer_get(struct wl_resource *resource, E_Client *ec) if (!tbm_surf) goto err; - if ((ec) && (ec->comp_data->video_client)) + cdata = e_client_cdata_get(ec); + if ((ec) && (cdata->video_client)) { buffer->type = E_COMP_WL_BUFFER_TYPE_VIDEO; buffer->w = buffer->h = 1; @@ -4814,6 +4959,7 @@ _e_comp_wl_key_send(Ecore_Event_Key *ev, enum wl_keyboard_key_state state, Eina_ uint32_t serial, keycode; struct wl_client *wc = NULL; E_Comp_Config *comp_conf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; keycode = (ev->keycode - 8); @@ -4821,8 +4967,8 @@ _e_comp_wl_key_send(Ecore_Event_Key *ev, enum wl_keyboard_key_state state, Eina_ comp_conf = e_comp_config_get(); - if (ec && ec->comp_data && ec->comp_data->surface) - wc = wl_resource_get_client(ec->comp_data->surface); + if (ec && (cdata = e_client_cdata_get(ec)) && cdata->surface) + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(key_list, l, res) { @@ -4844,6 +4990,7 @@ EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev) { E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; uint32_t keycode; E_Comp_Wl_Key_Data *end, *k; @@ -4882,7 +5029,7 @@ e_comp_wl_key_down(Ecore_Event_Key *ev) if ((!e_client_action_get()) && (!e_comp->input_key_grabs)) { ec = e_client_focused_get(); - if (ec && ec->comp_data && ec->comp_data->surface && e_comp_wl->kbd.focused) + if (ec && (cdata = e_client_cdata_get(ec)) && cdata->surface && e_comp_wl->kbd.focused) { _e_comp_wl_key_send(ev, WL_KEYBOARD_KEY_STATE_PRESSED, e_comp_wl->kbd.focused, ec); @@ -4979,6 +5126,7 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu uint32_t serial, btn; struct wl_resource *res; E_Comp_Config *comp_conf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; if (ec->cur_mouse_action || e_comp_wl->drag) return EINA_FALSE; @@ -4995,12 +5143,13 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu e_comp_wl->ptr.button = btn; - if (!ec->comp_data || !ec->comp_data->surface) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return EINA_FALSE; if (!eina_list_count(e_comp_wl->ptr.resources)) return EINA_TRUE; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); comp_conf = e_comp_config_get(); @@ -5160,16 +5309,18 @@ e_comp_wl_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *d uint32_t serial, wl_keycode; enum wl_keyboard_key_state state; E_Comp_Config *comp_conf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); wl_keycode = keycode - 8; EINA_SAFETY_ON_TRUE_RETURN_VAL(wl_keycode <= 0, EINA_FALSE); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); if (!time) time = (uint32_t)(ecore_time_get() * 1000); if (pressed) state = WL_KEYBOARD_KEY_STATE_PRESSED; @@ -5202,10 +5353,12 @@ e_comp_wl_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, uint32_t time Eina_List *l; uint32_t serial, wl_keycode, cancel_keycode; E_Comp_Config *comp_conf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl->xkb.keymap, EINA_FALSE); @@ -5220,7 +5373,7 @@ e_comp_wl_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, uint32_t time wl_keycode = keycode - 8; EINA_SAFETY_ON_TRUE_RETURN_VAL(wl_keycode <= 0, EINA_FALSE); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); if (!time) time = (uint32_t)(ecore_time_get() * 1000); @@ -5253,15 +5406,17 @@ e_comp_wl_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Eco struct wl_client *wc; uint32_t serial; E_Devicemgr_Input_Device *device = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); if (!dev) device = _e_comp_wl_device_last_device_get(ECORE_DEVICE_CLASS_TOUCH); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); if (!time) time = (uint32_t)(ecore_time_get() * 1000); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -5290,15 +5445,17 @@ e_comp_wl_touch_update_send(E_Client *ec, int idx, int x, int y, Ecore_Device *d E_Devicemgr_Input_Device *device; uint32_t serial; struct wl_client *wc; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); if (!dev) device = _e_comp_wl_device_last_device_get(ECORE_DEVICE_CLASS_TOUCH); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); if (!time) time = (uint32_t)(ecore_time_get() * 1000); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -5324,8 +5481,11 @@ e_comp_wl_touch_update_send(E_Client *ec, int idx, int x, int y, Ecore_Device *d EINTERN Eina_Bool e_comp_wl_touch_cancel_send(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); _e_comp_wl_send_touch_cancel(ec); @@ -5338,13 +5498,15 @@ e_comp_wl_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_ { uint32_t serial; struct wl_client *wc; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); if (!time) time = (uint32_t)(ecore_time_get() * 1000); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -5366,13 +5528,15 @@ e_comp_wl_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_ { uint32_t serial; struct wl_client *wc; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); if (!time) time = (uint32_t)(ecore_time_get() * 1000); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -5392,13 +5556,15 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev { uint32_t serial; struct wl_client *wc; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); if (!time) time = (uint32_t)(ecore_time_get() * 1000); serial = wl_display_next_serial(e_comp_wl->wl.disp); @@ -5417,15 +5583,17 @@ e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t struct wl_client *wc; struct wl_resource *res; Eina_List *l; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE); if (!eina_list_count(e_comp_wl->ptr.resources)) return EINA_FALSE; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { @@ -5435,7 +5603,7 @@ e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial); else _e_comp_wl_device_send_last_event_device(ec, ECORE_DEVICE_CLASS_MOUSE, time); - wl_pointer_send_enter(res, serial, ec->comp_data->surface, + wl_pointer_send_enter(res, serial, cdata->surface, wl_fixed_from_int(x), wl_fixed_from_int(y)); } @@ -5446,6 +5614,7 @@ e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t EINTERN Eina_Bool e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time) { + E_Comp_Wl_Client_Data *cdata = NULL; uint32_t serial; struct wl_client *wc; struct wl_resource *res; @@ -5453,12 +5622,13 @@ e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time) EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata->surface, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE); if (!eina_list_count(e_comp_wl->ptr.resources)) return EINA_FALSE; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { @@ -5468,7 +5638,7 @@ e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time) if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial); else _e_comp_wl_device_send_last_event_device(ec, ECORE_DEVICE_CLASS_MOUSE, time); - wl_pointer_send_leave(res, serial, ec->comp_data->surface); + wl_pointer_send_leave(res, serial, cdata->surface); } return EINA_TRUE; @@ -5531,6 +5701,7 @@ e_comp_wl_mouse_out_renew(E_Client *ec, int buttons, int x, int y, void *data, E EINTERN Eina_Bool e_comp_wl_cursor_hide(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; struct wl_client *wc; Eina_List *l; @@ -5547,16 +5718,17 @@ e_comp_wl_cursor_hide(E_Client *ec) if (!ec) return EINA_FALSE; if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return EINA_FALSE; - if (!ec->comp_data || !ec->comp_data->surface) return EINA_FALSE; - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; if (ec->pointer_enter_sent == EINA_FALSE) continue; - wl_pointer_send_leave(res, serial, ec->comp_data->surface); + wl_pointer_send_leave(res, serial, cdata->surface); ec->pointer_enter_sent = EINA_FALSE; } @@ -5725,7 +5897,9 @@ e_comp_wl_output_find(E_Client *ec) Eina_List *l; E_Comp_Wl_Output *output; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) return NULL; + if (!ec) return NULL; + if (e_object_is_del(E_OBJECT(ec))) return NULL; + if (!e_client_cdata_get(ec)) return NULL; EINA_LIST_FOREACH(e_comp_wl->outputs, l, output) { @@ -5768,7 +5942,7 @@ _e_comp_wl_surface_state_serial_update(E_Client *ec, E_Comp_Wl_Surface_State *st if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data) return; + if (!e_client_cdata_get(ec)) return; buffer = state->buffer; if (!buffer) return; @@ -5827,6 +6001,7 @@ ret: EINTERN Eina_Bool e_comp_wl_commit_sync_configure(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; E_Client_Pending_Geometry *geo; E_Client_Demand_Geometry change = 0; @@ -5838,6 +6013,8 @@ e_comp_wl_commit_sync_configure(E_Client *ec) if (!ec || !ec->frame) goto ret; if (e_object_is_del(E_OBJECT(ec))) goto ret; + cdata = e_client_cdata_get(ec); + if (!cdata) goto ret; bw = bh = 0; config.x = ec->x; config.y = ec->y; config.w = ec->w; config.h = ec->h; @@ -5890,10 +6067,9 @@ e_comp_wl_commit_sync_configure(E_Client *ec) // cw interceptor(move,resize) won't work if wait_commit is TRUE ec->surface_sync.wait_commit = EINA_FALSE; - if ((ec->comp_data->shell.surface) && - (ec->comp_data->shell.configure)) + if (cdata->shell.surface && cdata->shell.configure) { - ec->comp_data->shell.configure(ec->comp_data->shell.surface, + cdata->shell.configure(cdata->shell.surface, ec->x, ec->y, ec->w, ec->h); } @@ -6238,15 +6414,17 @@ _transform_merge_with_rotation(enum wl_output_transform transform, unsigned int static void _e_comp_wl_surface_output_viewport_get(E_Client *ec, Eina_Rectangle *out) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata = NULL; if (!out) return; - if (!ec->comp_data) + cdata = e_client_cdata_get(ec); + if (!cdata) return; - sdata = ec->comp_data->sub.data; + sdata = cdata->sub.data; if (sdata) { if (sdata->parent) @@ -6266,9 +6444,9 @@ _e_comp_wl_surface_output_viewport_get(E_Client *ec, Eina_Rectangle *out) out->y = ec->y; } - out->w = ec->comp_data->width_from_viewport; + out->w = cdata->width_from_viewport; out->w = (out->w + 1) & ~1; - out->h = ec->comp_data->height_from_viewport; + out->h = cdata->height_from_viewport; e_comp_object_frame_xy_unadjust(ec->frame, out->x, out->y, &out->x, &out->y); e_comp_object_frame_wh_unadjust(ec->frame, out->w, out->h, &out->w, &out->h); @@ -6277,6 +6455,7 @@ _e_comp_wl_surface_output_viewport_get(E_Client *ec, Eina_Rectangle *out) EINTERN Eina_Bool e_comp_wl_surface_viewport_get(E_Client *ec, Eina_Rectangle *buffer_viewport, Eina_Rectangle *output_viewport, unsigned int *transform) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer *buffer; E_Comp_Wl_Buffer_Viewport *vp; const Evas_Map *m; @@ -6289,11 +6468,14 @@ e_comp_wl_surface_viewport_get(E_Client *ec, Eina_Rectangle *buffer_viewport, Ei if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; - vp = &ec->comp_data->scaler.buffer_viewport; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; + + vp = &cdata->scaler.buffer_viewport; if (buffer_viewport) { - buffer = ec->comp_data->buffer_ref.buffer; + buffer = cdata->buffer_ref.buffer; /* Getting a viewport of buffer needs geometry of buffer. */ if (!buffer) return EINA_FALSE; diff --git a/src/bin/e_comp_wl_capture.c b/src/bin/e_comp_wl_capture.c index 4d7d977ce1..a5c1e6f79e 100644 --- a/src/bin/e_comp_wl_capture.c +++ b/src/bin/e_comp_wl_capture.c @@ -1273,6 +1273,7 @@ _e_capture_client_child_data_check(Thread_Data *td) Eina_List *list, *l; E_Client *ec = NULL; E_Client *child_ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; ec = td->ec; if (!ec) return EINA_FALSE; @@ -1282,8 +1283,9 @@ _e_capture_client_child_data_check(Thread_Data *td) EINA_LIST_FOREACH(list, l, child_ec) { if (e_object_is_del(E_OBJECT(child_ec))) continue; - if (!child_ec->comp_data) continue; - if (!child_ec->comp_data->mapped) continue; + cdata = e_client_cdata_get(child_ec); + if (!cdata) continue; + if (!cdata->mapped) continue; if (child_ec->iconic && child_ec->exp_iconify.by_client) continue; diff --git a/src/bin/e_comp_wl_data.c b/src/bin/e_comp_wl_data.c index be3b7b72bc..7457f15af6 100644 --- a/src/bin/e_comp_wl_data.c +++ b/src/bin/e_comp_wl_data.c @@ -387,8 +387,8 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped) if (e_comp_wl->selection.target && (!dropped)) { struct wl_resource *res; - - res = e_comp_wl_data_find_for_client(wl_resource_get_client(e_comp_wl->selection.target->comp_data->surface)); + E_Comp_Wl_Client_Data *selection_target_cdata = e_client_cdata_get(e_comp_wl->selection.target); + res = e_comp_wl_data_find_for_client(wl_resource_get_client(selection_target_cdata->surface)); if (res) { wl_data_device_send_drop(res); @@ -748,10 +748,13 @@ e_comp_wl_data_device_send_enter(E_Client *ec) struct wl_resource *data_device_res, *offer_res; uint32_t serial; int x, y; + E_Comp_Wl_Client_Data *cdata = NULL; + + cdata = e_client_cdata_get(ec); { data_device_res = - e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); + e_comp_wl_data_find_for_client(wl_resource_get_client(cdata->surface)); if (!data_device_res) return; offer_res = e_comp_wl_data_device_send_offer(ec); if (e_comp_wl->drag_source) @@ -775,7 +778,7 @@ e_comp_wl_data_device_send_enter(E_Client *ec) x = wl_fixed_to_int(e_comp_wl->ptr.x) - e_comp_wl->selection.target->client.x; y = wl_fixed_to_int(e_comp_wl->ptr.y) - e_comp_wl->selection.target->client.y; serial = wl_display_next_serial(e_comp_wl->wl.disp); - wl_data_device_send_enter(data_device_res, serial, ec->comp_data->surface, + wl_data_device_send_enter(data_device_res, serial, cdata->surface, wl_fixed_from_int(x), wl_fixed_from_int(y), offer_res); } @@ -783,11 +786,12 @@ E_API void e_comp_wl_data_device_send_leave(E_Client *ec) { struct wl_resource *res; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_DEL, _e_comp_wl_data_device_target_del, ec); if (e_comp_wl->selection.target == ec) e_comp_wl->selection.target = NULL; - res = e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); + res = e_comp_wl_data_find_for_client(wl_resource_get_client(cdata->surface)); if (res) wl_data_device_send_leave(res); } @@ -797,9 +801,10 @@ e_comp_wl_data_device_send_offer(E_Client *ec) { struct wl_resource *data_device_res, *offer_res = NULL; E_Comp_Wl_Data_Source *source; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); data_device_res = - e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); + e_comp_wl_data_find_for_client(wl_resource_get_client(cdata->surface)); if (!data_device_res) return NULL; source = e_comp_wl->drag_source; if (source) diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index c5354a3a59..66b2268163 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -40,6 +40,7 @@ static void _e_comp_wl_input_pointer_map(struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Pointer *ptr; struct wl_client *wc; @@ -49,9 +50,14 @@ _e_comp_wl_input_pointer_map(struct wl_resource *resource) //if cursor ec have external content e_comp_object_content_unset(ec->frame); - if (!e_comp_wl->ptr.ec || !e_comp_wl->ptr.ec->comp_data || !e_comp_wl->ptr.ec->comp_data->surface) return; + if (!e_comp_wl->ptr.ec) return; + + cdata = e_client_cdata_get(e_comp_wl->ptr.ec); + if (!cdata) return; + if (!cdata->surface) return; + wc = wl_resource_get_client(resource); - if (wc != wl_resource_get_client(e_comp_wl->ptr.ec->comp_data->surface)) return; + if (wc != wl_resource_get_client(cdata->surface)) return; if (!e_comp_wl->ptr.ec->pointer_enter_sent) return; if ((ptr = e_comp->pointer)) @@ -81,14 +87,17 @@ static void _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource, int32_t x, int32_t y) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Bool got_mouse = EINA_FALSE; E_CLIENT_FOREACH(ec) { if (e_object_is_del(E_OBJECT(ec))) continue; if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) continue; - if (!ec->comp_data->surface) continue; - if (client != wl_resource_get_client(ec->comp_data->surface)) continue; + cdata = e_client_cdata_get(ec); + if (!cdata) continue; + if (!cdata->surface) continue; + if (client != wl_resource_get_client(cdata->surface)) continue; if (ec->mouse.in && ec->pointer_enter_sent) { got_mouse = EINA_TRUE; @@ -120,9 +129,9 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou EC_CHANGED(ec); /* Set fuctions to prevent unwanted handling by shell */ - ec->comp_data->shell.surface = surface_resource; - ec->comp_data->shell.configure = _e_comp_wl_input_pointer_configure; - ec->comp_data->shell.map = _e_comp_wl_input_pointer_map; + cdata->shell.surface = surface_resource; + cdata->shell.configure = _e_comp_wl_input_pointer_configure; + cdata->shell.map = _e_comp_wl_input_pointer_map; e_client_layer_set(ec, E_LAYER_CLIENT_CURSOR); ec->is_cursor = EINA_TRUE; @@ -195,7 +204,7 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re if ((e_comp_wl->ptr.num_devices == 1) && e_comp_wl->ptr.ec && !e_comp_wl->ptr.ec->pointer_enter_sent && !e_config->use_cursor_timer) { - cdata = (E_Comp_Wl_Client_Data*)e_comp_wl->ptr.ec->comp_data; + cdata = e_client_cdata_get(e_comp_wl->ptr.ec); if (cdata && cdata->wl_surface) ptr_client = wl_resource_get_client(cdata->wl_surface); @@ -243,11 +252,14 @@ _e_comp_wl_input_cb_keyboard_unbind(struct wl_resource *resource) void e_comp_wl_input_keyboard_enter_send(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; Eina_List *l; uint32_t serial; - if (!ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->surface) return; if (!e_comp_wl->kbd.focused) return; @@ -257,7 +269,7 @@ e_comp_wl_input_keyboard_enter_send(E_Client *ec) EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) { - wl_keyboard_send_enter(res, serial, ec->comp_data->surface, + wl_keyboard_send_enter(res, serial, cdata->surface, &e_comp_wl->kbd.keys); wl_keyboard_send_modifiers(res, serial, e_comp_wl->kbd.mod_depressed, @@ -271,6 +283,7 @@ static void _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *resource, uint32_t id) { E_Client *focused; + E_Comp_Wl_Client_Data *focused_cdata = NULL; struct wl_resource *res; /* try to create keyboard resource */ @@ -303,10 +316,11 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r /* if the client owns the focused surface, we need to send an enter */ focused = e_client_focused_get(); - if ((!focused) || (e_object_is_del(E_OBJECT(focused))) || - (!focused->comp_data) || (!focused->comp_data->surface)) return; + if ((!focused) || (e_object_is_del(E_OBJECT(focused)))) return; + focused_cdata = e_client_cdata_get(focused); + if ((!focused_cdata) || (!focused_cdata->surface)) return; - if (client != wl_resource_get_client(focused->comp_data->surface)) return; + if (client != wl_resource_get_client(focused_cdata->surface)) return; e_comp_wl->kbd.focused = eina_list_append(e_comp_wl->kbd.focused, res); e_comp_wl_input_keyboard_enter_send(focused); diff --git a/src/bin/e_comp_wl_rsm.c b/src/bin/e_comp_wl_rsm.c index 6f8e2833c8..e721089e3d 100644 --- a/src/bin/e_comp_wl_rsm.c +++ b/src/bin/e_comp_wl_rsm.c @@ -225,16 +225,19 @@ static void _remote_provider_rect_add(E_Comp_Wl_Remote_Provider *provider, Eina_Rectangle *rect) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = provider->common.ec; if (!ec) return; - if (!ec->comp_data) return; - ec->comp_data->remote_surface.regions = - eina_list_remove(ec->comp_data->remote_surface.regions, + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + cdata->remote_surface.regions = + eina_list_remove(cdata->remote_surface.regions, rect); - ec->comp_data->remote_surface.regions = - eina_list_append(ec->comp_data->remote_surface.regions, + cdata->remote_surface.regions = + eina_list_append(cdata->remote_surface.regions, rect); } @@ -242,13 +245,16 @@ static void _remote_provider_rect_del(E_Comp_Wl_Remote_Provider *provider, Eina_Rectangle *rect) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = provider->common.ec; if (!ec) return; - if (!ec->comp_data) return; - ec->comp_data->remote_surface.regions = - eina_list_remove(ec->comp_data->remote_surface.regions, + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + cdata->remote_surface.regions = + eina_list_remove(cdata->remote_surface.regions, rect); } @@ -256,23 +262,27 @@ static void _remote_provider_rect_clear(E_Comp_Wl_Remote_Provider *provider) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = provider->common.ec; if (!ec) return; - if (!ec->comp_data) return; + + cdata = e_client_cdata_get(ec); + if (!cdata) return; /* TODO : remove it from here after supporting multiple onscreen surface */ _remote_surface_region_clear(provider->onscreen_parent); - ec->comp_data->remote_surface.regions = - eina_list_remove_list(ec->comp_data->remote_surface.regions, - ec->comp_data->remote_surface.regions); + cdata->remote_surface.regions = + eina_list_remove_list(cdata->remote_surface.regions, + cdata->remote_surface.regions); } static void _remote_provider_onscreen_parent_set(E_Comp_Wl_Remote_Provider *provider, E_Comp_Wl_Remote_Surface *parent) { E_Comp_Wl_Remote_Region *region; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; if (!provider) return; @@ -281,8 +291,11 @@ _remote_provider_onscreen_parent_set(E_Comp_Wl_Remote_Provider *provider, E_Comp _remote_provider_rect_clear(provider); + cdata = e_client_cdata_get(provider->common.ec); + if (!cdata) return; + provider->onscreen_parent = parent; - provider->common.ec->comp_data->remote_surface.onscreen_parent = NULL; + cdata->remote_surface.onscreen_parent = NULL; RSMDBG("set onscreen_parent %p(ec:%p)", provider->common.ec, "PROVIDER", provider, @@ -295,7 +308,7 @@ _remote_provider_onscreen_parent_set(E_Comp_Wl_Remote_Provider *provider, E_Comp _remote_provider_rect_add(provider, ®ion->geometry); } - provider->common.ec->comp_data->remote_surface.onscreen_parent = parent->ec; + cdata->remote_surface.onscreen_parent = parent->ec; } } @@ -312,7 +325,7 @@ _remote_provider_onscreen_parent_calculate(E_Comp_Wl_Remote_Provider *provider) ec = provider->common.ec; if (!ec) return; - if (!ec->comp_data) return; + if (!e_client_cdata_get(ec)) return; if (!provider->common.surfaces) return; o = evas_object_top_get(e_comp->evas); @@ -332,7 +345,7 @@ _remote_provider_onscreen_parent_calculate(E_Comp_Wl_Remote_Provider *provider) (_ec->visibility.obscured != E_VISIBILITY_PARTIALLY_OBSCURED)) continue; /* if _ec is subsurface, skip this */ - cdata = (E_Comp_Wl_Client_Data *)_ec->comp_data; + cdata = e_client_cdata_get(_ec); if (cdata && cdata->sub.data) continue; if (!E_INTERSECTS(_ec->x, _ec->y, _ec->w, _ec->h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) @@ -357,6 +370,7 @@ static void _remote_provider_offscreen_set(E_Comp_Wl_Remote_Provider* provider, Eina_Bool set) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN(provider); EINA_SAFETY_ON_NULL_RETURN(provider->common.ec); @@ -370,18 +384,19 @@ _remote_provider_offscreen_set(E_Comp_Wl_Remote_Provider* provider, Eina_Bool se provider->common.is_offscreen = set; ec->ignored = EINA_TRUE; + cdata = e_client_cdata_get(ec); //TODO: consider what happens if it's not normal client such as subsurface client //TODO: save original values - if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap)) + if ((cdata->shell.surface) && (cdata->shell.unmap)) { ELOGF("COMP", "Call shell.unmap by rsm", ec); - ec->comp_data->shell.unmap(ec->comp_data->shell.surface); + cdata->shell.unmap(cdata->shell.surface); } else { ec->visible = EINA_FALSE; evas_object_hide(ec->frame); - ec->comp_data->mapped = 0; + cdata->mapped = 0; } ec->icccm.accepts_focus = ec->icccm.take_focus = ec->want_focus = EINA_FALSE; @@ -508,7 +523,7 @@ _remote_surface_comp_wl_buffer_get(E_Client *ec) if (!ec) return NULL; - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; return cdata->buffer_ref.buffer; @@ -912,6 +927,9 @@ _remote_surface_bind_client_unset(E_Comp_Wl_Remote_Surface *remote_surface) static void _remote_surface_bind_client(E_Comp_Wl_Remote_Surface *remote_surface, E_Client *ec) { + E_Comp_Wl_Client_Data *bind_ec_cdata = NULL; + E_Comp_Wl_Client_Data *provider_ec_cdata = NULL; + if (!remote_surface) return; if ((ec) && (remote_surface->bind_ec == ec)) return; @@ -925,9 +943,10 @@ _remote_surface_bind_client(E_Comp_Wl_Remote_Surface *remote_surface, E_Client * if (remote_surface->provider && remote_surface->provider->common.ec) e_client_base_output_resolution_rsm_update(remote_surface->bind_ec, remote_surface->provider->common.ec); - remote_surface->bind_ec->comp_data->pending.sx = 0; - remote_surface->bind_ec->comp_data->pending.sy = 0; - remote_surface->bind_ec->comp_data->pending.new_attach = EINA_TRUE; + bind_ec_cdata = e_client_cdata_get(remote_surface->bind_ec); + bind_ec_cdata->pending.sx = 0; + bind_ec_cdata->pending.sy = 0; + bind_ec_cdata->pending.new_attach = EINA_TRUE; e_comp_wl_surface_attach(remote_surface->bind_ec, NULL); e_comp_object_render_update_del(remote_surface->bind_ec->frame); @@ -984,14 +1003,14 @@ bind_ec_set: buffer = _remote_surface_comp_wl_buffer_get(remote_surface->provider->common.ec); EINA_SAFETY_ON_NULL_RETURN(buffer); - _e_comp_wl_remote_surface_state_buffer_set(&remote_surface->bind_ec->comp_data->pending, buffer); + bind_ec_cdata = e_client_cdata_get(remote_surface->bind_ec); + provider_ec_cdata = e_client_cdata_get(remote_surface->provider->common.ec); - remote_surface->bind_ec->comp_data->pending.sx = 0; - remote_surface->bind_ec->comp_data->pending.sy = 0; - remote_surface->bind_ec->comp_data->pending.new_attach = EINA_TRUE; - - remote_surface->bind_ec->comp_data->pending.buffer_viewport = - remote_surface->provider->common.ec->comp_data->scaler.buffer_viewport; + _e_comp_wl_remote_surface_state_buffer_set(&bind_ec_cdata->pending, buffer); + bind_ec_cdata->pending.sx = 0; + bind_ec_cdata->pending.sy = 0; + bind_ec_cdata->pending.new_attach = EINA_TRUE; + bind_ec_cdata->pending.buffer_viewport = provider_ec_cdata->scaler.buffer_viewport; /* check the base_output resolution */ e_client_base_output_resolution_rsm_update(ec, remote_surface->provider->common.ec); @@ -2377,6 +2396,7 @@ _remote_manager_cb_surface_create(struct wl_client *client, E_Comp_Wl_Remote_Provider *provider = NULL; E_Comp_Wl_Remote_Source *source = NULL; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; int version; pid_t pid = 0; uid_t uid = 0; @@ -2441,7 +2461,8 @@ _remote_manager_cb_surface_create(struct wl_client *client, if (version >= TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_SINCE_VERSION) { - if ((ec->comp_data) && (ec->comp_data->sub.data)) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->sub.data) { ERR("Subsurface could not be source client"); goto fail; @@ -2529,6 +2550,7 @@ _remote_manager_cb_surface_create_with_wl_surface(struct wl_client *client, E_Comp_Wl_Remote_Provider *provider = NULL; E_Comp_Wl_Remote_Source *source = NULL; E_Client *ec, *provider_ec; + E_Comp_Wl_Client_Data *provider_cdata = NULL; Eina_List *surfaces; int version; pid_t pid = 0; @@ -2605,7 +2627,8 @@ _remote_manager_cb_surface_create_with_wl_surface(struct wl_client *client, if (version >= TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_SINCE_VERSION) { - if ((provider_ec->comp_data) && (provider_ec->comp_data->sub.data)) + provider_cdata = e_client_cdata_get(provider_ec); + if (provider_cdata && provider_cdata->sub.data) { ERR("Subsurface could not be source client"); goto fail; @@ -3004,10 +3027,17 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st int x = 0, y = 0, sx = 0, sy = 0; E_Comp_Wl_Buffer *buffer; Eina_List *l, *ll; - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *bind_ec_cdata = NULL; + E_Comp_Wl_Buffer_Viewport *vp = NULL; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + vp = &cdata->scaler.buffer_viewport; + if (vp->buffer.transform != state->buffer_viewport.buffer.transform) { int transform_change = (4 + state->buffer_viewport.buffer.transform - vp->buffer.transform) & 0x3; @@ -3020,7 +3050,7 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st vp->wait_for_transform_change = 0; } - ec->comp_data->scaler.buffer_viewport = state->buffer_viewport; + cdata->scaler.buffer_viewport = state->buffer_viewport; if (state->new_attach) e_comp_wl_surface_attach(ec, state->buffer); @@ -3035,9 +3065,8 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st ec->client.h = state->bh; e_client_size_set(ec, state->bw, state->bh); - if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.configure)) - ec->comp_data->shell.configure(ec->comp_data->shell.surface, - x, y, ec->w, ec->h); + if ((cdata->shell.surface) && (cdata->shell.configure)) + cdata->shell.configure(cdata->shell.surface, x, y, ec->w, ec->h); } sx = state->sx; @@ -3047,14 +3076,13 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st state->new_attach = EINA_FALSE; /* send previous frame done */ - EINA_LIST_FOREACH_SAFE(ec->comp_data->frames, l, ll, cb) + EINA_LIST_FOREACH_SAFE(cdata->frames, l, ll, cb) { wl_callback_send_done(cb, (unsigned int)(ecore_loop_time_get() * 1000)); wl_resource_destroy(cb); } - ec->comp_data->frames = eina_list_merge(ec->comp_data->frames, - state->frames); + cdata->frames = eina_list_merge(cdata->frames, state->frames); state->frames = NULL; /* clear stored damages... */ @@ -3075,21 +3103,7 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st EINA_LIST_FOREACH(provider->common.surfaces, l, surface) { if (!surface->redirect) continue; - if (surface->bind_ec) - { - surface->bind_ec->comp_data->pending.buffer_viewport = ec->comp_data->scaler.buffer_viewport; - - _e_comp_wl_remote_surface_state_buffer_set(&surface->bind_ec->comp_data->pending, buffer); - surface->bind_ec->comp_data->pending.sx = sx; - surface->bind_ec->comp_data->pending.sy = sy; - surface->bind_ec->comp_data->pending.new_attach = EINA_TRUE; - - e_comp_wl_surface_commit(surface->bind_ec); - - /* need to prepare hwc whenever buffer changed */ - e_comp_render_queue(); - } - else + if (!surface->bind_ec) { _remote_surface_changed_buff_protocol_send(surface, TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM, @@ -3097,7 +3111,22 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st 0, EINA_TRUE, buffer, NULL, EINA_FALSE); + continue; } + + bind_ec_cdata = e_client_cdata_get(surface->bind_ec); + if (!bind_ec_cdata) continue; + + bind_ec_cdata->pending.buffer_viewport = bind_ec_cdata->scaler.buffer_viewport; + _e_comp_wl_remote_surface_state_buffer_set(&bind_ec_cdata->pending, buffer); + bind_ec_cdata->pending.sx = sx; + bind_ec_cdata->pending.sy = sy; + bind_ec_cdata->pending.new_attach = EINA_TRUE; + + e_comp_wl_surface_commit(surface->bind_ec); + + /* need to prepare hwc whenever buffer changed */ + e_comp_render_queue(); } } else if ((source = _remote_source_find(ec))) @@ -3122,6 +3151,13 @@ _e_comp_wl_remote_surface_subsurface_commit(E_Comp_Wl_Remote_Provider *parent_pr int x, y, w, h; Eina_Bool first_skip = EINA_TRUE; E_Comp_Wl_Buffer *buffer; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *common_cdata = NULL; + + if (!ec) return EINA_FALSE; + + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; if (!e_comp_wl_subsurface_commit(ec)) return EINA_FALSE; @@ -3136,10 +3172,11 @@ _e_comp_wl_remote_surface_subsurface_commit(E_Comp_Wl_Remote_Provider *parent_pr if (!evas_object_visible_get(ec->frame)) return EINA_TRUE; - sdata = ec->comp_data->sub.data; + sdata = cdata->sub.data; evas_object_geometry_get(ec->frame, &fx, &fy, &fw, &fh); - EINA_LIST_FOREACH(parent_provider->common.ec->comp_data->remote_surface.regions, l, rect) + common_cdata = e_client_cdata_get(parent_provider->common.ec); + EINA_LIST_FOREACH(common_cdata->remote_surface.regions, l, rect) { E_Comp_Wl_Remote_Region *region; @@ -3159,8 +3196,8 @@ _e_comp_wl_remote_surface_subsurface_commit(E_Comp_Wl_Remote_Provider *parent_pr continue; } - w = ec->comp_data->width_from_viewport; - h = ec->comp_data->height_from_viewport; + w = cdata->width_from_viewport; + h = cdata->height_from_viewport; /* consider scale? * w = (int) (w * ((double)rect->w / parent_provider->ec->w)); @@ -3222,7 +3259,7 @@ e_comp_wl_remote_surface_bound_provider_ec_get(E_Client *ec) EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_client_cdata_get(ec), NULL); remote_surface = eina_hash_find(_rsm->bind_surface_hash, &ec); if (!remote_surface || !remote_surface->provider) return NULL; @@ -3233,45 +3270,50 @@ e_comp_wl_remote_surface_bound_provider_ec_get(E_Client *ec) EINTERN Eina_Bool e_comp_wl_remote_surface_commit(E_Client *ec) { + E_Comp_Wl_Client_Data *parent_cdata = NULL; E_Comp_Wl_Remote_Provider *provider; E_Comp_Wl_Remote_Source *source = NULL; E_Comp_Wl_Subsurf_Data *sdata, *ssdata; E_Client *offscreen_parent; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); + + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); source = _remote_source_find(ec); if (source) { if (source->common.is_offscreen) { - _e_comp_wl_remote_surface_state_commit(ec, &ec->comp_data->pending); + _e_comp_wl_remote_surface_state_commit(ec, &cdata->pending); return EINA_TRUE; } //send update to remote_surface of source client - _e_comp_wl_remote_surface_source_update(source, ec->comp_data->pending.buffer, EINA_TRUE); + _e_comp_wl_remote_surface_source_update(source, cdata->pending.buffer, EINA_TRUE); //do normal commit callback process return EINA_FALSE; } /* subsurface case */ - if ((sdata = ec->comp_data->sub.data)) + if ((sdata = cdata->sub.data)) { /* check for valid subcompositor data */ if (!sdata->parent) return EINA_FALSE; - if (!sdata->parent->comp_data) + if (e_object_is_del(E_OBJECT(sdata->parent))) return EINA_FALSE; - if (e_object_is_del(E_OBJECT(sdata->parent))) + parent_cdata = e_client_cdata_get(sdata->parent); + if (!parent_cdata) return EINA_FALSE; - if (!(ssdata = sdata->parent->comp_data->sub.data)) + if (!(ssdata = parent_cdata->sub.data)) return EINA_FALSE; if (!ssdata->remote_surface.offscreen_parent) @@ -3290,7 +3332,7 @@ e_comp_wl_remote_surface_commit(E_Client *ec) if (!(provider = _remote_provider_find(ec))) return EINA_FALSE; - _e_comp_wl_remote_surface_state_commit(ec, &ec->comp_data->pending); + _e_comp_wl_remote_surface_state_commit(ec, &cdata->pending); return EINA_TRUE; } diff --git a/src/bin/e_comp_wl_shell.c b/src/bin/e_comp_wl_shell.c index 71afc7e005..c01e8292b9 100644 --- a/src/bin/e_comp_wl_shell.c +++ b/src/bin/e_comp_wl_shell.c @@ -19,6 +19,8 @@ static Eina_Hash *xdg_sh_hash = NULL; EINTERN Eina_Bool e_shell_e_client_shell_assignable_check(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); if (e_object_is_del(E_OBJECT(ec))) @@ -27,13 +29,16 @@ e_shell_e_client_shell_assignable_check(E_Client *ec) ec); return EINA_FALSE; } - else if (!ec->comp_data) + + cdata = e_client_cdata_get(ec); + if (!cdata) { - ELOGF("SHELL", "ERR: Could not assign shell: No E_Comp_Client_Data", + ELOGF("SHELL", "ERR: Could not assign shell: No E_Comp_Wl_Client_Data", ec); return EINA_FALSE; } - else if (ec->comp_data->shell.surface) + + if (cdata->shell.surface) { ELOGF("SHELL", "ERR: Could not assign shell: Already assigned", ec); @@ -48,15 +53,15 @@ e_shell_e_client_shsurface_assign(E_Client *ec, struct wl_resource *shsurface, E_Shell_Surface_Api *api) { - E_Comp_Client_Data *cdata; + E_Comp_Wl_Client_Data *cdata; EINA_SAFETY_ON_NULL_RETURN(ec); EINA_SAFETY_ON_NULL_RETURN(shsurface); - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) { - ELOGF("SHELL", "ERR: E_Client must have E_Comp_Client_Data", + ELOGF("SHELL", "ERR: E_Client must have E_Comp_Wl_Client_Data", ec); return; } @@ -78,15 +83,15 @@ e_shell_e_client_shsurface_assign(E_Client *ec, EINTERN void e_shell_e_client_shsurface_api_set(E_Client *ec, E_Shell_Surface_Api *api) { - E_Comp_Client_Data *cdata; + E_Comp_Wl_Client_Data *cdata; EINA_SAFETY_ON_NULL_RETURN(ec); EINA_SAFETY_ON_NULL_RETURN(api); - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) { - ELOGF("SHELL", "ERR: E_Client must have E_Comp_Client_Data", + ELOGF("SHELL", "ERR: E_Client must have E_Comp_Wl_Client_Data", ec); return; } @@ -101,10 +106,20 @@ e_shell_e_client_shsurface_api_set(E_Client *ec, E_Shell_Surface_Api *api) EINTERN void e_shell_e_client_toplevel_set(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata; + EINA_SAFETY_ON_NULL_RETURN(ec); ELOGF("SHELL", "Set toplevel", ec); + cdata = e_client_cdata_get(ec); + if (!cdata) + { + ELOGF("SHELL", "ERR: E_Client must have E_Comp_Wl_Client_Data", + ec); + return; + } + /* set toplevel client properties */ if (!ec->internal) ec->borderless = 1; @@ -113,16 +128,26 @@ e_shell_e_client_toplevel_set(E_Client *ec) ec->border.changed = ec->changes.border = !ec->borderless; if (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN) ec->netwm.type = E_WINDOW_TYPE_NORMAL; - ec->comp_data->set_win_type = EINA_TRUE; + cdata->set_win_type = EINA_TRUE; } EINTERN void e_shell_e_client_popup_set(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata; + EINA_SAFETY_ON_NULL_RETURN(ec); ELOGF("SHELL", "Set popup", ec); + cdata = e_client_cdata_get(ec); + if (!cdata) + { + ELOGF("SHELL", "ERR: E_Client must have E_Comp_Wl_Client_Data", + ec); + return; + } + EC_CHANGED(ec); ec->new_client = ec->override = 1; e_client_unignore(ec); @@ -134,7 +159,7 @@ e_shell_e_client_popup_set(E_Client *ec) ec->border.changed = ec->changes.border = !ec->borderless; ec->changes.icon = !!ec->icccm.class; ec->netwm.type = E_WINDOW_TYPE_POPUP_MENU; - ec->comp_data->set_win_type = EINA_TRUE; + cdata->set_win_type = EINA_TRUE; e_client_layer_set(ec, E_LAYER_CLIENT_POPUP); } @@ -389,6 +414,8 @@ e_shell_e_client_interactive_resize(E_Client *ec, EINTERN void e_shell_e_client_destroy(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + EINA_SAFETY_ON_NULL_RETURN(ec); ELOGF("SHELL", "Destroy shell surface", ec); @@ -414,22 +441,23 @@ e_shell_e_client_destroy(E_Client *ec) if (e_object_unref(E_OBJECT(ec)) == 0) return; - if (!e_object_is_del(E_OBJECT(ec))) + cdata = e_client_cdata_get(ec); + if (!e_object_is_del(E_OBJECT(ec)) && !cdata) { - if (ec->comp_data->mapped) + if (cdata->mapped) { - if ((ec->comp_data->shell.surface) && - (ec->comp_data->shell.unmap)) + if ((cdata->shell.surface) && + (cdata->shell.unmap)) { ELOGF("SHELL", "Call shell.unmap by destory surface", ec); - ec->comp_data->shell.unmap(ec->comp_data->shell.surface); + cdata->shell.unmap(cdata->shell.surface); } } e_policy_client_unmap(ec); } - if (ec->comp_data) - ec->comp_data->shell.surface = NULL; + if (cdata) + cdata->shell.surface = NULL; } static void @@ -555,6 +583,7 @@ static void _e_shell_surface_cb_popup_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags EINA_UNUSED) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata; if (!(ec = wl_resource_get_user_data(resource))) { @@ -563,10 +592,11 @@ _e_shell_surface_cb_popup_set(struct wl_client *client EINA_UNUSED, struct wl_re return; } - if (ec->comp_data) + cdata = e_client_cdata_get(ec); + if (cdata) { - ec->comp_data->popup.x = x; - ec->comp_data->popup.y = y; + cdata->popup.x = x; + cdata->popup.y = y; } if (!ec->internal) @@ -576,8 +606,8 @@ _e_shell_surface_cb_popup_set(struct wl_client *client EINA_UNUSED, struct wl_re ec->border.changed = ec->changes.border = !ec->borderless; ec->changes.icon = !!ec->icccm.class; ec->netwm.type = E_WINDOW_TYPE_POPUP_MENU; - if (ec->comp_data) - ec->comp_data->set_win_type = EINA_TRUE; + if (cdata) + cdata->set_win_type = EINA_TRUE; ec->layer = E_LAYER_CLIENT_POPUP; /* set this client as a transient for parent */ @@ -681,6 +711,7 @@ static void _e_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!resource) return; @@ -693,17 +724,20 @@ _e_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_Coor return; } + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (ec->parent) { if ((ec->netwm.type == E_WINDOW_TYPE_MENU) || (ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) || (ec->netwm.type == E_WINDOW_TYPE_DROPDOWN_MENU)) { - x = E_CLAMP(ec->parent->client.x + ec->comp_data->popup.x, + x = E_CLAMP(ec->parent->client.x + cdata->popup.x, ec->parent->client.x, ec->parent->client.x + ec->parent->client.w - ec->client.w); - y = E_CLAMP(ec->parent->client.y + ec->comp_data->popup.y, + y = E_CLAMP(ec->parent->client.y + cdata->popup.y, ec->parent->client.y, ec->parent->client.y + ec->parent->client.h - ec->client.h); @@ -717,6 +751,7 @@ static void _e_shell_surface_ping(struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; uint32_t serial; if (!resource) @@ -731,14 +766,21 @@ _e_shell_surface_ping(struct wl_resource *resource) return; } + cdata = e_client_cdata_get(ec); + if (!cdata) return; + serial = wl_display_next_serial(e_comp_wl->wl.disp); - wl_shell_surface_send_ping(ec->comp_data->shell.surface, serial); + wl_shell_surface_send_ping(cdata->shell.surface, serial); } static void _e_shell_client_map_common_pre(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; e_comp_object_signal_emit(ec->frame, "e,state,map", "e"); @@ -758,13 +800,17 @@ _e_shell_client_map_common_pre(E_Client *ec) /* map this surface if needed */ ec->visible = EINA_TRUE; evas_object_show(ec->frame); - ec->comp_data->mapped = EINA_TRUE; + cdata->mapped = EINA_TRUE; } static void _e_shell_client_map_common_post(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if ((!ec->iconic) && (!e_client_util_ignored_get(ec))) { @@ -777,7 +823,7 @@ _e_shell_client_map_common_post(E_Client *ec) ec->post_raise = EINA_FALSE; } - if (!ec->comp_data->sub.data) + if (!cdata->sub.data) { if (ec->post_lower) { @@ -813,6 +859,7 @@ static void _e_shell_surface_map(struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!resource) return; @@ -826,8 +873,11 @@ _e_shell_surface_map(struct wl_resource *resource) return; } + cdata = e_client_cdata_get(ec); + if (!cdata) return; + /* map this surface if needed */ - if ((!ec->comp_data->mapped) && (e_pixmap_usable_get(ec->pixmap))) + if ((!cdata->mapped) && (e_pixmap_usable_get(ec->pixmap))) { ELOGF("SHELL", "Map window |win:0x%08x|ec_size:%d,%d|pid:%d|title:%s, name:%s", @@ -995,6 +1045,7 @@ static void _e_xdg_shell_surface_cb_parent_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *parent_resource) { E_Client *ec, *pc; + E_Comp_Wl_Client_Data *parent_cdata = NULL; if (!(ec = wl_resource_get_user_data(resource))) { @@ -1010,8 +1061,9 @@ _e_xdg_shell_surface_cb_parent_set(struct wl_client *client EINA_UNUSED, struct ERR("Could not get parent resource clinet"); return; } - if (!pc->comp_data) return; - parent_resource = pc->comp_data->surface; + parent_cdata = e_client_cdata_get(pc); + if (!parent_cdata) return; + parent_resource = parent_cdata->surface; } /* set this client as a transient for parent */ @@ -1121,6 +1173,7 @@ static void _e_xdg_shell_surface_cb_window_geometry_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata= NULL; ec = wl_resource_get_user_data(resource); if (!ec) @@ -1129,7 +1182,10 @@ _e_xdg_shell_surface_cb_window_geometry_set(struct wl_client *client EINA_UNUSED "No Client For Shell Surface"); return; } - EINA_RECTANGLE_SET(&ec->comp_data->shell.window, x, y, w, h); + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + EINA_RECTANGLE_SET(&cdata->shell.window, x, y, w, h); } static void @@ -1260,6 +1316,7 @@ static void _e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata= NULL; if (!resource) return; @@ -1278,14 +1335,18 @@ _e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_ (ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) || (ec->netwm.type == E_WINDOW_TYPE_DROPDOWN_MENU)) { - x = E_CLAMP(ec->parent->client.x + ec->comp_data->popup.x, - ec->parent->client.x, - ec->parent->client.x + - ec->parent->client.w - ec->client.w); - y = E_CLAMP(ec->parent->client.y + ec->comp_data->popup.y, - ec->parent->client.y, - ec->parent->client.y + - ec->parent->client.h - ec->client.h); + cdata = e_client_cdata_get(ec); + if (cdata) + { + x = E_CLAMP(ec->parent->client.x + cdata->popup.x, + ec->parent->client.x, + ec->parent->client.x + + ec->parent->client.w - ec->client.w); + y = E_CLAMP(ec->parent->client.y + cdata->popup.y, + ec->parent->client.y, + ec->parent->client.y + + ec->parent->client.h - ec->client.h); + } } } @@ -1331,11 +1392,15 @@ static Eina_Bool _e_xdg_shell_surface_map_cb_timer(void *data) { E_Client *ec = data; + E_Comp_Wl_Client_Data *cdata = NULL; if (!ec) return ECORE_CALLBACK_CANCEL; if (e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_CANCEL; - if ((!ec->comp_data->mapped) && (e_pixmap_usable_get(ec->pixmap))) + cdata = e_client_cdata_get(ec); + if (!cdata) return ECORE_CALLBACK_CANCEL; + + if ((!cdata->mapped) && (e_pixmap_usable_get(ec->pixmap))) { ELOGF("SHELL", "Map window by map_timer |win:0x%08x|ec_size:%d,%d|pid:%d|title:%s, name:%s", @@ -1367,6 +1432,7 @@ _e_xdg_shell_surface_map_cb_timer(void *data) EINTERN void e_shell_e_client_map(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; int pw = 0; int ph = 0; int cw; @@ -1374,7 +1440,10 @@ e_shell_e_client_map(E_Client *ec) EINA_SAFETY_ON_NULL_RETURN(ec); - if (ec->comp_data->mapped) + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); + + if (cdata->mapped) { ELOGF("SHELL", "Map window | Already mapped.", ec); return; @@ -1461,10 +1530,12 @@ _e_xdg_shell_surface_map(struct wl_resource *resource) EINTERN void e_shell_e_client_unmap(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_FREE_FUNC(ec->map_timer, ecore_timer_del); - if (ec->comp_data->mapped) + cdata = e_client_cdata_get(ec); + if (cdata->mapped) { e_comp_object_signal_emit(ec->frame, "e,state,unmap", "e"); @@ -1473,7 +1544,7 @@ e_shell_e_client_unmap(E_Client *ec) ec->visible = EINA_FALSE; evas_object_hide(ec->frame); - ec->comp_data->mapped = EINA_FALSE; + cdata->mapped = EINA_FALSE; ec->visibility.last_sent_type = E_VISIBILITY_UNKNOWN; ELOGF("SHELL", @@ -1577,7 +1648,7 @@ static void _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, uint32_t id, struct wl_resource *surface_resource, struct wl_resource *parent_resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED, int32_t x, int32_t y) { E_Client *ec; - E_Comp_Client_Data *cdata; + E_Comp_Wl_Client_Data *cdata; struct wl_resource *shsurf_resource; E_Shell_Surface_Api api = { .configure_send = _e_xdg_shell_surface_configure_send, @@ -1634,7 +1705,7 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource /* set this client as a transient for parent */ e_shell_e_client_parent_set(ec, parent_resource); - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (ec->parent) { cdata->popup.x = E_CLAMP(x, 0, ec->parent->client.w); diff --git a/src/bin/e_comp_wl_subsurface.c b/src/bin/e_comp_wl_subsurface.c index f2ba1bb38a..303b68240e 100644 --- a/src/bin/e_comp_wl_subsurface.c +++ b/src/bin/e_comp_wl_subsurface.c @@ -23,22 +23,26 @@ static void _e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec) { E_Client *bottom = ec; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *bottom_cdata = NULL; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) - return; - - if (!ec->comp_data->sub.below_obj) - return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->sub.below_obj) return; while (bottom) { short layer = evas_object_layer_get(bottom->frame); - if (evas_object_layer_get(ec->comp_data->sub.below_obj) != layer) - evas_object_layer_set(ec->comp_data->sub.below_obj, layer); + if (evas_object_layer_get(cdata->sub.below_obj) != layer) + evas_object_layer_set(cdata->sub.below_obj, layer); + + evas_object_stack_below(cdata->sub.below_obj, bottom->frame); - evas_object_stack_below(ec->comp_data->sub.below_obj, bottom->frame); - bottom = eina_list_nth(bottom->comp_data->sub.below_list, 0); + bottom_cdata = e_client_cdata_get(bottom); + bottom = eina_list_nth(bottom_cdata->sub.below_list, 0); } } @@ -46,75 +50,85 @@ static void _e_comp_wl_subsurface_restack(E_Client *ec) { E_Client *subc, *temp; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data->sub.restacking) + if (cdata->sub.restacking) return; - ec->comp_data->sub.restacking = EINA_TRUE; + cdata->sub.restacking = EINA_TRUE; temp = ec; - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { - if (!subc || !subc->comp_data || e_object_is_del(E_OBJECT(subc))) continue; + if (!subc || e_object_is_del(E_OBJECT(subc))) continue; + if (!e_client_cdata_get(subc)) continue; e_client_stack_above(subc, temp); temp = subc; } temp = ec; - EINA_LIST_REVERSE_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc) { - if (!subc || !subc->comp_data || e_object_is_del(E_OBJECT(subc))) continue; + if (!subc || e_object_is_del(E_OBJECT(subc))) continue; + if (!e_client_cdata_get(subc)) continue; e_client_stack_below(subc, temp); temp = subc; } - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) _e_comp_wl_subsurface_restack(subc); - EINA_LIST_REVERSE_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc) _e_comp_wl_subsurface_restack(subc); - ec->comp_data->sub.restacking = EINA_FALSE; + cdata->sub.restacking = EINA_FALSE; } static void _e_comp_wl_subsurface_bg_evas_cb_resize(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data->sub.below_obj) - evas_object_resize(ec->comp_data->sub.below_obj, ec->w, ec->h); + if (cdata->sub.below_obj) + evas_object_resize(cdata->sub.below_obj, ec->w, ec->h); } static Eina_Bool _e_comp_wl_subsurface_video_has(E_Client *ec) { E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; if (!ec) return EINA_FALSE; if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; - if (!ec->comp_data) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; - if ((ec->comp_data->video_client) || + if ((cdata->video_client) || (e_client_video_hw_composition_check(ec))) return EINA_TRUE; - if (ec->comp_data->has_video_client) + if (cdata->has_video_client) return EINA_TRUE; - EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list_pending, l, subc) if (_e_comp_wl_subsurface_video_has(subc)) return EINA_TRUE; - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) if (_e_comp_wl_subsurface_video_has(subc)) return EINA_TRUE; @@ -124,9 +138,14 @@ _e_comp_wl_subsurface_video_has(E_Client *ec) static void _e_comp_wl_subsurface_below_obj_create(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Object *below_obj; short layer; + if (!ec) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + /* create a bg rectangle if topmost window is 24 depth window */ below_obj = evas_object_rectangle_add(e_comp->evas); EINA_SAFETY_ON_NULL_RETURN(below_obj); @@ -146,7 +165,7 @@ _e_comp_wl_subsurface_below_obj_create(E_Client *ec) if (evas_object_visible_get(ec->frame)) evas_object_show(below_obj); - ec->comp_data->sub.below_obj = below_obj; + cdata->sub.below_obj = below_obj; ELOGF("COMP", " |bg_rectangle(%p) created", ec, below_obj); @@ -176,31 +195,37 @@ _e_comp_wl_subsurface_below_obj_create(E_Client *ec) static void _e_comp_wl_subsurface_below_obj_destroy(E_Client *ec) { - ELOGF("COMP", " |bg_rectangle(%p) delete", ec, ec->comp_data->sub.below_obj); - E_FREE_FUNC(ec->comp_data->sub.below_obj, evas_object_del); + E_Comp_Wl_Client_Data *cdata = NULL; + + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + ELOGF("COMP", " |bg_rectangle(%p) delete", ec, cdata->sub.below_obj); + E_FREE_FUNC(cdata->sub.below_obj, evas_object_del); } static void _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec) { E_Client *topmost; + E_Comp_Wl_Client_Data *topmost_cdata = NULL; topmost = e_comp_wl_topmost_parent_get(ec); if (!topmost) return; - if ((!topmost->comp_data) || + if ((!topmost_cdata) || (e_object_is_del(E_OBJECT(topmost)))) return; if (_e_comp_wl_subsurface_data_get(topmost)) return; - if (topmost->comp_data->sub.below_obj) + if (topmost_cdata->sub.below_obj) { if ((topmost->argb) || - ((!topmost->comp_data->sub.below_list) && - (!topmost->comp_data->sub.below_list_pending) && + ((!topmost_cdata->sub.below_list) && + (!topmost_cdata->sub.below_list_pending) && (!_e_comp_wl_subsurface_video_has(topmost)))) { ELOGF("COMP", "below_obj becomes useless. argb(%d)", @@ -211,8 +236,8 @@ _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec) else { if ((!topmost->argb) && - ((topmost->comp_data->sub.below_list) || - (topmost->comp_data->sub.below_list_pending) || + ((topmost_cdata->sub.below_list) || + (topmost_cdata->sub.below_list_pending) || (_e_comp_wl_subsurface_video_has(topmost)))) { ELOGF("COMP", "it has below subsurfaces and video.", topmost); @@ -225,32 +250,41 @@ static void _e_comp_wl_subsurface_show(E_Client *ec) { E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *subc_cdata = NULL; Eina_List *l; - if (!ec->comp_data || e_object_is_del(E_OBJECT(ec))) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { - if (!subc->comp_data || e_object_is_del(E_OBJECT(subc))) continue; + if (e_object_is_del(E_OBJECT(subc))) continue; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata) continue; - if (e_pixmap_resource_get(subc->pixmap) && !subc->comp_data->mapped) + if (e_pixmap_resource_get(subc->pixmap) && !subc_cdata->mapped) { subc->visible = EINA_TRUE; evas_object_show(subc->frame); - subc->comp_data->mapped = 1; + subc_cdata->mapped = 1; } _e_comp_wl_subsurface_show(subc); } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { - if (!subc->comp_data || e_object_is_del(E_OBJECT(subc))) continue; + if (e_object_is_del(E_OBJECT(subc))) continue; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata) continue; - if (e_pixmap_resource_get(subc->pixmap) && !subc->comp_data->mapped) + if (e_pixmap_resource_get(subc->pixmap) && !subc_cdata->mapped) { subc->visible = EINA_TRUE; evas_object_show(subc->frame); - subc->comp_data->mapped = 1; + subc_cdata->mapped = 1; } _e_comp_wl_subsurface_show(subc); } @@ -260,35 +294,44 @@ static void _e_comp_wl_subsurface_hide(E_Client *ec) { E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *sub_cdata = NULL; Eina_List *l; - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { - if (!subc->comp_data || !subc->comp_data->sub.data) continue; + sub_cdata = e_client_cdata_get(subc); + if (!sub_cdata || !sub_cdata->sub.data) continue; - if (!subc->comp_data->sub.data->stand_alone) + if (!sub_cdata->sub.data->stand_alone) { - if (subc->comp_data->mapped) + if (sub_cdata->mapped) { subc->visible = EINA_FALSE; evas_object_hide(subc->frame); - subc->comp_data->mapped = 0; + sub_cdata->mapped = 0; } _e_comp_wl_subsurface_hide(subc); } } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { - if (!subc->comp_data || !subc->comp_data->sub.data) continue; + sub_cdata = e_client_cdata_get(subc); + if (!sub_cdata || !sub_cdata->sub.data) continue; - if (!subc->comp_data->sub.data->stand_alone) + if (!sub_cdata->sub.data->stand_alone) { - if (subc->comp_data->mapped) + if (sub_cdata->mapped) { subc->visible = EINA_FALSE; evas_object_hide(subc->frame); - subc->comp_data->mapped = 0; + sub_cdata->mapped = 0; } _e_comp_wl_subsurface_hide(subc); } @@ -299,28 +342,35 @@ static E_Client* _e_comp_wl_subsurface_invisible_parent_get(E_Client *ec) { E_Client *parent = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *parent_cdata = NULL; - if (!ec->comp_data || e_object_is_del(E_OBJECT(ec)) || !ec->comp_data->sub.data) - return NULL; + if (!ec) return NULL; + if (e_object_is_del(E_OBJECT(ec))) return NULL; + cdata = e_client_cdata_get(ec); + if (!cdata) return NULL; + if (!cdata->sub.data) return NULL; - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; while (parent) { /* in case of topmost */ - if (e_object_is_del(E_OBJECT(parent)) || !parent->comp_data) return NULL; + if (e_object_is_del(E_OBJECT(parent))) return NULL; + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata) return NULL; - if (!parent->comp_data->sub.data) + if (!parent_cdata->sub.data) return (!evas_object_visible_get(parent->frame)) ? parent : NULL; if (!evas_object_visible_get(parent->frame)){ if (e_pixmap_resource_get(parent->pixmap)) return parent; - if (!parent->comp_data->sub.data->parent) + if (!parent_cdata->sub.data->parent) return parent; } - parent = parent->comp_data->sub.data->parent; + parent = parent_cdata->sub.data->parent; } return NULL; @@ -330,28 +380,30 @@ static Eina_Bool _e_comp_wl_subsurface_order_commit_recursive(E_Client *ec) { E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; - if (!ec->comp_data) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; - if (!ec->comp_data->sub.list_changed) + if (!cdata->sub.list_changed) return EINA_FALSE; - ec->comp_data->sub.list_changed = EINA_FALSE; + cdata->sub.list_changed = EINA_FALSE; /* TODO: need to check more complicated subsurface tree */ - EINA_LIST_FOREACH(ec->comp_data->sub.list_pending, l, subc) + EINA_LIST_FOREACH(cdata->sub.list_pending, l, subc) { - ec->comp_data->sub.list = eina_list_remove(ec->comp_data->sub.list, subc); - ec->comp_data->sub.list = eina_list_append(ec->comp_data->sub.list, subc); + cdata->sub.list = eina_list_remove(cdata->sub.list, subc); + cdata->sub.list = eina_list_append(cdata->sub.list, subc); _e_comp_wl_subsurface_order_commit_recursive(subc); } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list_pending, l, subc) { - ec->comp_data->sub.below_list = eina_list_remove(ec->comp_data->sub.below_list, subc); - ec->comp_data->sub.below_list = eina_list_append(ec->comp_data->sub.below_list, subc); + cdata->sub.below_list = eina_list_remove(cdata->sub.below_list, subc); + cdata->sub.below_list = eina_list_append(cdata->sub.below_list, subc); _e_comp_wl_subsurface_order_commit_recursive(subc); } @@ -375,14 +427,14 @@ _e_comp_wl_subsurface_order_commit(E_Client *ec) static void _e_comp_wl_subsurface_commit_to_cache(E_Client *ec) { - E_Comp_Client_Data *cdata; + E_Comp_Wl_Client_Data *cdata; E_Comp_Wl_Subsurf_Data *sdata; struct wl_resource *cb; Eina_List *l, *ll; Eina_Iterator *itr; Eina_Rectangle *rect; - if (!(cdata = ec->comp_data)) return; + if (!(cdata = e_client_cdata_get(ec))) return; sdata = _e_comp_wl_subsurface_data_get(ec); EINA_SAFETY_ON_NULL_RETURN(sdata); @@ -457,6 +509,7 @@ _e_comp_wl_subsurface_commit_to_cache(E_Client *ec) static void _e_comp_wl_subsurface_commit_from_cache(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; sdata = _e_comp_wl_subsurface_data_get(ec); @@ -468,7 +521,8 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec) if (!e_comp_object_damage_exists(ec->frame)) { - if ((ec->comp_data->video_client) || + cdata = e_client_cdata_get(ec); + if ((cdata->video_client) || (!e_client_video_hw_composition_check(ec))) e_pixmap_image_clear(ec->pixmap, 1); } @@ -483,6 +537,7 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec) static void _e_comp_wl_subsurface_synchronized_commit(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; E_Client *subc; Eina_List *l; @@ -493,12 +548,13 @@ _e_comp_wl_subsurface_synchronized_commit(E_Client *ec) if (sdata->cached.has_data) _e_comp_wl_subsurface_commit_from_cache(ec); - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + cdata = e_client_cdata_get(ec); + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { if (ec != subc) _e_comp_wl_subsurface_parent_commit(subc, EINA_TRUE); } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { if (ec != subc) _e_comp_wl_subsurface_parent_commit(subc, EINA_TRUE); @@ -509,9 +565,13 @@ static void _e_comp_wl_subsurface_parent_commit(E_Client *ec, Eina_Bool parent_synchronized) { E_Client *parent; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; - if (!ec || e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; sdata = _e_comp_wl_subsurface_data_get(ec); EINA_SAFETY_ON_NULL_RETURN(sdata); @@ -539,13 +599,16 @@ static void _e_comp_wl_subsurface_cb_position_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; DBG("Subsurface Cb Position Set: %d", wl_resource_get_id(resource)); ec = wl_resource_get_user_data(resource); - - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; sdata = _e_comp_wl_subsurface_data_get(ec); EINA_SAFETY_ON_NULL_RETURN(sdata); @@ -560,19 +623,23 @@ _subsurface_sibling_check(E_Client *ec1, E_Client *ec2) { E_Client *parent, *sibling; Eina_List *l; + E_Comp_Wl_Client_Data *ec1_cdata = e_client_cdata_get(ec1); + E_Comp_Wl_Client_Data *parent_cdata; - parent = ec1->comp_data->sub.data->parent; + parent = ec1_cdata->sub.data->parent; if (parent == ec2) return EINA_TRUE; - EINA_LIST_FOREACH(parent->comp_data->sub.list_pending, l, sibling) + parent_cdata = e_client_cdata_get(parent); + + EINA_LIST_FOREACH(parent_cdata->sub.list_pending, l, sibling) { if ((sibling != ec1) && (sibling == ec2)) return EINA_TRUE; } - EINA_LIST_FOREACH(parent->comp_data->sub.below_list_pending, l, sibling) + EINA_LIST_FOREACH(parent_cdata->sub.below_list_pending, l, sibling) { if ((sibling != ec1) && (sibling == ec2)) return EINA_TRUE; @@ -586,38 +653,45 @@ _e_comp_wl_subsurface_cb_place_above(struct wl_client *client EINA_UNUSED, struc { E_Client *ec, *ecs; E_Client *parent; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *ecs_cdata = NULL; + E_Comp_Wl_Client_Data *parent_cdata = NULL; DBG("Subsurface Cb Place Above: %d", wl_resource_get_id(resource)); ec = wl_resource_get_user_data(resource); - - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; - if (!ec->comp_data->sub.data) return; - - if (!(parent = ec->comp_data->sub.data->parent)) return; - if (e_object_is_del(E_OBJECT(parent)) || !parent->comp_data) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!(parent = cdata->sub.data->parent)) return; + if (e_object_is_del(E_OBJECT(parent))) return; + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata) return; /* try to get the client from the sibling resource */ if (!(ecs = wl_resource_get_user_data(sibling_resource))) return; + ecs_cdata = e_client_cdata_get(ecs); + if (!ecs_cdata) return; if (!_subsurface_sibling_check(ec, ecs)) { - wl_resource_post_error(ec->comp_data->sub.data->resource, + wl_resource_post_error(ecs_cdata->sub.data->resource, WL_SUBSURFACE_ERROR_BAD_SURFACE, "%s: wl_surface@%d is not a parent or sibling", - "place_above", wl_resource_get_id(ecs->comp_data->surface)); + "place_above", wl_resource_get_id(ecs_cdata->surface)); return; } - if (!ecs->comp_data->sub.data) return; + if (!ecs_cdata->sub.data) return; - parent->comp_data->sub.list_pending = - eina_list_remove(parent->comp_data->sub.list_pending, ec); + parent_cdata->sub.list_pending = + eina_list_remove(parent_cdata->sub.list_pending, ec); - parent->comp_data->sub.list_pending = - eina_list_append_relative(parent->comp_data->sub.list_pending, ec, ecs); + parent_cdata->sub.list_pending = + eina_list_append_relative(parent_cdata->sub.list_pending, ec, ecs); - parent->comp_data->sub.list_changed = EINA_TRUE; + parent_cdata->sub.list_changed = EINA_TRUE; } static void @@ -625,51 +699,65 @@ _e_comp_wl_subsurface_cb_place_below(struct wl_client *client EINA_UNUSED, struc { E_Client *ec, *ecs; E_Client *parent; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *ecs_cdata = NULL; + E_Comp_Wl_Client_Data *parent_cdata = NULL; DBG("Subsurface Cb Place Below: %d", wl_resource_get_id(resource)); ec = wl_resource_get_user_data(resource); + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->sub.data) return; - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; - if (!ec->comp_data->sub.data) return; - - if (!(parent = ec->comp_data->sub.data->parent)) return; - if (e_object_is_del(E_OBJECT(parent)) || !parent->comp_data) return; + if (!(parent = cdata->sub.data->parent)) return; + if (e_object_is_del(E_OBJECT(parent))) return; + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata) return; /* try to get the client from the sibling resource */ if (!(ecs = wl_resource_get_user_data(sibling_resource))) return; + ecs_cdata = e_client_cdata_get(ecs); + if (!ecs_cdata) return; + if (!ecs_cdata->sub.data) return; + if (!_subsurface_sibling_check(ec, ecs)) { - wl_resource_post_error(ec->comp_data->sub.data->resource, + wl_resource_post_error(ecs_cdata->sub.data->resource, WL_SUBSURFACE_ERROR_BAD_SURFACE, "%s: wl_surface@%d is not a parent or sibling", - "place_below", wl_resource_get_id(ecs->comp_data->surface)); + "place_below", wl_resource_get_id(ecs_cdata->surface)); return; } - if (!ecs->comp_data->sub.data) return; + if (!ecs_cdata->sub.data) return; - parent->comp_data->sub.list_pending = - eina_list_remove(parent->comp_data->sub.list_pending, ec); + parent_cdata->sub.list_pending = + eina_list_remove(parent_cdata->sub.list_pending, ec); - parent->comp_data->sub.list_pending = - eina_list_prepend_relative(parent->comp_data->sub.list_pending, ec, ecs); + parent_cdata->sub.list_pending = + eina_list_prepend_relative(parent_cdata->sub.list_pending, ec, ecs); - parent->comp_data->sub.list_changed = EINA_TRUE; + parent_cdata->sub.list_changed = EINA_TRUE; } static void _e_comp_wl_subsurface_cb_sync_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; DBG("Subsurface Cb Sync Set: %d", wl_resource_get_id(resource)); ec = wl_resource_get_user_data(resource); - - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; sdata = _e_comp_wl_subsurface_data_get(ec); EINA_SAFETY_ON_NULL_RETURN(sdata); @@ -681,13 +769,16 @@ static void _e_comp_wl_subsurface_cb_desync_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; DBG("Subsurface Cb Desync Set: %d", wl_resource_get_id(resource)); ec = wl_resource_get_user_data(resource); - - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; sdata = _e_comp_wl_subsurface_data_get(ec); EINA_SAFETY_ON_NULL_RETURN(sdata); @@ -721,6 +812,7 @@ static void _e_comp_wl_subcompositor_cb_subsurface_get(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource, struct wl_resource *parent_resource) { E_Client *ec, *epc = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; static const char where[] = "get_subsurface: wl_subsurface@"; if (!(ec = wl_resource_get_user_data(surface_resource))) return; @@ -737,8 +829,9 @@ _e_comp_wl_subcompositor_cb_subsurface_get(struct wl_client *client EINA_UNUSED, if (e_object_is_del(E_OBJECT(ec))) return; if (e_object_is_del(E_OBJECT(epc))) return; + cdata = e_client_cdata_get(ec); /* check if this surface is already a sub-surface */ - if ((ec->comp_data) && (ec->comp_data->sub.data)) + if ((cdata) && (cdata->sub.data)) { wl_resource_post_error(resource, WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, @@ -823,36 +916,42 @@ static void _e_comp_wl_surface_sub_list_free(Eina_List *sub_list) { E_Client *subc; + E_Comp_Wl_Client_Data *subc_cdata = NULL; EINA_LIST_FREE(sub_list, subc) { - if (!subc->comp_data || !subc->comp_data->sub.data) continue; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata || !subc_cdata->sub.data) continue; - subc->comp_data->sub.data->parent = NULL; + subc_cdata->sub.data->parent = NULL; - if (subc->comp_data->sub.watcher) - tizen_subsurface_watcher_send_message(subc->comp_data->sub.watcher, TIZEN_SUBSURFACE_WATCHER_MSG_PARENT_ID_DESTROYED); + if (subc_cdata->sub.watcher) + tizen_subsurface_watcher_send_message(subc_cdata->sub.watcher, TIZEN_SUBSURFACE_WATCHER_MSG_PARENT_ID_DESTROYED); } } static void _e_comp_wl_subsurface_cb_ec_del(void *data EINA_UNUSED, E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + + if (!ec) return; + /* make sure this is a wayland client */ if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; - if (!ec->comp_data) - return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data->sub.data) + if (cdata->sub.data) { - if (ec->comp_data->sub.data->parent) - _e_comp_wl_subsurface_remove_from_parent(ec->comp_data->sub.data->parent, ec); - _e_comp_wl_subsurface_data_destroy(ec->comp_data->sub.data); - ec->comp_data->sub.data = NULL; + if (cdata->sub.data->parent) + _e_comp_wl_subsurface_remove_from_parent(cdata->sub.data->parent, ec); + _e_comp_wl_subsurface_data_destroy(cdata->sub.data); + cdata->sub.data = NULL; } - if (ec->comp_data->sub.below_obj) + if (cdata->sub.below_obj) { ELOGF("COMP", "ec deleted", ec); _e_comp_wl_subsurface_below_obj_destroy(ec); @@ -860,14 +959,15 @@ _e_comp_wl_subsurface_cb_ec_del(void *data EINA_UNUSED, E_Client *ec) /* remove sub list */ /* TODO: if parent is set by onscreen_parent of remote surface? */ - _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.list); - ec->comp_data->sub.list = NULL; - _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.list_pending); - ec->comp_data->sub.list_pending = NULL; - _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.below_list); - ec->comp_data->sub.below_list = NULL; - _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.below_list_pending); - ec->comp_data->sub.below_list_pending = NULL; + _e_comp_wl_surface_sub_list_free(cdata->sub.list); + cdata->sub.list = NULL; + _e_comp_wl_surface_sub_list_free(cdata->sub.list_pending); + cdata->sub.list_pending = NULL; + _e_comp_wl_surface_sub_list_free(cdata->sub.below_list); + cdata->sub.below_list = NULL; + _e_comp_wl_surface_sub_list_free(cdata->sub.below_list_pending); + cdata->sub.below_list_pending = NULL; + evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_RESTACK, @@ -878,16 +978,19 @@ static void _e_comp_wl_subsurface_destroy(struct wl_resource *resource) { E_Client *ec = wl_resource_get_user_data(resource); + E_Comp_Wl_Client_Data *cdata = NULL; if (!e_object_unref(E_OBJECT(ec))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if ((ec->comp_data) && (ec->comp_data->sub.data)) + if (cdata->sub.data) { - if (ec->comp_data->sub.data->parent) - _e_comp_wl_subsurface_remove_from_parent(ec->comp_data->sub.data->parent, ec); - _e_comp_wl_subsurface_data_destroy(ec->comp_data->sub.data); - ec->comp_data->sub.data = NULL; + if (cdata->sub.data->parent) + _e_comp_wl_subsurface_remove_from_parent(cdata->sub.data->parent, ec); + _e_comp_wl_subsurface_data_destroy(cdata->sub.data); + cdata->sub.data = NULL; } } @@ -899,8 +1002,8 @@ _e_comp_wl_subsurface_synchronized_get(E_Comp_Wl_Subsurf_Data *sdata) if (sdata->synchronized) return EINA_TRUE; if (!sdata->parent) return EINA_FALSE; - if (!sdata->parent->comp_data) return EINA_FALSE; if (e_object_is_del(E_OBJECT(sdata->parent))) return EINA_FALSE; + if (!e_client_cdata_get(sdata->parent)) return EINA_FALSE; sdata = _e_comp_wl_subsurface_data_get(sdata->parent); } @@ -911,13 +1014,16 @@ _e_comp_wl_subsurface_synchronized_get(E_Comp_Wl_Subsurf_Data *sdata) static Eina_Bool _e_comp_wl_subsurface_circular_reference_check(E_Client *ec, E_Client *parent) { + E_Comp_Wl_Client_Data *parent_cdata = NULL; + while(parent) { if (ec == parent) return EINA_TRUE; - if ((parent->comp_data) && (parent->comp_data->sub.data)) - parent = parent->comp_data->sub.data->parent; + parent_cdata = e_client_cdata_get(parent); + if (parent_cdata && parent_cdata->sub.data) + parent = parent_cdata->sub.data->parent; else break; } @@ -962,6 +1068,8 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_ struct wl_resource *res; E_Comp_Wl_Subsurf_Data *sdata; E_Client *offscreen_parent = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *epc_cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(surface_resource, EINA_FALSE); @@ -974,7 +1082,9 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_ return EINA_FALSE; } - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; res = wl_resource_create(client, &wl_subsurface_interface, 1, id); if (!res) @@ -991,11 +1101,13 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_ return EINA_FALSE; } + epc_cdata = e_client_cdata_get(epc); + // reparent remote surface provider's subsurfaces - if ((epc->comp_data) && (epc->comp_data->remote_surface.onscreen_parent)) + if (epc_cdata && epc_cdata->remote_surface.onscreen_parent) { offscreen_parent = epc; - epc = epc->comp_data->remote_surface.onscreen_parent; + epc = epc_cdata->remote_surface.onscreen_parent; } // check parent relationship is a cycle @@ -1048,8 +1160,8 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_ /* TODO: add callbacks ?? */ - ec->comp_data->surface = surface_resource; - ec->comp_data->sub.data = sdata; + cdata->surface = surface_resource; + cdata->sub.data = sdata; ec->lock_user_location = 0; ec->lock_client_location = 0; @@ -1070,7 +1182,7 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_ /* Delete 'below_obj' if it was created before 'E_Client' becomes subsurface. * It's not for subsurface. */ - E_FREE_FUNC(ec->comp_data->sub.below_obj, evas_object_del); + E_FREE_FUNC(cdata->sub.below_obj, evas_object_del); /* Delete a listener for restack of evas. * There is no need to watch restack of evas for sub-surface because @@ -1105,12 +1217,13 @@ e_comp_wl_subsurface_order_commit(E_Client *ec) EINTERN Eina_Bool e_comp_wl_subsurface_commit(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); - - /* check for valid subcompositor data */ - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; sdata = _e_comp_wl_subsurface_data_get(ec); if (!sdata) return EINA_FALSE; @@ -1141,12 +1254,12 @@ e_comp_wl_subsurface_commit(E_Client *ec) else e_comp_wl_surface_commit(ec); - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { if (ec != subc) _e_comp_wl_subsurface_parent_commit(subc, EINA_FALSE); } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { if (ec != subc) _e_comp_wl_subsurface_parent_commit(subc, EINA_FALSE); @@ -1217,24 +1330,26 @@ EINTERN Eina_Bool e_comp_wl_normal_subsurface_has(E_Client *ec) { E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; - if (!ec->comp_data) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; /* if a leaf client is not video cliet */ - if (ec->comp_data->sub.data && !ec->comp_data->sub.below_list && - !ec->comp_data->sub.below_list_pending && - ((!ec->comp_data->video_client) && (!e_client_video_hw_composition_check(ec)))) + if (cdata->sub.data && !cdata->sub.below_list && + !cdata->sub.below_list_pending && + ((!cdata->video_client) && (!e_client_video_hw_composition_check(ec)))) return EINA_TRUE; - EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list_pending, l, subc) if (e_comp_wl_normal_subsurface_has(subc)) return EINA_TRUE; - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) if (e_comp_wl_normal_subsurface_has(subc)) return EINA_TRUE; @@ -1245,9 +1360,8 @@ EINTERN void e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec) { EINA_SAFETY_ON_NULL_RETURN(ec); - - if ((e_object_is_del(E_OBJECT(ec))) || (!ec->comp_data)) - return; + if (e_object_is_del(E_OBJECT(ec))) return; + if (!e_client_cdata_get(ec)) return; _e_comp_wl_subsurface_check_below_bg_rectangle(ec); } @@ -1361,8 +1475,9 @@ static const struct wl_subsurface_interface _e_subsurface_dummy_interface = static void _e_comp_wl_subsurface_invalid_parent_handle(E_Client *ec, struct wl_resource *resource) { - if (ec->comp_data->sub.watcher) - tizen_subsurface_watcher_send_message(ec->comp_data->sub.watcher, TIZEN_SUBSURFACE_WATCHER_MSG_PARENT_ID_INVALID); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + if (cdata->sub.watcher) + tizen_subsurface_watcher_send_message(cdata->sub.watcher, TIZEN_SUBSURFACE_WATCHER_MSG_PARENT_ID_INVALID); /* We have to create a subsurface resource here even though it's error case * because server will send the fatal error when a client destroy a subsurface object. @@ -1374,14 +1489,16 @@ _e_comp_wl_subsurface_invalid_parent_handle(E_Client *ec, struct wl_resource *re static void _e_comp_wl_subsurface_remove_from_parent(E_Client *parent, E_Client *subc) { - parent->comp_data->sub.list = - eina_list_remove(parent->comp_data->sub.list, subc); - parent->comp_data->sub.list_pending = - eina_list_remove(parent->comp_data->sub.list_pending, subc); - parent->comp_data->sub.below_list = - eina_list_remove(parent->comp_data->sub.below_list, subc); - parent->comp_data->sub.below_list_pending = - eina_list_remove(parent->comp_data->sub.below_list_pending, subc); + E_Comp_Wl_Client_Data *parent_cdata = e_client_cdata_get(parent); + + parent_cdata->sub.list = + eina_list_remove(parent_cdata->sub.list, subc); + parent_cdata->sub.list_pending = + eina_list_remove(parent_cdata->sub.list_pending, subc); + parent_cdata->sub.below_list = + eina_list_remove(parent_cdata->sub.below_list, subc); + parent_cdata->sub.below_list_pending = + eina_list_remove(parent_cdata->sub.below_list_pending, subc); if ((!_e_comp_wl_subsurface_data_get(parent)) && (_e_comp_wl_subsurface_empty_check(parent))) @@ -1392,29 +1509,30 @@ _e_comp_wl_subsurface_remove_from_parent(E_Client *parent, E_Client *subc) EVAS_CALLBACK_RESTACK, _e_comp_wl_subsurface_cb_evas_restack); } - - } static E_Comp_Wl_Subsurf_Data * _e_comp_wl_subsurface_data_get(E_Client *ec) { - return (ec->comp_data) ? (ec->comp_data->sub.data) : NULL; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + return (cdata) ? (cdata->sub.data) : NULL; } static void _e_comp_wl_subsurface_stack_update(E_Client *ec) { E_Client *topmost; + E_Comp_Wl_Client_Data *cdata = NULL; - if (!ec->comp_data) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (ec->comp_data->sub.restacking) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (cdata->sub.restacking) return; /* return if ec isn't both a parent of a subsurface and a subsurface itself */ - if (!ec->comp_data->sub.list && !ec->comp_data->sub.below_list && !ec->comp_data->sub.data) + if (!cdata->sub.list && !cdata->sub.below_list && !cdata->sub.data) { - if (ec->comp_data->sub.below_obj) + if (cdata->sub.below_obj) _e_comp_wl_subsurface_restack_bg_rectangle(ec); return; } @@ -1425,23 +1543,25 @@ _e_comp_wl_subsurface_stack_update(E_Client *ec) _e_comp_wl_subsurface_restack_bg_rectangle(topmost); //To update client stack list - if ((ec->comp_data->sub.data) && - (ec->comp_data->sub.data->parent)) + if ((cdata->sub.data) && + (cdata->sub.data->parent)) { E_Client *parent; + E_Comp_Wl_Client_Data *parent_cdata = NULL; Evas_Object *o; - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; + parent_cdata = e_client_cdata_get(parent); - if ((parent->comp_data->sub.list) && - (eina_list_data_find(parent->comp_data->sub.list, ec))) + if ((parent_cdata->sub.list) && + (eina_list_data_find(parent_cdata->sub.list, ec))) { //stack above done o = evas_object_below_get(ec->frame); e_comp_object_layer_update(ec->frame, o, NULL); } - else if ((parent->comp_data->sub.below_list) && - (eina_list_data_find(parent->comp_data->sub.below_list, ec))) + else if ((parent_cdata->sub.below_list) && + (eina_list_data_find(parent_cdata->sub.below_list, ec))) { //stack below done o = evas_object_above_get(ec->frame); @@ -1454,10 +1574,12 @@ static void _e_comp_wl_subsurface_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { E_Client *topmost; + E_Comp_Wl_Client_Data *topmost_cdata; /* Given data must be a topmost E_Client of subsurfaces. */ topmost = data; - if (topmost->comp_data->sub.restacking) + topmost_cdata = e_client_cdata_get(topmost); + if (topmost_cdata->sub.restacking) { ELOGF("SUB-COMP", "A topmost parent is getting restacked", topmost); return; @@ -1470,17 +1592,20 @@ _e_comp_wl_subsurface_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Obje static Eina_Bool _e_comp_wl_subsurface_empty_check(E_Client *ec) { - return (!ec->comp_data) || - ((eina_list_count(ec->comp_data->sub.list) == 0) && - (eina_list_count(ec->comp_data->sub.list_pending) == 0) && - (eina_list_count(ec->comp_data->sub.below_list) == 0) && - (eina_list_count(ec->comp_data->sub.below_list_pending) == 0)); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + + return (!cdata) || + ((eina_list_count(cdata->sub.list) == 0) && + (eina_list_count(cdata->sub.list_pending) == 0) && + (eina_list_count(cdata->sub.below_list) == 0) && + (eina_list_count(cdata->sub.below_list_pending) == 0)); } static void _e_comp_wl_subsurface_parent_link(E_Comp_Wl_Subsurf_Data *sdata, E_Client *subc, E_Client *epc) { E_Layer layer; + E_Comp_Wl_Client_Data *epc_cdata = e_client_cdata_get(epc); sdata->parent = epc; @@ -1501,11 +1626,11 @@ _e_comp_wl_subsurface_parent_link(E_Comp_Wl_Subsurf_Data *sdata, E_Client *subc, } } - if (epc->comp_data) + if (epc_cdata) { /* append this client to the parents subsurface list */ - epc->comp_data->sub.list_pending = - eina_list_append(epc->comp_data->sub.list_pending, subc); - epc->comp_data->sub.list_changed = EINA_TRUE; + epc_cdata->sub.list_pending = + eina_list_append(epc_cdata->sub.list_pending, subc); + epc_cdata->sub.list_changed = EINA_TRUE; } } diff --git a/src/bin/e_comp_wl_viewport.c b/src/bin/e_comp_wl_viewport.c index c2d110f5c0..7f0fcb5327 100644 --- a/src/bin/e_comp_wl_viewport.c +++ b/src/bin/e_comp_wl_viewport.c @@ -108,17 +108,21 @@ static E_Client* _topmost_parent_get(E_Client *ec) { E_Client *parent = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *parent_cdata = NULL; - if (!ec->comp_data || !ec->comp_data->sub.data) + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->sub.data) return ec; - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; while (parent) { - if (!parent->comp_data || !parent->comp_data->sub.data) + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata || !parent_cdata->sub.data) return parent; - parent = parent->comp_data->sub.data->parent; + parent = parent_cdata->sub.data->parent; } return ec; @@ -128,6 +132,7 @@ static void _destroy_viewport(E_Viewport *viewport) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!viewport) return; @@ -157,15 +162,16 @@ _destroy_viewport(E_Viewport *viewport) if (viewport->dst_mode_res) wl_resource_set_user_data(viewport->dst_mode_res, NULL); - if (ec->comp_data && ec->comp_data->scaler.viewport) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->scaler.viewport) { - ec->comp_data->scaler.viewport = NULL; - ec->comp_data->scaler.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); - ec->comp_data->scaler.buffer_viewport.surface.width = -1; - ec->comp_data->scaler.buffer_viewport.changed = 1; - ec->comp_data->pending.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); - ec->comp_data->pending.buffer_viewport.surface.width = -1; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->scaler.viewport = NULL; + cdata->scaler.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); + cdata->scaler.buffer_viewport.surface.width = -1; + cdata->scaler.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); + cdata->pending.buffer_viewport.surface.width = -1; + cdata->pending.buffer_viewport.changed = 1; } PIN("tizen_viewport@%d destroy. viewport(%p)", wl_resource_get_id(viewport->resource), viewport); @@ -248,10 +254,13 @@ _e_comp_wl_viewport_parent_check(E_Viewport *viewport) { E_Client *ec = viewport->ec; E_Client *new_parent; + E_Comp_Wl_Client_Data *cdata = NULL; - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - new_parent = (ec->comp_data->sub.data) ? ec->comp_data->sub.data->parent : NULL; + new_parent = (cdata->sub.data) ? cdata->sub.data->parent : NULL; if (viewport->epc == new_parent) return; @@ -275,6 +284,8 @@ _e_comp_wl_viewport_set_changed(E_Viewport *viewport) { E_Client *ec; E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *subc_cdata = NULL; Eina_List *l; E_Viewport *sub_viewport; @@ -283,21 +294,26 @@ _e_comp_wl_viewport_set_changed(E_Viewport *viewport) viewport->current.changed = EINA_TRUE; ec = viewport->ec; - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + cdata = e_client_cdata_get(ec); + EINA_LIST_FOREACH(cdata->sub.list, l, subc) { - if (!subc || !subc->comp_data || e_object_is_del(E_OBJECT(subc))) - continue; + if (!subc) continue; + if (e_object_is_del(E_OBJECT(subc))) continue; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata) continue; - sub_viewport = _e_comp_wl_viewport_get_viewport(subc->comp_data->scaler.viewport); + sub_viewport = _e_comp_wl_viewport_get_viewport(subc_cdata->scaler.viewport); _e_comp_wl_viewport_set_changed(sub_viewport); } - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { - if (!subc || !subc->comp_data || e_object_is_del(E_OBJECT(subc))) - continue; + if (!subc) continue; + if (e_object_is_del(E_OBJECT(subc))) continue; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata) continue; - sub_viewport = _e_comp_wl_viewport_get_viewport(subc->comp_data->scaler.viewport); + sub_viewport = _e_comp_wl_viewport_get_viewport(subc_cdata->scaler.viewport); _e_comp_wl_viewport_set_changed(sub_viewport); } } @@ -1014,11 +1030,14 @@ _get_parent_transform(E_Viewport *viewport) { E_Client *epc = viewport->epc; E_Client *topmost; + E_Comp_Wl_Client_Data *epc_cdata = NULL; unsigned int ptran, pflip; int ptransform; - if (!epc->comp_data || e_object_is_del(E_OBJECT(epc))) - return 0; + if (!epc) return 0; + if (e_object_is_del(E_OBJECT(epc))) return 0; + epc_cdata = e_client_cdata_get(epc); + if (!epc_cdata) return 0; ptransform = e_comp_wl_output_buffer_transform_get(epc); @@ -1134,7 +1153,9 @@ _destination_mode_calculate_destination(E_Viewport *viewport, Eina_Rectangle *pr { int ptransform; - if (!epc->comp_data || e_object_is_del(E_OBJECT(epc))) + if (e_object_is_del(E_OBJECT(epc))) + return EINA_FALSE; + if (!e_client_cdata_get(epc)) return EINA_FALSE; ptransform = e_comp_wl_output_buffer_transform_get(epc); @@ -1340,7 +1361,8 @@ static Eina_Bool _e_comp_wl_viewport_apply_transform(E_Viewport *viewport, int *rtransform) { E_Client *ec = viewport->ec; - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; Eina_Bool changed = EINA_FALSE; unsigned int new_transform; @@ -1352,7 +1374,7 @@ _e_comp_wl_viewport_apply_transform(E_Viewport *viewport, int *rtransform) unsigned int pwtran, ptran, pflip, ctran, cflip; int ptransform; - if (!epc->comp_data || e_object_is_del(E_OBJECT(epc))) + if (!e_client_cdata_get(epc) || e_object_is_del(E_OBJECT(epc))) { *rtransform = vp->buffer.transform; return EINA_FALSE; @@ -1377,9 +1399,9 @@ _e_comp_wl_viewport_apply_transform(E_Viewport *viewport, int *rtransform) vp->buffer.transform = new_transform; vp->changed = changed = EINA_TRUE; - ec->comp_data->pending.buffer_viewport = *vp; - if (ec->comp_data->sub.data) - ec->comp_data->sub.data->cached.buffer_viewport = *vp; + cdata->pending.buffer_viewport = *vp; + if (cdata->sub.data) + cdata->sub.data->cached.buffer_viewport = *vp; } if (changed) @@ -1396,11 +1418,12 @@ static Eina_Bool _e_comp_wl_viewport_apply_destination(E_Viewport *viewport, Eina_Rectangle *rrect) { E_Client *ec = viewport->ec; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Comp_Wl_Buffer_Viewport *vp; Eina_Rectangle dst = {0,}, prect; Eina_Bool changed = EINA_FALSE; - vp = &ec->comp_data->scaler.buffer_viewport; + vp = &cdata->scaler.buffer_viewport; if (!viewport->epc) { E_Zone *zone = e_comp_zone_xy_get(ec->x, ec->y); @@ -1414,12 +1437,13 @@ _e_comp_wl_viewport_apply_destination(E_Viewport *viewport, Eina_Rectangle *rrec else { E_Client *epc = viewport->epc; + E_Comp_Wl_Client_Data *epc_cdata = e_client_cdata_get(epc); E_Comp_Wl_Buffer_Viewport *vpp; - if (!epc->comp_data || e_object_is_del(E_OBJECT(epc))) + if (!epc_cdata || e_object_is_del(E_OBJECT(epc))) return EINA_FALSE; - vpp = &epc->comp_data->scaler.buffer_viewport; + vpp = &epc_cdata->scaler.buffer_viewport; prect.x = prect.y = 0; if (vpp->surface.width != -1) { @@ -1456,14 +1480,14 @@ _e_comp_wl_viewport_apply_destination(E_Viewport *viewport, Eina_Rectangle *rrec _e_comp_wl_viewport_crop_by_parent(viewport, &prect, &dst); /* The values of below x, y, w, h are specified in the transform 0 and in the parent */ - if (ec->comp_data->sub.data) + if (cdata->sub.data) { - if (ec->comp_data->sub.data->position.x != dst.x || - ec->comp_data->sub.data->position.y != dst.y) + if (cdata->sub.data->position.x != dst.x || + cdata->sub.data->position.y != dst.y) { - ec->comp_data->sub.data->position.x = dst.x; - ec->comp_data->sub.data->position.y = dst.y; - ec->comp_data->sub.data->position.set = EINA_TRUE; + cdata->sub.data->position.x = dst.x; + cdata->sub.data->position.y = dst.y; + cdata->sub.data->position.set = EINA_TRUE; vp->changed = changed = EINA_TRUE; } } @@ -1480,9 +1504,9 @@ _e_comp_wl_viewport_apply_destination(E_Viewport *viewport, Eina_Rectangle *rrec vp->surface.height = dst.h; vp->changed = changed = EINA_TRUE; - ec->comp_data->pending.buffer_viewport = *vp; - if (ec->comp_data->sub.data) - ec->comp_data->sub.data->cached.buffer_viewport = *vp; + cdata->pending.buffer_viewport = *vp; + if (cdata->sub.data) + cdata->sub.data->cached.buffer_viewport = *vp; } *rrect = dst; @@ -1497,7 +1521,8 @@ static Eina_Bool _e_comp_wl_viewport_apply_source(E_Viewport *viewport) { E_Client *ec = viewport->ec; - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; Eina_Rectangle rect = {0,}; int bw = 0, bh = 0; wl_fixed_t fx, fy, fw, fh; @@ -1535,9 +1560,9 @@ _e_comp_wl_viewport_apply_source(E_Viewport *viewport) vp->buffer.src_height = wl_fixed_from_int(rect.h); vp->changed = changed = EINA_TRUE; - ec->comp_data->pending.buffer_viewport = *vp; - if (ec->comp_data->sub.data) - ec->comp_data->sub.data->cached.buffer_viewport = *vp; + cdata->pending.buffer_viewport = *vp; + if (cdata->sub.data) + cdata->sub.data->cached.buffer_viewport = *vp; } if (changed) @@ -1552,19 +1577,22 @@ e_comp_wl_viewport_apply(E_Client *ec) { E_Viewport *viewport; E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) - return EINA_FALSE; + if (!ec) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; - viewport = _e_comp_wl_viewport_get_viewport(ec->comp_data->scaler.viewport); + viewport = _e_comp_wl_viewport_get_viewport(cdata->scaler.viewport); if (viewport) _e_comp_wl_viewport_parent_check(viewport); - if (viewport && ec->comp_data->buffer_ref.buffer) + if (viewport && cdata->buffer_ref.buffer) { - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; Eina_Bool changed = EINA_FALSE, src_changed = EINA_FALSE; Eina_Rectangle rrect = {0,}; int rtransform = 0; @@ -1598,12 +1626,12 @@ e_comp_wl_viewport_apply(E_Client *ec) } } else if (viewport) - PDB("%p buffer", ec->comp_data->buffer_ref.buffer); + PDB("%p buffer", cdata->buffer_ref.buffer); - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) e_comp_wl_viewport_apply(subc); - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) e_comp_wl_viewport_apply(subc); return EINA_TRUE; @@ -1614,20 +1642,23 @@ e_comp_wl_viewport_is_changed(E_Client *ec) { E_Viewport *viewport; E_Client *subc; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec))) - return EINA_FALSE; + if (!ec) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (!cdata) return EINA_FALSE; - viewport = _e_comp_wl_viewport_get_viewport(ec->comp_data->scaler.viewport); + viewport = _e_comp_wl_viewport_get_viewport(cdata->scaler.viewport); if(viewport && viewport->current.changed) return EINA_TRUE; - EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + EINA_LIST_FOREACH(cdata->sub.list, l, subc) if (e_comp_wl_viewport_is_changed(subc)) return EINA_TRUE; - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) if (e_comp_wl_viewport_is_changed(subc)) return EINA_TRUE; @@ -1648,7 +1679,9 @@ _e_comp_wl_viewport_cb_apply_viewport(struct wl_listener *listener, void *data) E_Viewport *viewport = container_of(listener, E_Viewport, surface_apply_viewport_listener); E_Client *ec = viewport->ec; E_Client *topmost = _topmost_parent_get(ec); - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + E_Comp_Wl_Client_Data *epc_cdata = NULL; + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; Eina_Bool changed = EINA_FALSE; if (vp->changed) @@ -1673,8 +1706,12 @@ _e_comp_wl_viewport_cb_apply_viewport(struct wl_listener *listener, void *data) _e_comp_wl_viewport_parent_check(viewport); if (!viewport->current.changed) return; - if (!ec->comp_data->buffer_ref.buffer) return; - if (viewport->epc && !viewport->epc->comp_data->buffer_ref.buffer) return; + if (!cdata->buffer_ref.buffer) return; + if (viewport->epc) + { + epc_cdata = e_client_cdata_get(viewport->epc); + if (!epc_cdata) return; + } PDB("apply: topmost(%p)", topmost); @@ -1709,18 +1746,32 @@ e_comp_wl_viewport_create(struct wl_resource *resource, struct wl_resource *surface) { E_Client *ec = wl_resource_get_user_data(surface); + E_Comp_Wl_Client_Data *cdata = NULL; int version = wl_resource_get_version(resource); struct wl_client *client; struct wl_resource *res; E_Viewport *viewport; - if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec)) || !ec->comp_data->surface) + if (!ec || e_object_is_del(E_OBJECT(ec))) { ERR("wrong resource %d", wl_resource_get_id(surface)); return EINA_FALSE; } - if (ec->comp_data->scaler.viewport) + cdata = e_client_cdata_get(ec); + if (!cdata) + { + ERR("no cdata"); + return EINA_FALSE; + } + + if (!cdata->surface) + { + ERR("wrong resource %d.(cdata->surface)", wl_resource_get_id(surface)); + return EINA_FALSE; + } + + if (cdata->scaler.viewport) { ERR("wl_surface@%d already has a viewport", wl_resource_get_id(surface)); @@ -1771,15 +1822,15 @@ e_comp_wl_viewport_create(struct wl_resource *resource, viewport->cropped_source.w = -1; viewport->surface_apply_viewport_listener.notify = _e_comp_wl_viewport_cb_apply_viewport; - wl_signal_add(&ec->comp_data->apply_viewport_signal, &viewport->surface_apply_viewport_listener); + wl_signal_add(&cdata->apply_viewport_signal, &viewport->surface_apply_viewport_listener); /* Use scaler variable because tizen_viewport is the alternative of wl_viewport */ - ec->comp_data->scaler.viewport = res; + cdata->scaler.viewport = res; wl_resource_set_implementation(res, &_e_comp_wl_viewport_interface, viewport, _e_comp_wl_viewport_destroy); viewport->surface_destroy_listener.notify = _e_comp_wl_viewport_cb_surface_destroy; - wl_resource_add_destroy_listener(ec->comp_data->surface, &viewport->surface_destroy_listener); + wl_resource_add_destroy_listener(cdata->surface, &viewport->surface_destroy_listener); PIN("tizen_viewport@%d viewport(%p) created", id, viewport); @@ -1819,14 +1870,17 @@ _e_comp_wl_viewport_print(void *data, const char *log_path) for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o)) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Viewport *viewport; Ecore_Window win = 0; const char *name = NULL; ec = evas_object_data_get(o, "E_Client"); - if (!ec || e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) continue; + if (!ec || e_object_is_del(E_OBJECT(ec))) continue; + cdata = e_client_cdata_get(ec); + if (!cdata) continue; - viewport = _e_comp_wl_viewport_get_viewport(ec->comp_data->scaler.viewport); + viewport = _e_comp_wl_viewport_get_viewport(cdata->scaler.viewport); if (!viewport) continue; if (first_line) @@ -1903,16 +1957,18 @@ static void _e_viewport_destroy(struct wl_resource *resource) { E_Client *ec = wl_resource_get_user_data(resource); + E_Comp_Wl_Client_Data *cdata = NULL; if (!e_object_unref(E_OBJECT(ec))) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (!ec->comp_data) return; - if (!ec->comp_data->scaler.viewport) return; - - ec->comp_data->scaler.viewport = NULL; - ec->comp_data->pending.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); - ec->comp_data->pending.buffer_viewport.surface.width = -1; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->scaler.viewport) return; + + cdata->scaler.viewport = NULL; + cdata->pending.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); + cdata->pending.buffer_viewport.surface.width = -1; + cdata->pending.buffer_viewport.changed = 1; } static void @@ -1932,11 +1988,13 @@ _e_viewport_cb_set(struct wl_client *client EINA_UNUSED, int32_t dst_height) { E_Client *ec = wl_resource_get_user_data(resource); + E_Comp_Wl_Client_Data *cdata = NULL; if (e_object_is_del(E_OBJECT(ec))) return; - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data->scaler.viewport); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); + EINA_SAFETY_ON_NULL_RETURN(cdata->scaler.viewport); if (wl_fixed_to_double(src_width) < 0 || wl_fixed_to_double(src_height) < 0) { @@ -1951,13 +2009,13 @@ _e_viewport_cb_set(struct wl_client *client EINA_UNUSED, return; } - ec->comp_data->pending.buffer_viewport.buffer.src_x = src_x; - ec->comp_data->pending.buffer_viewport.buffer.src_y = src_y; - ec->comp_data->pending.buffer_viewport.buffer.src_width = src_width; - ec->comp_data->pending.buffer_viewport.buffer.src_height = src_height; - ec->comp_data->pending.buffer_viewport.surface.width = dst_width; - ec->comp_data->pending.buffer_viewport.surface.height = dst_height; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.buffer.src_x = src_x; + cdata->pending.buffer_viewport.buffer.src_y = src_y; + cdata->pending.buffer_viewport.buffer.src_width = src_width; + cdata->pending.buffer_viewport.buffer.src_height = src_height; + cdata->pending.buffer_viewport.surface.width = dst_width; + cdata->pending.buffer_viewport.surface.height = dst_height; + cdata->pending.buffer_viewport.changed = 1; } static void @@ -1969,17 +2027,19 @@ _e_viewport_cb_set_source(struct wl_client *client EINA_UNUSED, wl_fixed_t src_height) { E_Client *ec = wl_resource_get_user_data(resource); + E_Comp_Wl_Client_Data *cdata = NULL; if (e_object_is_del(E_OBJECT(ec))) return; - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data->scaler.viewport); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); + EINA_SAFETY_ON_NULL_RETURN(cdata->scaler.viewport); if (src_width == wl_fixed_from_int(-1) && src_height == wl_fixed_from_int(-1)) { /* unset source size */ - ec->comp_data->pending.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); + cdata->pending.buffer_viewport.changed = 1; return; } @@ -1990,11 +2050,11 @@ _e_viewport_cb_set_source(struct wl_client *client EINA_UNUSED, return; } - ec->comp_data->pending.buffer_viewport.buffer.src_x = src_x; - ec->comp_data->pending.buffer_viewport.buffer.src_y = src_y; - ec->comp_data->pending.buffer_viewport.buffer.src_width = src_width; - ec->comp_data->pending.buffer_viewport.buffer.src_height = src_height; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.buffer.src_x = src_x; + cdata->pending.buffer_viewport.buffer.src_y = src_y; + cdata->pending.buffer_viewport.buffer.src_width = src_width; + cdata->pending.buffer_viewport.buffer.src_height = src_height; + cdata->pending.buffer_viewport.changed = 1; } static void @@ -2004,17 +2064,19 @@ _e_viewport_cb_set_destination(struct wl_client *client EINA_UNUSED, int32_t dst_height) { E_Client *ec = wl_resource_get_user_data(resource); + E_Comp_Wl_Client_Data *cdata = NULL; if (e_object_is_del(E_OBJECT(ec))) return; - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data->scaler.viewport); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); + EINA_SAFETY_ON_NULL_RETURN(cdata->scaler.viewport); if (dst_width == -1 && dst_height == -1) { /* unset destination size */ - ec->comp_data->pending.buffer_viewport.surface.width = -1; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.surface.width = -1; + cdata->pending.buffer_viewport.changed = 1; return; } @@ -2024,9 +2086,9 @@ _e_viewport_cb_set_destination(struct wl_client *client EINA_UNUSED, return; } - ec->comp_data->pending.buffer_viewport.surface.width = dst_width; - ec->comp_data->pending.buffer_viewport.surface.height = dst_height; - ec->comp_data->pending.buffer_viewport.changed = 1; + cdata->pending.buffer_viewport.surface.width = dst_width; + cdata->pending.buffer_viewport.surface.height = dst_height; + cdata->pending.buffer_viewport.changed = 1; } static const struct wl_viewport_interface _e_viewport_interface = @@ -2048,12 +2110,14 @@ _e_scaler_cb_get_viewport(struct wl_client *client EINA_UNUSED, struct wl_resour { int version = wl_resource_get_version(scaler); E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; if (!(ec = wl_resource_get_user_data(surface_resource))) return; - if (!ec->comp_data) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data && ec->comp_data->scaler.viewport) + if (cdata && cdata->scaler.viewport) { wl_resource_post_error(scaler, WL_SCALER_ERROR_VIEWPORT_EXISTS, @@ -2068,7 +2132,7 @@ _e_scaler_cb_get_viewport(struct wl_client *client EINA_UNUSED, struct wl_resour return; } - ec->comp_data->scaler.viewport = res; + cdata->scaler.viewport = res; wl_resource_set_implementation(res, &_e_viewport_interface, ec, _e_viewport_destroy); e_object_ref(E_OBJECT(ec)); } diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c index f7955a8dfb..58abaf1f65 100644 --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@ -836,6 +836,7 @@ E_API void e_desk_geometry_set(E_Desk *desk, int x, int y, int w, int h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Maximize max; Eina_List *l = NULL, *ll = NULL; Evas_Object *m; @@ -864,6 +865,7 @@ e_desk_geometry_set(E_Desk *desk, int x, int y, int w, int h) EINA_LIST_FOREACH(sd->clients, l, ec) { + cdata = e_client_cdata_get(ec); /* even if the desktop geometry is chagned, the system partial windows such as virtual * keyboard and clipboard should be placed at the bottom of the desktop. */ /* QUICK FIX */ @@ -871,7 +873,7 @@ e_desk_geometry_set(E_Desk *desk, int x, int y, int w, int h) { continue; } - else if ((ec->comp_data) && (ec->comp_data->sub.data)) + else if (cdata && cdata->sub.data) { continue; } @@ -925,6 +927,7 @@ _animator_cb(void *data, double pos) { E_Desk *desk; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; int cx, cy; double zoomx, zoomy; @@ -949,8 +952,9 @@ _animator_cb(void *data, double pos) EINA_LIST_FOREACH(sd->clients, l, ec) { + cdata = e_client_cdata_get(ec); if ((ec->visibility.obscured == E_VISIBILITY_UNOBSCURED) || - (ec->comp_data && ec->comp_data->sub.data)) + (cdata && cdata->sub.data)) _e_desk_client_zoom(ec, zoomx, zoomy, cx, cy); } diff --git a/src/bin/e_desk_group.c b/src/bin/e_desk_group.c index 53f48d4b29..f3ced5a5d1 100644 --- a/src/bin/e_desk_group.c +++ b/src/bin/e_desk_group.c @@ -189,13 +189,15 @@ e_desk_group_del(E_Desk_Group *edg) void _e_desk_group_ec_geometry_apply(E_Desk_Group *edg, E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Util_Transform *transform; transform = ec->desk_group.transform; if (!transform) return; // skip subsurface - if (ec->comp_data && ec->comp_data->sub.data) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->sub.data) return; e_util_transform_move(transform, edg->x, edg->y, 0); diff --git a/src/bin/e_devicemgr_wl.c b/src/bin/e_devicemgr_wl.c index cf980ff461..572b63b6ee 100644 --- a/src/bin/e_devicemgr_wl.c +++ b/src/bin/e_devicemgr_wl.c @@ -221,16 +221,18 @@ e_devicemgr_wl_detent_send_event(int detent) Eina_List *l, *ll; wl_fixed_t f_value; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = e_client_focused_get(); if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; if (ec->ignored) return; - if (!ec->comp_data || !ec->comp_data->surface) return; + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->surface) return; f_value = wl_fixed_from_double(detent * 1.0); - wc = wl_resource_get_client(ec->comp_data->surface); + wc = wl_resource_get_client(cdata->surface); EINA_LIST_FOREACH(e_devicemgr->device_list, l, input_dev) { diff --git a/src/bin/e_eom.c b/src/bin/e_eom.c index 3f2f62718a..d3dc98b412 100644 --- a/src/bin/e_eom.c +++ b/src/bin/e_eom.c @@ -353,6 +353,7 @@ _e_eom_output_by_ec_child_get(E_Client *ec) { E_EomOutputPtr eom_output = NULL; E_Client *parent_ec = NULL, *output_ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL, *parent_cdata = NULL; Eina_List *l; EINA_LIST_FOREACH(g_eom->eom_outputs, l, eom_output) @@ -362,17 +363,19 @@ _e_eom_output_by_ec_child_get(E_Client *ec) if (output_ec == ec) return eom_output; - if (!ec->comp_data) continue; - if (!ec->comp_data->sub.data) continue; + cdata = e_client_cdata_get(ec); + if (!cdata) continue; + if (!cdata->sub.data) continue; - parent_ec = ec->comp_data->sub.data->parent; + parent_ec = cdata->sub.data->parent; while (parent_ec) { if (parent_ec == output_ec) return eom_output; - if (!parent_ec->comp_data) break; - if (!parent_ec->comp_data->sub.data) break; + parent_cdata = e_client_cdata_get(parent_ec); + if (!parent_cdata) break; + if (!parent_cdata->sub.data) break; - parent_ec = parent_ec->comp_data->sub.data->parent; + parent_ec = parent_cdata->sub.data->parent; } } @@ -382,12 +385,12 @@ _e_eom_output_by_ec_child_get(E_Client *ec) static void _e_eom_output_send_configure_event(E_EomOutput *eom_output, E_Client *ec) { - E_Comp_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; E_EomCompObjectInterceptHookData *hook_data = NULL; E_Comp_Object_Intercept_Hook *hook = NULL; int w, h; - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); EINA_SAFETY_ON_NULL_RETURN(cdata); EINA_SAFETY_ON_NULL_RETURN(cdata->shell.configure_send); @@ -406,7 +409,7 @@ _e_eom_output_send_configure_event(E_EomOutput *eom_output, E_Client *ec) /* get the output size */ e_output_size_get(eom_output->output, &w, &h); - cdata->shell.configure_send(ec->comp_data->shell.surface, 0, w, h); + cdata->shell.configure_send(cdata->shell.surface, 0, w, h); EOMINF("Send Configure Event for Presentation (%d X %d)", ec, eom_output->output, w, h); @@ -452,22 +455,25 @@ _e_eom_client_get_current_by_ec_parrent(E_Client *ec) Eina_List *l; E_EomClientPtr client; E_Client *parent = NULL; + E_Comp_Wl_Client_Data *cdata = NULL, *parent_cdata = NULL; - if (!ec->comp_data || !ec->comp_data->sub.data) + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->sub.data) return NULL; EINA_LIST_FOREACH(g_eom->clients, l, client) { - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; while (parent) { if (client->ec == parent) return client; - if (!parent->comp_data || !parent->comp_data->sub.data) + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata || !parent_cdata->sub.data) break; - parent = parent->comp_data->sub.data->parent; + parent = parent_cdata->sub.data->parent; } } diff --git a/src/bin/e_explicit_sync.c b/src/bin/e_explicit_sync.c index 1db20c16ff..b2ec472f74 100644 --- a/src/bin/e_explicit_sync.c +++ b/src/bin/e_explicit_sync.c @@ -31,11 +31,10 @@ static Eina_Bool ex_sync_trace = EINA_FALSE; static E_Comp_Wl_Buffer * _e_explicit_sync_comp_wl_buffer_get(E_Client *ec) { - E_Comp_Client_Data *cdata; + E_Comp_Wl_Client_Data *cdata; if (!ec) return NULL; - - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; return cdata->buffer_ref.buffer; diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index 2d56dded23..cd1fda3cb5 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -268,7 +268,7 @@ e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, con Eina_List *l; if (!cp) return EINA_FALSE; - cdata = (E_Comp_Wl_Client_Data*)e_pixmap_cdata_get(cp); + cdata = e_pixmap_cdata_get(cp); if (!cdata) return EINA_FALSE; EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) @@ -322,7 +322,7 @@ e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, const char *val) Eina_Bool found = EINA_FALSE; if (!cp) return EINA_FALSE; - cdata = (E_Comp_Wl_Client_Data*)e_pixmap_cdata_get(cp); + cdata = e_pixmap_cdata_get(cp); if (!cdata) return EINA_FALSE; EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) @@ -362,7 +362,7 @@ e_hints_aux_hint_del_with_pixmap(E_Pixmap *cp, int32_t id) int res = -1; if (!cp) return EINA_FALSE; - cdata = (E_Comp_Wl_Client_Data*)e_pixmap_cdata_get(cp); + cdata = e_pixmap_cdata_get(cp); if (!cdata) return EINA_FALSE; EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint) @@ -393,7 +393,7 @@ e_hints_aux_hint_value_get_with_pixmap(E_Pixmap *cp, const char *name) const char *res = NULL; if (!cp) return NULL; - cdata = (E_Comp_Wl_Client_Data*)e_pixmap_cdata_get(cp); + cdata = e_pixmap_cdata_get(cp); if (!cdata) return NULL; EINA_LIST_REVERSE_FOREACH(cdata->aux_hint.hints, l, hint) diff --git a/src/bin/e_hwc_planes.c b/src/bin/e_hwc_planes.c index b840641443..ee01fa28a2 100644 --- a/src/bin/e_hwc_planes.c +++ b/src/bin/e_hwc_planes.c @@ -18,7 +18,7 @@ e_hwc_planes_deinit(void) static Eina_Bool _e_hwc_planes_ec_check(E_Client *ec) { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Output *eout; int minw = 0, minh = 0; int transform; diff --git a/src/bin/e_hwc_window.c b/src/bin/e_hwc_window.c index e2984d0d8f..6aa018d38a 100644 --- a/src/bin/e_hwc_window.c +++ b/src/bin/e_hwc_window.c @@ -152,7 +152,7 @@ _e_hwc_window_comp_wl_buffer_get(E_Hwc_Window *hwc_window) if (!ec) return NULL; - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; return cdata->buffer_ref.buffer; @@ -170,7 +170,7 @@ _get_wayland_tbm_client_queue(E_Client *ec) if (!ec) return NULL; - cdata = (E_Comp_Wl_Client_Data *)e_pixmap_cdata_get(ec->pixmap); + cdata = e_pixmap_cdata_get(ec->pixmap); EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, NULL); wl_surface = cdata->wl_surface; @@ -565,7 +565,8 @@ _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window) } else { - EHWERR("unkown buffer type:%d", NULL, hwc_window->hwc, hwc_window, ec->comp_data->buffer_ref.buffer->type); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + EHWERR("unkown buffer type:%d", NULL, hwc_window->hwc, hwc_window, cdata->buffer_ref.buffer->type); return EINA_FALSE; } @@ -1874,7 +1875,7 @@ e_hwc_window_device_state_available_update(E_Hwc_Window *hwc_window) goto finish; } - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + cdata = e_client_cdata_get(ec); if ((!cdata) || (!cdata->buffer_ref.buffer)) { restriction = E_HWC_WINDOW_RESTRICTION_BUFFER; @@ -2131,7 +2132,7 @@ _e_hwc_window_client_recover(E_Hwc_Window *hwc_window, Eina_Bool *clear_attach) e_hwc_window_name_get(hwc_window)); /* force update */ - if (ec->comp_data) + if (e_client_cdata_get(ec)) e_comp_wl_surface_attach(ec, recover_buffer); else { @@ -2192,7 +2193,7 @@ _e_hwc_window_rendered_window_set(E_Hwc_Window *hwc_window, Eina_Bool set) hwc_window->ec, hwc_window->hwc, hwc_window, e_hwc_window_name_get(hwc_window)); } - if (clear_attach && ec->comp_data) + if (clear_attach && e_client_cdata_get(ec)) e_comp_wl_surface_attach(ec, NULL); } else diff --git a/src/bin/e_hwc_window_queue.c b/src/bin/e_hwc_window_queue.c index 4880b43df7..1df43d8b1c 100644 --- a/src/bin/e_hwc_window_queue.c +++ b/src/bin/e_hwc_window_queue.c @@ -116,7 +116,7 @@ _user_cqueue_get(E_Client *ec) if (!ec) return NULL; - cdata = (E_Comp_Wl_Client_Data *)e_pixmap_cdata_get(ec->pixmap); + cdata = e_pixmap_cdata_get(ec->pixmap); if (!cdata) return NULL; wl_surface = cdata->wl_surface; @@ -160,7 +160,7 @@ _comp_wl_buffer_get(E_Client *ec) if (!ec) return NULL; - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; return cdata->buffer_ref.buffer; @@ -830,7 +830,8 @@ _e_hwc_window_queue_backup_buffer_set(E_Hwc_Window *hwc_window, Eina_Bool attach } else { - e_comp_wl_buffer_reference(&ec->comp_data->buffer_ref, backup_buffer); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + e_comp_wl_buffer_reference(&cdata->buffer_ref, backup_buffer); e_pixmap_resource_set(ec->pixmap, backup_buffer); e_pixmap_dirty(ec->pixmap); e_pixmap_refresh(ec->pixmap); diff --git a/src/bin/e_hwc_windows.c b/src/bin/e_hwc_windows.c index 5ae94c93d3..edb7803be7 100644 --- a/src/bin/e_hwc_windows.c +++ b/src/bin/e_hwc_windows.c @@ -88,7 +88,7 @@ _e_hwc_windows_comp_wl_buffer_get(E_Hwc_Window *hwc_window) if (!ec) return NULL; - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; return cdata->buffer_ref.buffer; @@ -248,12 +248,14 @@ _e_hwc_windows_presentation_feedback_take(E_Hwc_Window *hwc_window) else { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = hwc_window->ec; if (!ec) return; - if (!ec->comp_data) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - container = &ec->comp_data->presentation_container; + container = &cdata->presentation_container; } if (!container) return; @@ -1248,15 +1250,17 @@ _e_hwc_windows_target_window_render_flush_post_cb(void *data, Evas *e EINA_UNUSE EINA_LIST_FOREACH(rendered_windows, l, hwc_window) { E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; hwc_window->on_rendered_target = EINA_FALSE; ec = hwc_window->ec; if (!ec) continue; - if (buffer_comp_info && ec->comp_data) + cdata = e_client_cdata_get(ec); + if (buffer_comp_info && cdata) e_presentation_time_container_feedback_merge(&buffer_comp_info->presentation_container, - &ec->comp_data->presentation_container); + &cdata->presentation_container); buffer = e_pixmap_ref_resource_get(ec->pixmap); if (!buffer) @@ -3027,6 +3031,7 @@ _e_hwc_windows_pp_commit(E_Hwc *hwc) E_Hwc_Windows_Buffer_Comp_Info *pp_buffer_comp_info, *buffer_comp_info; tdm_error terror = TDM_ERROR_NONE; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE); @@ -3075,9 +3080,10 @@ _e_hwc_windows_pp_commit(E_Hwc *hwc) if (hwc->pp_hwc_window) { ec = hwc->pp_hwc_window->ec; - if ((ec) && (ec->comp_data)) + cdata = e_client_cdata_get(ec); + if (ec && cdata) e_presentation_time_container_feedback_merge(&pp_buffer_comp_info->presentation_container, - &ec->comp_data->presentation_container); + &cdata->presentation_container); } else { diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index 3dd4bc5557..f1023bebb9 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -253,8 +253,10 @@ _msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible) Eina_Bool mapped = EINA_FALSE; Eina_Bool transformed = EINA_FALSE; int x = 0, y = 0, w = 0, h = 0; + E_Comp_Wl_Client_Data *cdata = NULL; if (is_visible && e_client_util_ignored_get(ec)) continue; + cdata = e_client_cdata_get(ec); win = e_client_util_win_get(ec); e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name)); @@ -267,12 +269,8 @@ _msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible) pid = ec->netwm.pid; if (pid <= 0) { - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); } if (ec->iconic) @@ -285,8 +283,8 @@ _msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible) else iconified = 0; - if (ec->comp_data) - mapped = ec->comp_data->mapped; + if (cdata) + mapped = cdata->mapped; _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos); @@ -342,10 +340,12 @@ _msg_clients_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible) Eina_List *list_input_region = NULL; Eina_Bool mapped = EINA_FALSE; Eina_Bool transformed = EINA_FALSE; + E_Comp_Wl_Client_Data *cdata = NULL; ec = evas_object_data_get(o, "E_Client"); if (!ec) continue; if (is_visible && e_client_util_ignored_get(ec)) continue; + cdata = e_client_cdata_get(ec); win = e_client_util_win_get(ec); e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name)); @@ -358,12 +358,8 @@ _msg_clients_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible) pid = ec->netwm.pid; if (pid <= 0) { - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); } if (ec->iconic) @@ -376,8 +372,8 @@ _msg_clients_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible) else iconified = 0; - if (ec->comp_data) - mapped = ec->comp_data->mapped; + if (cdata) + mapped = cdata->mapped; _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos); @@ -874,14 +870,13 @@ _msg_connected_clients_append(Eldbus_Message_Iter *iter) { Eldbus_Message_Iter *array_of_ec; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Object *o; eldbus_message_iter_arguments_append(iter, "a(ss)", &array_of_ec); Eina_List *l; E_Comp_Connected_Client_Info *cinfo; - - Eldbus_Message_Iter* struct_of_ec; #define __CONNECTED_CLIENTS_ARG_APPEND_TYPE(title, str, x...) ({ \ @@ -903,17 +898,14 @@ _msg_connected_clients_append(Eldbus_Message_Iter *iter) ec = evas_object_data_get(o, "E_Client"); if (!ec) continue; if (e_client_util_ignored_get(ec)) continue; + cdata = e_client_cdata_get(ec); win = e_client_util_win_get(ec); if (ec->pixmap) res_id = e_pixmap_res_id_get(ec->pixmap); - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); if (cinfo->pid == pid) { __CONNECTED_CLIENTS_ARG_APPEND_TYPE("[E_Client Info]", "win:0x%08zx res_id:%5d, name:%20s, geo:(%4d, %4d, %4dx%4d), layer:%5d, visible:%d, argb:%d", @@ -1108,7 +1100,7 @@ fail: static const char* _get_win_prop_Rotation(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; int i, count; @@ -1163,7 +1155,7 @@ fail: static const char* _get_win_prop_Transform(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; int i, count; @@ -1221,23 +1213,22 @@ fail: static const char* _get_win_prop_Subsurface_Below_Child_List(const Evas_Object *evas_obj) { - const E_Comp_Wl_Client_Data *cdata; - const E_Client *ec; + E_Comp_Wl_Client_Data *cdata; + E_Client *ec; char *str = NULL; const Eina_List *list; const Eina_List *l; - const E_Client *child; + E_Client *child; ec = evas_object_data_get(evas_obj, "E_Client"); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (!ec->comp_data) + cdata = e_client_cdata_get(ec); + if (!cdata) return strdup("None"); - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; list = cdata->sub.below_list; - if (!list) return strdup("None"); @@ -1254,23 +1245,22 @@ fail: static const char* _get_win_prop_Subsurface_Child_List(const Evas_Object *evas_obj) { - const E_Comp_Wl_Client_Data *cdata; - const E_Client *ec; + E_Comp_Wl_Client_Data *cdata; + E_Client *ec; char *str = NULL; const Eina_List *list; const Eina_List *l; - const E_Client *child; + E_Client *child; ec = evas_object_data_get(evas_obj, "E_Client"); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (!ec->comp_data) + cdata = e_client_cdata_get(ec); + if (!cdata) return strdup("None"); - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; list = cdata->sub.list; - if (!list) return strdup("None"); @@ -1287,18 +1277,17 @@ fail: static const char* _get_win_prop_Subsurface_Parent(const Evas_Object *evas_obj) { - const E_Comp_Wl_Client_Data *cdata; - const E_Client *ec; + E_Comp_Wl_Client_Data *cdata; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (!ec->comp_data) + cdata = e_client_cdata_get(ec); + if (!cdata) return strdup("None"); - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (asprintf(&str, "0x%zx", cdata->sub.data ? e_client_util_win_get(cdata->sub.data->parent) : 0) < 0) return NULL; @@ -1308,21 +1297,20 @@ _get_win_prop_Subsurface_Parent(const Evas_Object *evas_obj) static const char* _get_win_prop_Aux_Hint(const Evas_Object *evas_obj) { - const E_Comp_Wl_Client_Data *cdata; + E_Comp_Wl_Client_Data *cdata; const E_Comp_Wl_Aux_Hint *hint; const Eina_List *l; - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (!ec->comp_data) + cdata = e_client_cdata_get(ec); + if (!cdata) return strdup("None"); - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (!cdata->aux_hint.hints) return strdup("None"); @@ -1339,13 +1327,15 @@ fail: static const char* _get_win_prop_Video_Client(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; + E_Comp_Wl_Client_Data *cdata; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (asprintf(&str, "%d", ec->comp_data ? (ec->comp_data->video_client || e_client_video_hw_composition_check((E_Client *)ec)) : 0) < 0) + cdata = e_client_cdata_get(ec); + if (asprintf(&str, "%d", cdata ? (cdata->video_client || e_client_video_hw_composition_check((E_Client *)ec)) : 0) < 0) return NULL; return str; @@ -1354,7 +1344,7 @@ _get_win_prop_Video_Client(const Evas_Object *evas_obj) static const char* _get_win_prop_Ignore_first_unmap(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -1397,6 +1387,7 @@ static const char* _set_win_prop_Ignored(Evas_Object *evas_obj, const char *prop_value) { E_Client *ec = evas_object_data_get(evas_obj, "E_Client"); + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); if (!ec) { @@ -1513,7 +1504,7 @@ _get_win_prop_Override(const Evas_Object *evas_obj) static const char* _get_win_prop_E_Transient_Policy(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -1528,7 +1519,7 @@ _get_win_prop_E_Transient_Policy(const Evas_Object *evas_obj) static const char* _get_win_prop_E_FullScreen_Policy(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -1543,7 +1534,7 @@ _get_win_prop_E_FullScreen_Policy(const Evas_Object *evas_obj) static const char* _get_win_prop_E_Maximize_Policy(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -1849,7 +1840,7 @@ _set_win_prop_Layer(Evas_Object *evas_obj, const char *prop_value) static const char* _get_win_prop_Layer(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; char layer_name[48] = {0,}; @@ -1867,7 +1858,7 @@ _get_win_prop_Layer(const Evas_Object *evas_obj) static const char* _get_win_prop_Shape_input(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; int i = 0; @@ -1891,7 +1882,7 @@ fail: static const char* _get_win_prop_Shape_rects(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; int i = 0; @@ -1915,10 +1906,10 @@ fail: static const char* _get_win_prop_Transients(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; - const E_Client *child; + E_Client *child; const Eina_List *l; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -1940,7 +1931,7 @@ fail: static const char* _get_win_prop_ParentWindowID(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -1979,7 +1970,7 @@ _set_win_prop_Geometry(Evas_Object *evas_obj, const char *prop_value) static const char* _get_win_prop_Geometry(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -2004,7 +1995,7 @@ _set_win_prop_Role(Evas_Object *evas_obj, const char *prop_value) static const char* _get_win_prop_Role(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -2036,7 +2027,7 @@ _set_win_prop_Window_Name(Evas_Object *evas_obj, const char *prop_value) static const char* _get_win_prop_Window_Name(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -2050,7 +2041,7 @@ _get_win_prop_Window_Name(const Evas_Object *evas_obj) static const char* _get_win_prop_ResourceID(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -2068,19 +2059,17 @@ _get_win_prop_ResourceID(const Evas_Object *evas_obj) static const char* _get_win_prop_PID(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; char *str = NULL; pid_t pid = -1; ec = evas_object_data_get(evas_obj, "E_Client"); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); - if (ec->comp_data) - { - const E_Comp_Wl_Client_Data *cdata = (const E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } + cdata = e_client_cdata_get(ec); + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); if (asprintf(&str, "%d", pid) < 0) return NULL; @@ -2091,7 +2080,7 @@ _get_win_prop_PID(const Evas_Object *evas_obj) static const char* _get_win_prop_Window_ID(const Evas_Object *evas_obj) { - const E_Client *ec; + E_Client *ec; char *str = NULL; ec = evas_object_data_get(evas_obj, "E_Client"); @@ -2531,14 +2520,11 @@ _msg_window_prop_append(const Eldbus_Message *msg, uint32_t mode, const char *va else if (mode == WINDOW_PID_MODE) { pid_t pid = -1; - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - { - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } - } + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); + if (pid == value_number) { window_exists = EINA_TRUE; @@ -2703,6 +2689,7 @@ static void _e_info_server_cb_wins_dump_topvwins(const char *dir, Eldbus_Message { Evas_Object *o; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Ecore_Window win; int rotation = 0; char fname[PATH_MAX]; @@ -2734,8 +2721,9 @@ static void _e_info_server_cb_wins_dump_topvwins(const char *dir, Eldbus_Message EINA_LIST_FREE(topvwins, ec) { win = e_client_util_win_get(ec); - if (ec->comp_data) - rotation = ec->comp_data->scaler.buffer_viewport.buffer.transform * 90; + cdata = e_client_cdata_get(ec); + if (cdata) + rotation = cdata->scaler.buffer_viewport.buffer.transform * 90; snprintf(fname, sizeof(fname), "0x%08zx_%d", win, rotation); s_fname = eina_stringshare_add(fname); @@ -2989,6 +2977,7 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED, Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply); Eldbus_Message_Iter *array_of_ec; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Object *o; eldbus_message_iter_arguments_append(iter, "a("SIGNATURE_SUBSURFACE")", &array_of_ec); @@ -3020,14 +3009,15 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED, } else { - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) continue; - if (!ec->comp_data->sub.data && - !ec->comp_data->sub.list && !ec->comp_data->sub.list_pending && - !ec->comp_data->sub.below_list && !ec->comp_data->sub.below_list_pending) + cdata = e_client_cdata_get(ec); + if (e_object_is_del(E_OBJECT(ec)) || !cdata) continue; + if (!cdata->sub.data && + !cdata->sub.list && !cdata->sub.list_pending && + !cdata->sub.below_list && !cdata->sub.below_list_pending) continue; win = e_client_util_win_get(ec); - if (ec->comp_data->sub.data) - parent = e_client_util_win_get(ec->comp_data->sub.data->parent); + if (cdata->sub.data) + parent = e_client_util_win_get(cdata->sub.data->parent); buffer = e_pixmap_resource_get(ec->pixmap); if (buffer) buf_id = (buffer->resource) ? wl_resource_get_id(buffer->resource) : (WAYLAND_SERVER_RESOURCE_ID_MASK & 99999); @@ -3035,7 +3025,7 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED, if (map) { Evas_Coord x1, x2, y1, y2; - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; evas_map_point_coord_get(map, 0, &x1, &y1, NULL); evas_map_point_coord_get(map, 2, &x2, &y2, NULL); x = x1, y = y1, w = x2 - x1, h = y2 - y1; @@ -3046,12 +3036,12 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED, visible = evas_object_visible_get(o); alpha = e_comp_object_alpha_get(ec->frame); ignore = e_client_util_ignored_get(ec); - if (ec->comp_data->sub.below_obj) - bgrect = (Ecore_Window)ec->comp_data->sub.below_obj; + if (cdata->sub.below_obj) + bgrect = (Ecore_Window)cdata->sub.below_obj; maskobj = e_comp_object_mask_has(ec->frame); - video = (ec->comp_data->video_client || e_client_video_hw_composition_check(ec)) ? 1 : 0; - if (ec->comp_data->sub.data) - stand = ec->comp_data->sub.data->stand_alone; + video = (cdata->video_client || e_client_video_hw_composition_check(ec)) ? 1 : 0; + if (cdata->sub.data) + stand = cdata->sub.data->stand_alone; name = e_client_util_name_get(ec); if (!name) name = "NO NAME"; @@ -4331,6 +4321,7 @@ static Eina_Bool _e_info_server_cb_buffer_change(void *data, int type, void *event) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Event_Client *ev = event; Ecore_Window event_win; char fname[PATH_MAX]; @@ -4364,7 +4355,9 @@ _e_info_server_cb_buffer_change(void *data, int type, void *event) buffer = e_pixmap_resource_get(ec->pixmap); if (!buffer) return ECORE_CALLBACK_PASS_ON; - rotation = ec->comp_data->scaler.buffer_viewport.buffer.transform * 90; + cdata = e_client_cdata_get(ec); + if (!cdata) return ECORE_CALLBACK_PASS_ON; + rotation = cdata->scaler.buffer_viewport.buffer.transform * 90; event_win = e_client_util_win_get(ec); switch (buffer->type) @@ -5630,6 +5623,7 @@ static int _e_info_server_ec_kill(uint32_t mode, void *value, Eldbus_Message_Iter *array_of_string) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Evas_Object *o; int count = 0; char result[1024]; @@ -5657,12 +5651,9 @@ _e_info_server_ec_kill(uint32_t mode, void *value, Eldbus_Message_Iter *array_of pid = ec->netwm.pid; if (pid <= 0) { - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } + cdata = e_client_cdata_get(ec); + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); } if (pid != *(pid_t *)value) continue; @@ -5754,6 +5745,7 @@ _e_info_server_cb_get_windows(const Eldbus_Service_Interface *iface EINA_UNUSED, Eldbus_Message_Iter *iter; Eina_Bool res; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; char *value; uint32_t mode; int count = 0; @@ -5809,12 +5801,9 @@ _e_info_server_cb_get_windows(const Eldbus_Service_Interface *iface EINA_UNUSED, ec_pid = ec->netwm.pid; if (ec_pid <= 0) { - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &ec_pid, NULL, NULL); - } + cdata = e_client_cdata_get(ec); + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &ec_pid, NULL, NULL); } if (ec_pid != pid) continue; @@ -5949,6 +5938,7 @@ _e_info_server_cb_wininfo(const Eldbus_Service_Interface *iface EINA_UNUSED, con Eldbus_Message *reply; Eina_Bool res; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; uint64_t win; Ecore_Window pwin; uint32_t res_id = 0; @@ -5981,12 +5971,9 @@ _e_info_server_cb_wininfo(const Eldbus_Service_Interface *iface EINA_UNUSED, con pid = ec->netwm.pid; if (pid <= 0) { - if (ec->comp_data) - { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; - if (cdata->surface) - wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); - } + cdata = e_client_cdata_get(ec); + if (cdata && cdata->surface) + wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL); } _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos); @@ -6045,14 +6032,15 @@ _e_info_server_cb_wininfo_size_hints_append(E_Client *ec, Eldbus_Message_Iter *a static void _e_info_server_cb_wininfo_wm_hints_append(E_Client *ec, Eldbus_Message_Iter *array_of_hints) { + E_Comp_Wl_Client_Data *cdata = NULL; Eina_List *l; E_Comp_Wl_Aux_Hint *hint; char temp[512] = {0}; - if (!ec->comp_data) - return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - EINA_LIST_FOREACH(ec->comp_data->aux_hint.hints, l, hint) + EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) { snprintf(temp, sizeof(temp), "%s: %s", hint->hint, hint->val); eldbus_message_iter_arguments_append(array_of_hints, "s", temp); diff --git a/src/bin/e_keyrouter.c b/src/bin/e_keyrouter.c index 765923b587..f19e36b68c 100644 --- a/src/bin/e_keyrouter.c +++ b/src/bin/e_keyrouter.c @@ -575,13 +575,16 @@ e_keyrouter_composition_key_del(int *keys, int count) E_API void e_keyrouter_event_surface_send(E_Client *ec, int key) { + E_Comp_Wl_Client_Data *cdata = NULL; + EINA_SAFETY_ON_NULL_RETURN(krt); EINA_SAFETY_ON_NULL_RETURN(ec); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data->surface); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); + EINA_SAFETY_ON_NULL_RETURN(cdata->surface); key = key - 8; - e_keyrouter_wl_event_surface_send(ec->comp_data->surface, key, TIZEN_KEYROUTER_MODE_NONE); + e_keyrouter_wl_event_surface_send(cdata->surface, key, TIZEN_KEYROUTER_MODE_NONE); } E_API int diff --git a/src/bin/e_keyrouter_events.c b/src/bin/e_keyrouter_events.c index e17cf36358..fc0123fd23 100644 --- a/src/bin/e_keyrouter_events.c +++ b/src/bin/e_keyrouter_events.c @@ -870,9 +870,12 @@ _e_keyrouter_send_key_event(int type, struct wl_resource *surface, struct wl_cli struct wl_resource * e_keyrouter_util_get_surface_from_eclient(E_Client *client) { - if (!client || !client->comp_data) return NULL; + E_Comp_Wl_Client_Data *cdata = NULL; + if (!client) return NULL; + cdata = e_client_cdata_get(client); + if (!cdata) return NULL; - return client->comp_data->wl_surface; + return cdata->wl_surface; } int diff --git a/src/bin/e_keyrouter_wl.c b/src/bin/e_keyrouter_wl.c index 57cf32abb3..23c977be44 100644 --- a/src/bin/e_keyrouter_wl.c +++ b/src/bin/e_keyrouter_wl.c @@ -62,6 +62,7 @@ Eina_Bool e_keyrouter_wl_key_send(Ecore_Event_Key *ev, Eina_Bool pressed, struct wl_client *client, struct wl_resource *surface, Eina_Bool focused) { E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_client *wc = NULL; uint32_t keycode; enum wl_keyboard_key_state state; @@ -99,16 +100,20 @@ e_keyrouter_wl_key_send(Ecore_Event_Key *ev, Eina_Bool pressed, struct wl_client if ((!e_client_action_get()) && (!e_comp->input_key_grabs)) { ec = e_client_focused_get(); - if (ec && ec->comp_data && ec->comp_data->surface) + if (ec) { - if (e_comp_wl->kbd.focused) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->surface) { - wc = wl_resource_get_client(ec->comp_data->surface); - _e_keyrouter_wl_key_send(ev, state, e_comp_wl->kbd.focused, EINA_TRUE, wc, surface); - } + if (e_comp_wl->kbd.focused) + { + wc = wl_resource_get_client(cdata->surface); + _e_keyrouter_wl_key_send(ev, state, e_comp_wl->kbd.focused, EINA_TRUE, wc, surface); + } - /* update modifier state */ - e_comp_wl_input_keyboard_state_update(keycode, pressed); + /* update modifier state */ + e_comp_wl_input_keyboard_state_update(keycode, pressed); + } } } return !!ec; diff --git a/src/bin/e_output.c b/src/bin/e_output.c index e84598ccbe..6710d5a9e9 100644 --- a/src/bin/e_output.c +++ b/src/bin/e_output.c @@ -226,7 +226,7 @@ _e_output_zoom_top_visible_ec_get() if (!ec->frame) continue; if (!evas_object_visible_get(ec->frame)) continue; /* if ec is subsurface, skip this */ - cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + cdata = e_client_cdata_get(ec); if (cdata && cdata->sub.data) continue; return ec; @@ -579,7 +579,7 @@ _e_output_top_visible_ec_get() if (!ec->frame) continue; if (!evas_object_visible_get(ec->frame)) continue; /* if ec is subsurface, skip this */ - cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + cdata = e_client_cdata_get(ec); if (cdata && cdata->sub.data) continue; return ec; @@ -724,7 +724,7 @@ _e_output_visible_client_check(E_Output *output) if (ec->is_cursor) continue; if (!ec->visible) continue; if (!evas_object_visible_get(ec->frame)) continue; - cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + cdata = e_client_cdata_get(ec); if (cdata && cdata->sub.data) continue; /* skip subsurface */ if (cdata && !cdata->mapped) continue; if (ec->iconic) continue; @@ -753,18 +753,18 @@ static void _e_output_client_resize(int w, int h) { E_Client *ec = NULL; - E_Comp_Client_Data *cdata = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; E_CLIENT_FOREACH(ec) { if ((ec->visible && !ec->input_only) || (e_client_util_name_get(ec) != NULL && !ec->input_only)) { - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (cdata == NULL) continue; if (cdata->shell.configure_send == NULL) continue; - cdata->shell.configure_send(ec->comp_data->shell.surface, 0, w ,h); + cdata->shell.configure_send(cdata->shell.surface, 0, w ,h); } } } diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index 7b6d3dfdd0..945b733ff0 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -503,37 +503,47 @@ E_API Eina_Bool e_pixmap_size_changed(E_Pixmap *cp, int w, int h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cp->client, EINA_FALSE); if (cp->dirty) return EINA_TRUE; ec = cp->client; - if (!ec->comp_data || e_object_is_del(E_OBJECT(ec))) + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); + + cdata = e_client_cdata_get(ec); + if (!cdata|| e_object_is_del(E_OBJECT(ec))) return (w != cp->w) || (h != cp->h); - return (w != ec->comp_data->width_from_buffer) || (h != ec->comp_data->height_from_buffer); + return (w != cdata->width_from_buffer) || (h != cdata->height_from_buffer); } E_API Eina_Bool e_pixmap_size_get(E_Pixmap *cp, int *w, int *h) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; + if (w) *w = 0; if (h) *h = 0; EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cp->client, EINA_FALSE); ec = cp->client; - if (!ec->comp_data || e_object_is_del(E_OBJECT(ec))) + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); + + cdata = e_client_cdata_get(ec); + if (!cdata || e_object_is_del(E_OBJECT(ec))) { if (w) *w = cp->w; if (h) *h = cp->h; return (cp->w > 0) && (cp->h > 0); } - if (w) *w = ec->comp_data->width_from_buffer; - if (h) *h = ec->comp_data->height_from_buffer; - return (ec->comp_data->width_from_buffer > 0) && (ec->comp_data->height_from_buffer > 0); + if (w) *w = cdata->width_from_buffer; + if (h) *h = cdata->height_from_buffer; + return (cdata->width_from_buffer > 0) && (cdata->height_from_buffer > 0); } E_API unsigned int @@ -689,13 +699,15 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache) cp->failures = 0; if (cache) { - E_Comp_Wl_Client_Data *cd; + E_Comp_Wl_Client_Data *cdata; struct wl_resource *cb; Eina_List *l, *ll; - if ((!cp->client) || (!cp->client->comp_data)) return; - cd = (E_Comp_Wl_Client_Data *)cp->client->comp_data; - EINA_LIST_FOREACH_SAFE(cd->frames, l, ll, cb) + if (!cp->client) return; + cdata = e_client_cdata_get(cp->client); + if ((!cdata)) return; + + EINA_LIST_FOREACH_SAFE(cdata->frames, l, ll, cb) { wl_callback_send_done(cb, (unsigned int)(ecore_loop_time_get() * 1000)); wl_resource_destroy(cb); @@ -935,19 +947,17 @@ e_pixmap_cdata_get(E_Pixmap *cp) E_API void e_pixmap_cdata_set(E_Pixmap *cp, E_Comp_Wl_Client_Data *cdata) { - E_Comp_Wl_Client_Data *cd = (E_Comp_Wl_Client_Data*)cdata; - EINA_SAFETY_ON_NULL_RETURN(cp); if (cp->cdata) { if (cp->own_cdata) { - if (cd) + if (cdata) { - cd->wl_surface = cp->cdata->wl_surface; - cd->scaler.viewport = cp->cdata->scaler.viewport; - cd->pending.buffer_viewport = cp->cdata->pending.buffer_viewport; + cdata->wl_surface = cp->cdata->wl_surface; + cdata->scaler.viewport = cp->cdata->scaler.viewport; + cdata->pending.buffer_viewport = cp->cdata->pending.buffer_viewport; } E_FREE(cp->cdata); @@ -955,7 +965,7 @@ e_pixmap_cdata_set(E_Pixmap *cp, E_Comp_Wl_Client_Data *cdata) } } - cp->cdata = cd; + cp->cdata = cdata; } E_API E_Pixmap_Hook * @@ -1016,7 +1026,7 @@ e_pixmap_shutdown(void) static void _e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) { - E_Comp_Wl_Client_Data *cdata; + E_Comp_Wl_Client_Data *cp_cdata; struct wl_resource *cb; Eina_List *l, *ll; @@ -1024,6 +1034,8 @@ _e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) /* if not only free, client should be iconic state */ if (!only_free && !e_policy_visibility_client_is_iconic(cp->client)) return; + cp_cdata = e_client_cdata_get(cp->client); + DBG("PIXMAP: Buffer Flush(%s) '%s'(%p) only_free:%d", cp->shm_flusher ? "SHM" : "NATIVE", cp->client->icccm.name?:"", cp->client, only_free); @@ -1042,7 +1054,7 @@ _e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) } else { - if ((cp->buffer) && (cp->client->comp_data)) + if ((cp->buffer) && (cp_cdata)) { if ((cp->buffer->type == E_COMP_WL_BUFFER_TYPE_TBM) || (cp->buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE)) @@ -1050,7 +1062,7 @@ _e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) struct wayland_tbm_client_queue * cqueue; cqueue = wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server, - cp->client->comp_data->wl_surface); + cp_cdata->wl_surface); if (!cqueue) return; if (only_free) @@ -1064,20 +1076,19 @@ _e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) if (!only_free) { /* release the helded buffer by e_client */ - if (cp->client->comp_data) + if (cp_cdata) { /* release the helded buffer by e_client */ - e_comp_wl_buffer_reference(&cp->client->comp_data->buffer_ref, NULL); - e_presentation_time_container_feedback_discard(&cp->client->comp_data->presentation_container); + e_comp_wl_buffer_reference(&cp_cdata->buffer_ref, NULL); + e_presentation_time_container_feedback_discard(&cp_cdata->presentation_container); } /* composite object clear */ e_comp_object_clear(cp->client->frame); /* pending frame event callback*/ - if (!cp->client->comp_data) return; - cdata = (E_Comp_Wl_Client_Data *)cp->client->comp_data; - EINA_LIST_FOREACH_SAFE(cdata->frames, l, ll, cb) + if (!cp_cdata) return; + EINA_LIST_FOREACH_SAFE(cp_cdata->frames, l, ll, cb) { wl_callback_send_done(cb, (unsigned int)(ecore_loop_time_get() * 1000)); wl_resource_destroy(cb); diff --git a/src/bin/e_plane.c b/src/bin/e_plane.c index 54d2bf9e63..9eb249a003 100644 --- a/src/bin/e_plane.c +++ b/src/bin/e_plane.c @@ -72,7 +72,7 @@ _e_plane_hook_call(E_Plane_Hook_Point hookpoint, E_Plane *plane) static E_Comp_Wl_Buffer * _get_comp_wl_buffer(E_Client *ec) { - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); if (!cdata) return NULL; E_Comp_Wl_Buffer_Ref *buffer_ref = &cdata->buffer_ref; @@ -536,9 +536,10 @@ _e_plane_cursor_surface_acquire(E_Plane *plane) tbm_surface_h tsurface = NULL; E_Plane_Renderer *renderer = plane->renderer; E_Client *ec = plane->ec; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Comp_Wl_Buffer *buffer = NULL; - buffer = ec->comp_data->buffer_ref.buffer; + buffer = cdata->buffer_ref.buffer; if (!buffer) return NULL; if (!e_comp_object_hwc_update_exists(ec->frame)) return NULL; diff --git a/src/bin/e_plane_renderer.c b/src/bin/e_plane_renderer.c index 577809889d..f03bce381e 100644 --- a/src/bin/e_plane_renderer.c +++ b/src/bin/e_plane_renderer.c @@ -69,7 +69,7 @@ _get_comp_wl_buffer(E_Client *ec) if (!ec) return NULL; - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; E_Comp_Wl_Buffer_Ref *buffer_ref = &cdata->buffer_ref; @@ -84,7 +84,7 @@ _get_wl_buffer(E_Client *ec) if (!ec) return NULL; - cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return NULL; E_Comp_Wl_Buffer_Ref *buffer_ref = &cdata->buffer_ref; @@ -224,7 +224,7 @@ _e_plane_renderer_wayland_tbm_client_queue_get(E_Client *ec) EINA_SAFETY_ON_NULL_RETURN_VAL(wl_comp_data, NULL); - cdata = (E_Comp_Wl_Client_Data *)e_pixmap_cdata_get(ec->pixmap); + cdata = e_pixmap_cdata_get(ec->pixmap); EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, NULL); wl_surface = cdata->wl_surface; @@ -996,7 +996,7 @@ _e_plane_renderer_recover_ec(E_Plane_Renderer *renderer) if (!plane->ec_redirected) return; if (!ec) return; - cdata = ec->comp_data; + cdata = e_client_cdata_get(ec); if (!cdata) return; if (!cdata->mapped) return; @@ -1260,6 +1260,7 @@ e_plane_renderer_cursor_surface_refresh(E_Plane_Renderer *renderer, E_Client *ec tbm_surface_error_e ret = TBM_SURFACE_ERROR_NONE; tbm_surface_info_s tsurface_info; E_Pointer *pointer = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(renderer, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); @@ -1270,7 +1271,8 @@ e_plane_renderer_cursor_surface_refresh(E_Plane_Renderer *renderer, E_Client *ec output = plane->output; EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); - buffer = ec->comp_data->buffer_ref.buffer; + cdata = e_client_cdata_get(ec); + buffer = cdata->buffer_ref.buffer; EINA_SAFETY_ON_NULL_RETURN_VAL(buffer, EINA_FALSE); pointer = e_pointer_get(ec); @@ -1293,7 +1295,8 @@ e_plane_renderer_cursor_surface_refresh(E_Plane_Renderer *renderer, E_Client *ec } else { - ERR("unkown buffer type:%d", ec->comp_data->buffer_ref.buffer->type); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + ERR("unkown buffer type:%d", cdata->buffer_ref.buffer->type); return EINA_FALSE; } diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index 97a2355a75..59d0bcddd9 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -158,6 +158,7 @@ EINTERN void e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN(ptr); @@ -176,10 +177,11 @@ e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y) ec = e_comp_object_client_get(ptr->o_ptr); if ((ec) && (!e_object_is_del(E_OBJECT(ec)))) { + cdata = e_client_cdata_get(ec); ec->hidden = 1; ec->visible = EINA_FALSE; ec->visibility.obscured = E_VISIBILITY_FULLY_OBSCURED; - ec->comp_data->mapped = EINA_FALSE; + cdata->mapped = EINA_FALSE; ec->override = 1; /* ignore the previous cursor_ec */ } @@ -202,11 +204,12 @@ e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y) ec = e_comp_object_client_get(obj); if (ec && e_pixmap_usable_get(ec->pixmap)) { + cdata = e_client_cdata_get(ec); ec->hidden = 0; ec->visible = EINA_TRUE; ec->visibility.obscured = E_VISIBILITY_UNOBSCURED; evas_object_geometry_set(ec->frame, ec->x, ec->y, ec->w, ec->h); - ec->comp_data->mapped = EINA_TRUE; + cdata->mapped = EINA_TRUE; ec->override = 0; /* do not ignore the cursor_ec to set the image object */ if (e_comp_is_on_overlay(ec)) diff --git a/src/bin/e_policy.c b/src/bin/e_policy.c index d71cd8ae81..de93d26c8a 100644 --- a/src/bin/e_policy.c +++ b/src/bin/e_policy.c @@ -1778,10 +1778,12 @@ e_policy_client_is_quickpanel(E_Client *ec) Eina_Bool e_policy_client_is_conformant(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + E_OBJECT_CHECK_RETURN(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; if (cdata->conformant == 1) { return EINA_TRUE; @@ -1835,13 +1837,13 @@ e_policy_client_is_noti(E_Client *ec) Eina_Bool e_policy_client_is_subsurface(E_Client *ec) { - E_Comp_Wl_Client_Data *cd; + E_Comp_Wl_Client_Data *cdata= NULL; E_OBJECT_CHECK_RETURN(ec, EINA_FALSE); E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE); - cd = (E_Comp_Wl_Client_Data *)ec->comp_data; - if (cd && cd->sub.data) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->sub.data) return EINA_TRUE; return EINA_FALSE; @@ -2057,10 +2059,12 @@ e_policy_event_simple(E_Client *ec, int type) E_API Eina_Bool e_policy_aux_message_use_get(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + E_OBJECT_CHECK_RETURN(ec, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE); - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; if (cdata->aux_hint.use_msg) { return EINA_TRUE; diff --git a/src/bin/e_policy_conformant.c b/src/bin/e_policy_conformant.c index c9a580a76e..e7d31c9cbe 100644 --- a/src/bin/e_policy_conformant.c +++ b/src/bin/e_policy_conformant.c @@ -130,6 +130,7 @@ _conf_state_update(Conformant_Type type, Eina_Bool visible, int x, int y, int w, { Conformant_Client *cfc; Conformant_Wl_Res *cres; + E_Comp_Wl_Client_Data *cfc_cdata = NULL; uint32_t conf_type; Eina_List *l; Eina_Bool wait_ack = EINA_FALSE; @@ -192,10 +193,11 @@ _conf_state_update(Conformant_Type type, Eina_Bool visible, int x, int y, int w, cres->ack_done = EINA_FALSE; if (!cres->use_ack) { + cfc_cdata = e_client_cdata_get(cfc->ec); cres->ack_done = EINA_TRUE; tizen_policy_send_conformant_area (cres->res, - cfc->ec->comp_data->surface, + cfc_cdata->surface, conf_type, (unsigned int)visible, x, y, w, h); } @@ -203,10 +205,11 @@ _conf_state_update(Conformant_Type type, Eina_Bool visible, int x, int y, int w, { uint32_t serial; serial = wl_display_next_serial(e_comp_wl->wl.disp); + cfc_cdata = e_client_cdata_get(cfc->ec); tizen_policy_send_conformant_region (cres->res, - cfc->ec->comp_data->surface, + cfc_cdata->surface, conf_type, (unsigned int)visible, x, y, w, h, serial); diff --git a/src/bin/e_policy_visibility.c b/src/bin/e_policy_visibility.c index 9af6fd043b..8d03d8dfc1 100644 --- a/src/bin/e_policy_visibility.c +++ b/src/bin/e_policy_visibility.c @@ -167,6 +167,7 @@ _e_policy_check_transient_child_visible(E_Client *ancestor_ec, E_Client *ec) Eina_Bool visible = EINA_FALSE; Eina_List *list = NULL; E_Client *child_ec = NULL; + E_Comp_Wl_Client_Data *child_cdata = NULL; int anc_x, anc_y, anc_w, anc_h; int child_x, child_y, child_w, child_h; @@ -179,8 +180,9 @@ _e_policy_check_transient_child_visible(E_Client *ancestor_ec, E_Client *ec) { if (visible == EINA_TRUE) continue; - if (!child_ec->comp_data) continue; - if (!child_ec->comp_data->mapped && !child_ec->use_splash) continue; + child_cdata = e_client_cdata_get(child_ec); + if (!child_cdata) continue; + if (!child_cdata->mapped && !child_ec->use_splash) continue; if (child_ec->transient_policy == E_TRANSIENT_BELOW) continue; if ((child_ec->exp_iconify.skip_iconify == EINA_TRUE) || @@ -233,6 +235,7 @@ static Eina_Bool _e_policy_check_above_alpha_opaque(E_Client *ec) { E_Client *above_ec; + E_Comp_Wl_Client_Data *above_cdata = NULL; Evas_Object *o; Eina_Bool alpha_opaque = EINA_FALSE; int ex, ey, ew, eh; @@ -245,7 +248,8 @@ _e_policy_check_above_alpha_opaque(E_Client *ec) above_ec = evas_object_data_get(o, "E_Client"); if (!above_ec) continue; if (e_client_util_ignored_get(above_ec)) continue; - if (above_ec->comp_data && !above_ec->comp_data->mapped) continue; + above_cdata = e_client_cdata_get(above_ec); + if (above_cdata && !above_cdata->mapped) continue; e_client_geometry_get(above_ec, &ax, &ay, &aw, &ah); if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; @@ -264,7 +268,7 @@ _e_policy_check_above_alpha_opaque(E_Client *ec) { if (!above_ec->iconic) { - if (above_ec->comp_data && above_ec->comp_data->mapped) + if (above_cdata && above_cdata->mapped) alpha_opaque = EINA_TRUE; } } @@ -288,7 +292,7 @@ _e_policy_client_iconify_by_visibility(E_Client *ec) if (ec->exp_iconify.skip_iconify) return; if (ec->exp_iconify.skip_by_remote) return; - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); if (cdata && !cdata->mapped) return; if (e_config->transient.iconify) @@ -446,7 +450,7 @@ _e_policy_client_uniconify_by_visibility(E_Client *ec) if (ec->exp_iconify.skip_iconify) return; if (ec->exp_iconify.skip_by_remote) return; - E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); if (cdata && !cdata->mapped) return; _e_policy_client_ancestor_uniconify(ec); @@ -1310,6 +1314,7 @@ _e_vis_client_check_obscured_by_same_layer(E_Client *ec) { Eina_Bool obscured = EINA_FALSE; E_Client *above = NULL; + E_Comp_Wl_Client_Data *above_cdata = NULL; int ex, ey, ew, eh; int ax, ay, aw, ah; @@ -1322,7 +1327,8 @@ _e_vis_client_check_obscured_by_same_layer(E_Client *ec) if (e_object_is_del(E_OBJECT(above))) continue; if (above->iconic && above->exp_iconify.by_client) continue; if (above->bg_state) continue; - if (above->comp_data && !above->comp_data->mapped) continue; + above_cdata = e_client_cdata_get(above); + if (above_cdata && !above_cdata->mapped) continue; e_client_geometry_get(above, &ax, &ay, &aw, &ah); if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; @@ -1356,6 +1362,7 @@ _e_vis_client_check_obscured_by_above_layers(E_Client *ec) { Eina_Bool obscured = EINA_FALSE; E_Client *above = NULL; + E_Comp_Wl_Client_Data *above_cdata = NULL; int ex, ey, ew, eh; int ax, ay, aw, ah; @@ -1368,7 +1375,8 @@ _e_vis_client_check_obscured_by_above_layers(E_Client *ec) if (e_object_is_del(E_OBJECT(above))) continue; if (above->iconic && above->exp_iconify.by_client) continue; if (above->bg_state) continue; - if (above->comp_data && !above->comp_data->mapped) continue; + above_cdata = e_client_cdata_get(above); + if (above_cdata && !above_cdata->mapped) continue; e_client_geometry_get(above, &ax, &ay, &aw, &ah); if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; @@ -1447,6 +1455,7 @@ static Eina_Bool _e_vis_client_add_uniconify_render_pending(E_Vis_Client *vc, E_Vis_Job_Type type, Eina_Bool raise, Eina_Bool force_send) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Bool send_vis_event = EINA_TRUE; ec = vc->ec; @@ -1457,7 +1466,8 @@ _e_vis_client_add_uniconify_render_pending(E_Vis_Client *vc, E_Vis_Job_Type type return EINA_FALSE; } - if (ec->comp_data && !ec->comp_data->mapped) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) { ELOGF("POL_VIS", "Not mapped. no need to uniconify render.", ec); return EINA_FALSE; @@ -1546,6 +1556,7 @@ _e_vis_ec_activity_check(E_Client *ec, Eina_Bool check_alpha, Eina_Bool check_fu int x, y, w, h; E_Comp_Object_Content_Type type = E_COMP_OBJECT_CONTENT_TYPE_NONE; int check_mapped = 1; + E_Comp_Wl_Client_Data *cdata = NULL; /* check if ignored */ if (e_client_util_ignored_get(ec)) return EINA_FALSE; @@ -1559,7 +1570,8 @@ _e_vis_ec_activity_check(E_Client *ec, Eina_Bool check_alpha, Eina_Bool check_fu (type == E_COMP_OBJECT_CONTENT_TYPE_EXT_EDJE)) check_mapped = 0; /* check unmapped client */ - if (check_mapped && ec->comp_data && !ec->comp_data->mapped) return EINA_FALSE; + cdata = e_client_cdata_get(ec); + if (check_mapped && cdata && !cdata->mapped) return EINA_FALSE; /* check iconify window by client */ if ((ec->iconic) && (ec->exp_iconify.by_client)) return EINA_FALSE; /* check background state */ @@ -1673,6 +1685,7 @@ static E_Pol_Vis_Type _e_vis_ec_above_visible_type(E_Client *ec, Eina_Bool check_child) { E_Client *above; + E_Comp_Wl_Client_Data *above_cdata = NULL; E_Pol_Vis_Type above_vis_type = E_POL_VIS_TYPE_ALPHA; int ex, ey, ew, eh; int ax, ay, aw, ah; @@ -1704,7 +1717,8 @@ _e_vis_ec_above_visible_type(E_Client *ec, Eina_Bool check_child) if (check_child && (above->parent == ec)) continue; if (above->first_mapped) { - if (above->comp_data && !above->comp_data->mapped) + above_cdata = e_client_cdata_get(above); + if (above_cdata && !above_cdata->mapped) continue; } @@ -1752,7 +1766,8 @@ _e_vis_client_check_obscure_below(E_Client *ec) if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; if (ec->iconic && ec->exp_iconify.by_client) return EINA_FALSE; if (ec->bg_state) return EINA_FALSE; - if (ec->comp_data && !ec->comp_data->mapped) return EINA_FALSE; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) return EINA_FALSE; if ((ec->argb) && (ec->visibility.opaque <= 0)) return EINA_FALSE; if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED) return EINA_FALSE; if (!ec->visible) return EINA_FALSE; @@ -2330,12 +2345,14 @@ e_policy_visibility_client_raise(E_Client *ec) E_API Eina_Bool e_policy_visibility_client_lower(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Pol_Vis_Type above_vis_type; Eina_Bool ret = EINA_TRUE; E_VIS_CLIENT_GET_OR_RETURN_VAL(vc, ec, EINA_FALSE); - if ((ec->comp_data) && (!ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if ((cdata) && (!cdata->mapped)) { VS_DBG(ec, "client Unmapped."); return EINA_FALSE; diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 5ec2147ec8..08485bd60e 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -807,8 +807,8 @@ _e_policy_wl_tzsh_extension_get(const char *name) static E_Policy_Wl_Surface * _e_policy_wl_surf_add(E_Client *ec, struct wl_resource *res_tzpol) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Policy_Wl_Surface *psurf = NULL; - E_Policy_Wl_Tzpol *tzpol; tzpol = _e_policy_wl_tzpol_get(res_tzpol); @@ -825,8 +825,9 @@ _e_policy_wl_surf_add(E_Client *ec, struct wl_resource *res_tzpol) psurf->ec = ec; psurf->pid = ec->netwm.pid; - if (wl_resource_get_client(ec->comp_data->surface) == wl_resource_get_client(res_tzpol)) - psurf->surf = ec->comp_data->surface; + cdata = e_client_cdata_get(ec); + if (wl_resource_get_client(cdata->surface) == wl_resource_get_client(res_tzpol)) + psurf->surf = cdata->surface; tzpol->psurfs = eina_list_append(tzpol->psurfs, psurf); @@ -1022,6 +1023,7 @@ _tzpol_iface_cb_vis_get(struct wl_client *client, struct wl_resource *res_tzpol, void e_policy_wl_visibility_send(E_Client *ec, int vis) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Policy_Wl_Tzpol *tzpol; E_Policy_Wl_Surface *psurf; struct wl_resource *res_tzvis; @@ -1081,7 +1083,8 @@ e_policy_wl_visibility_send(E_Client *ec, int vis) sent_vis = -3; } - if (ec->comp_data && ec->comp_data->mapped) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->mapped) { _launch_effect_hide(ec->netwm.pid); } @@ -1093,7 +1096,7 @@ e_policy_wl_visibility_send(E_Client *ec, int vis) res_tzvis, ver, sent_vis, - ec->netwm.pid, ec->comp_data, ec->icccm.title, ec->netwm.name); + ec->netwm.pid, cdata, ec->icccm.title, ec->netwm.name); sent = EINA_TRUE; } } @@ -1355,6 +1358,7 @@ static void _tzpol_iface_cb_activate(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = wl_resource_get_user_data(surf); EINA_SAFETY_ON_NULL_RETURN(ec); @@ -1368,7 +1372,8 @@ _tzpol_iface_cb_activate(struct wl_client *client EINA_UNUSED, struct wl_resourc e_policy_hook_call(E_POLICY_HOOK_CLIENT_ACTIVE_REQ, ec); ec->post_lower = EINA_FALSE; - if (ec->comp_data && !ec->comp_data->mapped) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) ec->post_raise = EINA_TRUE; e_policy_wl_activate(ec); } @@ -1423,6 +1428,7 @@ _tzpol_iface_cb_activate_below_by_res_id(struct wl_client *client EINA_UNUSED, s E_Client *below_ec = NULL; E_Client *parent_ec = NULL; E_Client *focus_ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Bool check_ancestor = EINA_FALSE; Eina_Bool intercepted = EINA_FALSE; @@ -1470,7 +1476,8 @@ _tzpol_iface_cb_activate_below_by_res_id(struct wl_client *client EINA_UNUSED, s e_policy_stack_below(ec, below_ec); - if ((ec->comp_data) && (!ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) { ELOGF("TZPOL", "POST_RAISE_LOWER SET... raise:%d, lower:%d", ec, EINA_FALSE, EINA_FALSE); e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_FALSE); @@ -1488,6 +1495,7 @@ static void _tzpol_iface_cb_activate_above_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t res_id, uint32_t above_res_id) { E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; E_Client *above_ec = NULL; E_Client *parent_ec = NULL; Eina_Bool check_ancestor = EINA_FALSE; @@ -1538,7 +1546,8 @@ _tzpol_iface_cb_activate_above_by_res_id(struct wl_client *client EINA_UNUSED, s e_policy_stack_above(ec, above_ec); - if ((ec->comp_data) && (!ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) { ELOGF("TZPOL", "POST_RAISE_LOWER SET... raise:%d, lower:%d", ec, EINA_FALSE, EINA_FALSE); e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_FALSE); @@ -1549,6 +1558,7 @@ static void _tzpol_iface_cb_raise(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; ec = wl_resource_get_user_data(surf); EINA_SAFETY_ON_NULL_RETURN(ec); @@ -1563,7 +1573,8 @@ _tzpol_iface_cb_raise(struct wl_client *client EINA_UNUSED, struct wl_resource * e_client_raise(ec); - if ((ec->comp_data) && (!ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) { ELOGF("TZPOL", "POST_RAISE_LOWER SET... raise:%d, lower:%d", ec, EINA_TRUE, EINA_FALSE); e_client_post_raise_lower_set(ec, EINA_TRUE, EINA_FALSE); @@ -1576,6 +1587,7 @@ static void _tzpol_iface_cb_lower(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf) { E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; ec = wl_resource_get_user_data(surf); EINA_SAFETY_ON_NULL_RETURN(ec); @@ -1591,7 +1603,8 @@ _tzpol_iface_cb_lower(struct wl_client *client EINA_UNUSED, struct wl_resource * if (e_policy_visibility_client_lower(ec)) return; - if ((ec->comp_data) && (!ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) { ELOGF("TZPOL", "POST_RAISE_LOWER SET... raise:%d, lower:%d", ec, EINA_FALSE, EINA_TRUE); e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE); @@ -1607,6 +1620,7 @@ static void _tzpol_iface_cb_lower_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t res_id) { E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; ec = e_pixmap_find_client_by_res_id(res_id); EINA_SAFETY_ON_NULL_RETURN(ec); @@ -1619,7 +1633,8 @@ _tzpol_iface_cb_lower_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_ e_client_lower(ec); - if ((ec->comp_data) && (!ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if (cdata && !cdata->mapped) { ELOGF("TZPOL", "POST_RAISE_LOWER SET... raise:%d, lower:%d", ec, EINA_FALSE, EINA_TRUE); e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE); @@ -1658,6 +1673,7 @@ static void _tzpol_iface_cb_role_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf, const char *role) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; EINA_SAFETY_ON_NULL_RETURN(role); @@ -1681,8 +1697,9 @@ _tzpol_iface_cb_role_set(struct wl_client *client EINA_UNUSED, struct wl_resourc } else if (!e_util_strcmp("cbhm", role)) { - if (!ec->comp_data) return; - e_comp_wl->selection.cbhm = ec->comp_data->surface; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + e_comp_wl->selection.cbhm = cdata->surface; } else if (!e_util_strcmp("wl_pointer-cursor", role)) { @@ -1930,6 +1947,7 @@ static void _tzpol_iface_cb_transient_for_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t child_id, uint32_t parent_id) { E_Client *ec, *pc; + E_Comp_Wl_Client_Data *cdata = NULL, *pc_cdata = NULL; struct wl_resource *parent_surf; ELOGF("TZPOL", @@ -1938,12 +1956,14 @@ _tzpol_iface_cb_transient_for_set(struct wl_client *client EINA_UNUSED, struct w ec = e_pixmap_find_client_by_res_id(child_id); EINA_SAFETY_ON_NULL_RETURN(ec); + cdata = e_client_cdata_get(ec); pc = e_pixmap_find_client_by_res_id(parent_id); EINA_SAFETY_ON_NULL_RETURN(pc); - EINA_SAFETY_ON_NULL_RETURN(pc->comp_data); + pc_cdata = e_client_cdata_get(pc); + EINA_SAFETY_ON_NULL_RETURN(pc_cdata); - parent_surf = pc->comp_data->surface; + parent_surf = pc_cdata->surface; _e_policy_wl_parent_surf_set(ec, parent_surf); @@ -1957,7 +1977,7 @@ _tzpol_iface_cb_transient_for_set(struct wl_client *client EINA_UNUSED, struct w " |win:0x%08zx|child |s:%8p", ec, e_client_util_win_get(ec), - (ec->comp_data ? ec->comp_data->surface : NULL)); + (cdata ? cdata->surface : NULL)); tizen_policy_send_transient_for_done(res_tzpol, child_id); @@ -2037,39 +2057,45 @@ _tzpol_iface_cb_subsurf_place_below_parent(struct wl_client *client EINA_UNUSED, { E_Client *ec; E_Client *epc; + E_Comp_Wl_Client_Data *cdata = NULL, *epc_cdata = NULL;; E_Comp_Wl_Subsurf_Data *sdata; ec = wl_resource_get_user_data(subsurf); EINA_SAFETY_ON_NULL_RETURN(ec); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); - sdata = ec->comp_data->sub.data; + sdata = cdata->sub.data; EINA_SAFETY_ON_NULL_RETURN(sdata); epc = sdata->parent; EINA_SAFETY_ON_NULL_RETURN(epc); + epc_cdata = e_client_cdata_get(epc); + EINA_SAFETY_ON_NULL_RETURN(epc_cdata); /* check if a subsurface has already placed below a parent */ - if (eina_list_data_find(epc->comp_data->sub.below_list, ec)) return; + if (eina_list_data_find(epc_cdata->sub.below_list, ec)) return; ELOGF("TZPOL", "SUBSURF|BELOW_PARENT", ec); - epc->comp_data->sub.list = eina_list_remove(epc->comp_data->sub.list, ec); - epc->comp_data->sub.list_pending = eina_list_remove(epc->comp_data->sub.list_pending, ec); - epc->comp_data->sub.below_list = eina_list_append(epc->comp_data->sub.below_list, ec); - epc->comp_data->sub.list_changed = EINA_TRUE; + epc_cdata->sub.list = eina_list_remove(epc_cdata->sub.list, ec); + epc_cdata->sub.list_pending = eina_list_remove(epc_cdata->sub.list_pending, ec); + epc_cdata->sub.below_list = eina_list_append(epc_cdata->sub.below_list, ec); + epc_cdata->sub.list_changed = EINA_TRUE; } static void _tzpol_iface_cb_subsurf_stand_alone_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *subsurf) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Subsurf_Data *sdata; ec = wl_resource_get_user_data(subsurf); EINA_SAFETY_ON_NULL_RETURN(ec); - EINA_SAFETY_ON_NULL_RETURN(ec->comp_data); + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN(cdata); - sdata = ec->comp_data->sub.data; + sdata = cdata->sub.data; EINA_SAFETY_ON_NULL_RETURN(sdata); ELOGF("TZPOL", "SUBSURF|STAND_ALONE", ec); @@ -2080,6 +2106,7 @@ static void _tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, uint32_t parent_id) { E_Client *ec, *epc; + E_Comp_Wl_Client_Data *cdata = NULL; ELOGF("TZPOL", "SUBSURF |wl_surface@%d|parent_id:%d", @@ -2096,8 +2123,9 @@ _tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *res if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); /* check if this surface is already a sub-surface */ - if ((ec->comp_data) && (ec->comp_data->sub.data)) + if (cdata && cdata->sub.data) { wl_resource_post_error(resource, WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, @@ -2116,8 +2144,8 @@ _tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *res } /* ec's parent comes from another process */ - if (ec->comp_data) - ec->comp_data->has_extern_parent = EINA_TRUE; + if (cdata) + cdata->has_extern_parent = EINA_TRUE; } static void @@ -2228,13 +2256,15 @@ _e_policy_wl_allowed_aux_hint_send(struct wl_resource *res_tzpol, struct wl_reso static void _e_policy_wl_aux_hint_apply(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Aux_Hint *hint; Eina_List *l; - if (!ec->comp_data) return; - if (!ec->comp_data->aux_hint.changed) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->aux_hint.changed) return; - EINA_LIST_FOREACH(ec->comp_data->aux_hint.hints, l, hint) + EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) { if (!hint->changed) continue; EC_CHANGED(ec); @@ -2356,16 +2386,16 @@ _e_policy_wl_aux_hint_apply(E_Client *ec) else if (!strcmp(hint->hint, hint_names[E_POLICY_HINT_MSG_USE])) { if ((hint->deleted) || (!strcmp(hint->val, "0"))) - ec->comp_data->aux_hint.use_msg = EINA_FALSE; + cdata->aux_hint.use_msg = EINA_FALSE; else if (!strcmp(hint->val, "1")) - ec->comp_data->aux_hint.use_msg = EINA_TRUE; + cdata->aux_hint.use_msg = EINA_TRUE; } else if (!strcmp(hint->hint, hint_names[E_COMP_HINT_ALWAYS_SELECTIVE])) { if ((hint->deleted) || (!strcmp(hint->val, "0"))) - ec->comp_data->never_hwc = EINA_FALSE; + cdata->never_hwc = EINA_FALSE; else if (!strcmp(hint->val, "1")) - ec->comp_data->never_hwc = EINA_TRUE; + cdata->never_hwc = EINA_TRUE; e_comp_render_queue(); } @@ -2821,6 +2851,7 @@ _e_policy_wl_dpy_surf_add(E_Client *ec, struct wl_resource *res_tz_dpy_pol) { E_Policy_Wl_Tz_Dpy_Pol *tz_dpy_pol = NULL; E_Policy_Wl_Dpy_Surface *dpy_surf = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; tz_dpy_pol = _e_policy_wl_tz_dpy_pol_get(res_tz_dpy_pol); EINA_SAFETY_ON_NULL_RETURN_VAL(tz_dpy_pol, NULL); @@ -2832,7 +2863,9 @@ _e_policy_wl_dpy_surf_add(E_Client *ec, struct wl_resource *res_tz_dpy_pol) dpy_surf = E_NEW(E_Policy_Wl_Dpy_Surface, 1); EINA_SAFETY_ON_NULL_RETURN_VAL(dpy_surf, NULL); - dpy_surf->surf = ec->comp_data->surface; + cdata = e_client_cdata_get(ec); + EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, NULL); + dpy_surf->surf = cdata->surface; dpy_surf->tz_dpy_pol = tz_dpy_pol; dpy_surf->ec = ec; dpy_surf->brightness = -1; @@ -3065,11 +3098,14 @@ static void _tzpol_iface_cb_subsurf_watcher_destroy(struct wl_resource *resource) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(resource))) return; - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - ec->comp_data->sub.watcher = NULL; + cdata->sub.watcher = NULL; } static void @@ -3087,10 +3123,13 @@ static void _tzpol_iface_cb_subsurf_watcher_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surface) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; struct wl_resource *res; if (!(ec = wl_resource_get_user_data(surface))) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; if (!(res = wl_resource_create(client, &tizen_subsurface_watcher_interface, 1, id))) { @@ -3098,7 +3137,7 @@ _tzpol_iface_cb_subsurf_watcher_get(struct wl_client *client, struct wl_resource return; } - ec->comp_data->sub.watcher = res; + cdata->sub.watcher = res; wl_resource_set_implementation(res, &_tzpol_subsurf_watcher_iface, @@ -3110,6 +3149,7 @@ static void _tzpol_iface_cb_parent_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *child, struct wl_resource *parent) { E_Client *ec, *pc; + E_Comp_Wl_Client_Data *cdata = NULL, *pc_cdata = NULL; struct wl_resource *parent_surf; ELOGF("TZPOL", @@ -3126,9 +3166,10 @@ _tzpol_iface_cb_parent_set(struct wl_client *client, struct wl_resource *res_tzp } else { - EINA_SAFETY_ON_NULL_RETURN(pc->comp_data); + pc_cdata = e_client_cdata_get(pc); + EINA_SAFETY_ON_NULL_RETURN(pc_cdata); - parent_surf = pc->comp_data->surface; + parent_surf = pc_cdata->surface; _e_policy_wl_parent_surf_set(ec, parent_surf); ELOGF("TZPOL", @@ -3137,11 +3178,12 @@ _tzpol_iface_cb_parent_set(struct wl_client *client, struct wl_resource *res_tzp e_client_util_win_get(pc), parent_surf); + cdata = e_client_cdata_get(ec); ELOGF("TZPOL", " |win:0x%08zx|child |s:%8p", ec, e_client_util_win_get(ec), - (ec->comp_data ? ec->comp_data->surface : NULL)); + (cdata ? cdata->surface : NULL)); } EC_CHANGED(ec); @@ -3167,14 +3209,17 @@ static void _tzpol_iface_cb_has_video(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surface, uint32_t has) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(surface))) return; if (e_object_is_del(E_OBJECT(ec))) return; - if (ec->comp_data->has_video_client == has) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (cdata->has_video_client == has) return; ELOGF("TZPOL", "video client has(%d)", ec, has); - ec->comp_data->has_video_client = has; + cdata->has_video_client = has; } static void @@ -4394,7 +4439,7 @@ _e_tzsh_indicator_find_topvisible_client(E_Zone *zone) continue; /* if ec is subsurface, skip this */ - cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; + cdata = e_client_cdata_get(ec); if (cdata && cdata->sub.data) continue; e_client_geometry_get(ec, &ex, &ey, &ew, &eh); @@ -7125,14 +7170,16 @@ err: void e_policy_wl_indicator_flick_send(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Policy_Wl_Tz_Indicator *tz_indicator; struct wl_resource *surf; tz_indicator = _e_policy_wl_tz_indicator_get_from_client(ec); EINA_SAFETY_ON_NULL_RETURN(tz_indicator); - if (ec->comp_data) - surf = ec->comp_data->surface; + cdata = e_client_cdata_get(ec); + if (cdata) + surf = cdata->surface; else surf = NULL; @@ -7261,6 +7308,7 @@ _tz_clipboard_cb_data_only_set(struct wl_client *client, struct wl_resource *res Eina_Bool res; Eina_List *clients; E_Client *ec, *found = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; tz_clipboard = wl_resource_get_user_data(res_tz_clipboard); EINA_SAFETY_ON_NULL_RETURN(tz_clipboard); @@ -7289,9 +7337,10 @@ _tz_clipboard_cb_data_only_set(struct wl_client *client, struct wl_resource *res EINA_LIST_FREE(clients, ec) { if (found) continue; - if (ec->comp_data && ec->comp_data->surface) + cdata = e_client_cdata_get(ec); + if (cdata && cdata->surface) { - _wc = wl_resource_get_client(ec->comp_data->surface); + _wc = wl_resource_get_client(cdata->surface); if (_wc == client) found = ec; } @@ -7380,6 +7429,7 @@ err: EINTERN void e_policy_wl_clipboard_data_selected_send(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Policy_Wl_Tz_Clipboard *tz_clipboard; EINA_SAFETY_ON_NULL_RETURN(ec); @@ -7387,13 +7437,16 @@ e_policy_wl_clipboard_data_selected_send(E_Client *ec) tz_clipboard = _e_policy_wl_tz_clipboard_get_from_client(ec); EINA_SAFETY_ON_NULL_RETURN(tz_clipboard); + cdata = e_client_cdata_get(ec); tizen_clipboard_send_data_selected(tz_clipboard->res_tz_clipboard, - ec->comp_data? ec->comp_data->surface : NULL); + cdata ? cdata->surface : NULL); } static void _e_policy_wl_cb_hook_shell_surface_ready(void *d, E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + if (EINA_UNLIKELY(!ec)) return; @@ -7401,8 +7454,9 @@ _e_policy_wl_cb_hook_shell_surface_ready(void *d, E_Client *ec) e_client_base_output_resolution_transform_adjust(ec); - if ((ec->comp_data->shell.configure_send) && - (ec->comp_data->shell.surface)) + cdata = e_client_cdata_get(ec); + if ((cdata->shell.configure_send) && + (cdata->shell.surface)) { int w = 0, h = 0; if (ec->lock_client_size) @@ -7410,8 +7464,7 @@ _e_policy_wl_cb_hook_shell_surface_ready(void *d, E_Client *ec) w = ec->w; h = ec->h; } - ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, - 0, w, h); + cdata->shell.configure_send(cdata->shell.surface, 0, w, h); } } @@ -7470,6 +7523,7 @@ e_policy_wl_aux_message_send(E_Client *ec, const char *val, Eina_List *options) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Policy_Wl_Tzpol *tzpol; E_Policy_Wl_Surface *psurf; Eina_List *l; @@ -7479,10 +7533,10 @@ e_policy_wl_aux_message_send(E_Client *ec, int len; char *p; - if (!ec->comp_data) return; - if (!ec->comp_data->aux_hint.use_msg) return; - if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + if (!cdata->aux_hint.use_msg) return; wl_array_init(&opt_array); EINA_LIST_FOREACH(options, l, option) diff --git a/src/bin/e_presentation_time.c b/src/bin/e_presentation_time.c index 7da3b58869..4a889d99b3 100644 --- a/src/bin/e_presentation_time.c +++ b/src/bin/e_presentation_time.c @@ -173,11 +173,14 @@ _presentation_feedback(struct wl_client *client, uint32_t callback) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; E_Presentation_Time_Feedback *feedback; ec = wl_resource_get_user_data(surface_resource); if (!ec) return; if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; feedback = E_NEW(E_Presentation_Time_Feedback, 1); if (!feedback) @@ -201,7 +204,7 @@ _presentation_feedback(struct wl_client *client, PRSTT_TRACE("feedback:%p Create", NULL, feedback); - e_presentation_time_container_feedback_set(&ec->comp_data->pending.presentation_container, + e_presentation_time_container_feedback_set(&cdata->pending.presentation_container, feedback); } diff --git a/src/bin/e_process.c b/src/bin/e_process.c index 057d364c93..7decb033f5 100644 --- a/src/bin/e_process.c +++ b/src/bin/e_process.c @@ -427,6 +427,7 @@ _e_process_freeze_condition_check(pid_t pid) { E_Process *pinfo = NULL; E_Client *ec = NULL; + E_Comp_Wl_Client_Data *cdata = NULL; Eina_Bool freeze = EINA_TRUE; Eina_List *l; @@ -440,9 +441,10 @@ _e_process_freeze_condition_check(pid_t pid) EINA_LIST_FOREACH(pinfo->ec_list, l, ec) { - if (ec->comp_data && - ec->comp_data->sub.data && - ec->comp_data->sub.data->parent) + cdata = e_client_cdata_get(ec); + if (cdata && + cdata->sub.data && + cdata->sub.data->parent) continue; if (ec->visible && !ec->iconic) diff --git a/src/bin/e_slot.c b/src/bin/e_slot.c index 8d0d5de5a2..bdfb1da5f1 100644 --- a/src/bin/e_slot.c +++ b/src/bin/e_slot.c @@ -458,7 +458,7 @@ e_slot_update(Evas_Object *obj) { if (e_object_is_del(E_OBJECT(ec))) continue; if (e_client_util_ignored_get(ec)) continue; - if (!ec->comp_data) continue; + if (!e_client_cdata_get(ec)) continue; slot_client = eina_hash_find(_e_slot_g->hash_slot_clients, &ec); if (!slot_client) continue; @@ -631,7 +631,7 @@ e_slot_client_update(E_Client *ec) { if (e_object_is_del(E_OBJECT(slot_client->ec))) return; if (e_client_util_ignored_get(slot_client->ec)) return; - if (!slot_client->ec->comp_data) return; + if (!e_client_cdata_get(slot_client->ec)) return; e_client_geometry_get(slot_client->ec, &x, &y, &w, &h); diff --git a/src/bin/e_xdg_shell_v6.c b/src/bin/e_xdg_shell_v6.c index 6cb31e889c..cc97f14024 100644 --- a/src/bin/e_xdg_shell_v6.c +++ b/src/bin/e_xdg_shell_v6.c @@ -144,10 +144,13 @@ static Eina_Rectangle _e_xdg_positioner_geometry_get(E_Xdg_Positioner *p); static Eina_Bool _e_client_shsurface_assignable_check(E_Client *ec) { + E_Comp_Wl_Client_Data *cdata = NULL; + if (!e_shell_e_client_shell_assignable_check(ec)) { ERR("Could not assign shell", ec); - wl_resource_post_error(ec->comp_data->surface, + cdata = e_client_cdata_get(ec); + wl_resource_post_error(cdata->surface, WL_DISPLAY_ERROR_INVALID_OBJECT, "Could not assign shell surface to wl_surface"); return EINA_FALSE; @@ -159,7 +162,8 @@ _e_client_shsurface_assignable_check(E_Client *ec) static Eina_Bool _e_client_xdg_shell_v6_assigned_check(E_Client *ec) { - return !!ec->comp_data->sh_v6.res_role; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + return !!cdata->sh_v6.res_role; } static void @@ -167,17 +171,27 @@ _e_client_xdg_shell_v6_assign(E_Client *ec, struct wl_resource *resource, E_Comp_Wl_Sh_Surf_Role role) { - if ((!ec) || (!ec->comp_data) || (e_object_is_del(E_OBJECT(ec)))) - return; - ec->comp_data->sh_v6.res_role = resource; - ec->comp_data->sh_v6.role = role; + E_Comp_Wl_Client_Data *cdata = NULL; + + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + + cdata->sh_v6.res_role = resource; + cdata->sh_v6.role = role; } static void _e_client_xdg_shell_v6_role_assingment_unset(E_Client *ec) { - if ((!ec) || (!ec->comp_data) || (e_object_is_del(E_OBJECT(ec)))) - return; + E_Comp_Wl_Client_Data *cdata = NULL; + + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; + _e_client_xdg_shell_v6_assign(ec, NULL, E_COMP_WL_SH_SURF_ROLE_NONE); } @@ -204,9 +218,14 @@ _e_xdg_popup_positioner_apply(E_Xdg_Popup *popup, E_Xdg_Positioner *pos) static void _e_xdg_popup_parent_set(E_Xdg_Popup *popup, E_Xdg_Surface *parent) { + E_Comp_Wl_Client_Data *parent_cdata = NULL; + + parent_cdata = e_client_cdata_get(parent->ec); + if (!parent_cdata) return; + popup->parent = parent; /* set this client as a transient for parent */ - e_shell_e_client_parent_set(popup->base.ec, parent->ec->comp_data->surface); + e_shell_e_client_parent_set(popup->base.ec, parent_cdata->surface); } static void @@ -297,6 +316,7 @@ static void _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; int pw, ph; ec = toplevel->base.ec; @@ -306,9 +326,10 @@ _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel) return; } - if (!ec->comp_data) + cdata = e_client_cdata_get(ec); + if (!cdata) { - ERR("E_Client must have E_Comp_Client_Data", ec); + ERR("E_Client must have E_Comp_Wl_Client_Data", ec); return; } @@ -327,8 +348,8 @@ _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel) e_pixmap_size_get(ec->pixmap, &pw, &ph); if ((toplevel->next.state.maximized || toplevel->next.state.fullscreen) && - (toplevel->next.size.w != ec->comp_data->shell.window.w || - toplevel->next.size.h != ec->comp_data->shell.window.h || + (toplevel->next.size.w != cdata->shell.window.w || + toplevel->next.size.h != cdata->shell.window.h || toplevel->next.size.w != pw || toplevel->next.size.h != ph)) { @@ -338,7 +359,7 @@ _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel) toplevel->next.state.maximized, toplevel->next.state.fullscreen, toplevel->next.size.w, toplevel->next.size.h, - ec->comp_data->shell.window.w, ec->comp_data->shell.window.h, + cdata->shell.window.w, cdata->shell.window.h, pw, ph); /* TODO Disable this part for now, but need to consider enabling it later. * To enable this part, we first need to ensure that do not send configure @@ -570,6 +591,7 @@ _e_xdg_toplevel_cb_parent_set(struct wl_client *client, { E_Xdg_Toplevel *toplevel, *parent; E_Client *pc; + E_Comp_Wl_Client_Data *pc_cdata = NULL; struct wl_resource *parent_wsurface = NULL; toplevel = wl_resource_get_user_data(resource); @@ -599,9 +621,9 @@ _e_xdg_toplevel_cb_parent_set(struct wl_client *client, return; } - if (!pc->comp_data) return; - - parent_wsurface = pc->comp_data->surface; + pc_cdata = e_client_cdata_get(pc); + if (!pc_cdata) return; + parent_wsurface = pc_cdata->surface; } /* set this client as a transient for parent */ @@ -1107,7 +1129,7 @@ _e_xdg_surface_cb_configure_send(void *data) EINA_SAFETY_ON_NULL_GOTO(exsurf, end); EINA_SAFETY_ON_NULL_GOTO(exsurf->ec, end); - EINA_SAFETY_ON_NULL_GOTO(exsurf->ec->comp_data, end); + EINA_SAFETY_ON_NULL_GOTO(e_client_cdata_get(exsurf->ec), end); EINA_SAFETY_ON_NULL_GOTO(exsurf->resource, end); if (e_object_is_del(E_OBJECT(exsurf->ec))) @@ -1588,6 +1610,7 @@ _e_xdg_surface_cb_commit(void *data, int type, void *event) { E_Xdg_Surface *exsurf; E_Event_Client *ev; + E_Comp_Wl_Client_Data *exsurf_cdata; exsurf = (E_Xdg_Surface *)data; ev = (E_Event_Client *)event; @@ -1607,7 +1630,8 @@ _e_xdg_surface_cb_commit(void *data, int type, void *event) if (exsurf->has_window_geometry) { exsurf->has_window_geometry = EINA_FALSE; - EINA_RECTANGLE_SET(&exsurf->ec->comp_data->shell.window, + exsurf_cdata = e_client_cdata_get(exsurf->ec); + EINA_RECTANGLE_SET(&exsurf_cdata->shell.window, exsurf->window_geometry.x, exsurf->window_geometry.y, exsurf->window_geometry.w, diff --git a/src/bin/services/e_service_cbhm.c b/src/bin/services/e_service_cbhm.c index 13ebc39f78..e84ebb5c8c 100644 --- a/src/bin/services/e_service_cbhm.c +++ b/src/bin/services/e_service_cbhm.c @@ -35,6 +35,7 @@ _cbhm_cb_evas_show(void *d, Evas *evas EINA_UNUSED, Evas_Object *obj, void *even { E_Policy_Cbhm *cbhm; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; cbhm = d; if (EINA_UNLIKELY(!cbhm)) @@ -47,8 +48,8 @@ _cbhm_cb_evas_show(void *d, Evas *evas EINA_UNUSED, Evas_Object *obj, void *even if (ec->frame != obj) return; - if ((!cbhm->show_block) && - (ec->comp_data->mapped)) + cdata = e_client_cdata_get(ec); + if ((!cbhm->show_block) && (cdata->mapped)) cbhm->show_block = EINA_TRUE; } @@ -171,6 +172,7 @@ EINTERN void e_service_cbhm_client_set(E_Client *ec) { E_Policy_Cbhm *cbhm; + E_Comp_Wl_Client_Data *cdata = NULL; if (EINA_UNLIKELY(!ec)) { @@ -207,7 +209,8 @@ e_service_cbhm_client_set(E_Client *ec) // set skip iconify ec->exp_iconify.skip_iconify = 1; - e_comp_wl->selection.cbhm = ec->comp_data->surface; + cdata = e_client_cdata_get(ec); + e_comp_wl->selection.cbhm = cdata->surface; e_client_window_role_set(ec, "cbhm"); e_policy_conformant_part_add(ec); diff --git a/src/bin/services/e_service_launcher.c b/src/bin/services/e_service_launcher.c index b0d13fde29..4c64a84121 100644 --- a/src/bin/services/e_service_launcher.c +++ b/src/bin/services/e_service_launcher.c @@ -1231,17 +1231,18 @@ _launcher_cb_launching(struct wl_client *client EINA_UNUSED, static void _launcher_target_ec_queue_flush(E_Service_Launcher *lc) { + E_Comp_Wl_Client_Data *target_cdata = NULL; struct wayland_tbm_client_queue *cqueue; if (!e_comp_wl) return; if (!lc) return; if (!lc->target.ec) return; - if (!lc->target.ec->comp_data) return; - if (!lc->target.ec->comp_data->wl_surface) return; + target_cdata = e_client_cdata_get(lc->target.ec); + if (!target_cdata) return; + if (!target_cdata->wl_surface) return; if (e_object_is_del(E_OBJECT(lc->target.ec))) return; - cqueue = wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server, - lc->target.ec->comp_data->wl_surface); + cqueue = wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server, target_cdata->wl_surface); if (cqueue) wayland_tbm_server_client_queue_flush(cqueue); } @@ -1326,7 +1327,8 @@ _launcher_cb_launch_done(struct wl_client *client EINA_UNUSED, if (target_ec->first_mapped) { - ELOGF("LAUNCH", "SHOW real win (target->frame:%p, map:%d) by launcher service (win:0x%08zx, ec:%p).", target_ec, target_ec->frame, target_ec->comp_data->mapped, e_client_util_win_get(lc->ec), lc->ec); + E_Comp_Wl_Client_Data *target_cdata = e_client_cdata_get(target_ec); + ELOGF("LAUNCH", "SHOW real win (target->frame:%p, map:%d) by launcher service (win:0x%08zx, ec:%p).", target_ec, target_ec->frame, target_cdata->mapped, e_client_util_win_get(lc->ec), lc->ec); e_comp_object_signal_emit(target_ec->frame, "e,action,launch_real,done", "e"); } e_comp_object_signal_emit(target_ec->frame, "e,action,launch,done", "e"); @@ -1383,6 +1385,7 @@ static E_Client * _launcher_handler_rsm_provider_client_find(E_Client *rsm_consumer_ec) { E_Client *prov_ec = NULL; + E_Comp_Wl_Client_Data *prov_cdata = NULL; Eina_List *tzrs_provs, *l; E_Service_Launcher *lc; @@ -1397,7 +1400,8 @@ _launcher_handler_rsm_provider_client_find(E_Client *rsm_consumer_ec) if (!prov_ec->remote_surface.provider) continue; if (prov_ec->visible) continue; if (evas_object_visible_get(prov_ec->frame)) continue; - if (prov_ec->comp_data->mapped) continue; + prov_cdata = e_client_cdata_get(prov_ec); + if (prov_cdata->mapped) continue; if (!(lc = _launcher_handler_launcher_find(prov_ec))) continue; if (!lc->launched_ec) continue; diff --git a/src/bin/services/e_service_volume.c b/src/bin/services/e_service_volume.c index 1dc8c11f9e..53f3b3b508 100644 --- a/src/bin/services/e_service_volume.c +++ b/src/bin/services/e_service_volume.c @@ -52,10 +52,11 @@ _volume_region_obj_cb_mouse_down(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, { Evas_Event_Mouse_Down *e = event; uint32_t serial; + E_Comp_Wl_Client_Data *volume_cdata = e_client_cdata_get(_volume_ec); serial = wl_display_next_serial(e_comp_wl->wl.disp); wl_touch_send_down(_volume_wl_touch, serial, e->timestamp, - _volume_ec->comp_data->surface, 0, + volume_cdata->surface, 0, wl_fixed_from_int(e->canvas.x - _volume_ec->client.x), wl_fixed_from_int(e->canvas.y - _volume_ec->client.y)); } @@ -75,10 +76,11 @@ _volume_region_obj_cb_multi_down(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, { Evas_Event_Multi_Down *e = event; uint32_t serial; + E_Comp_Wl_Client_Data *volume_cdata = e_client_cdata_get(_volume_ec); serial = wl_display_next_serial(e_comp_wl->wl.disp); wl_touch_send_down(_volume_wl_touch, serial, e->timestamp, - _volume_ec->comp_data->surface, e->device, + volume_cdata->surface, e->device, wl_fixed_from_int(e->canvas.x - _volume_ec->client.x), wl_fixed_from_int(e->canvas.y - _volume_ec->client.y)); } @@ -408,10 +410,11 @@ _volume_wl_touch_resource_get(void) Eina_List *l; struct wl_client *wc; struct wl_resource *res; + E_Comp_Wl_Client_Data *volume_cdata = e_client_cdata_get(_volume_ec); if (_volume_wl_touch) goto end; - - wc = wl_resource_get_client(_volume_ec->comp_data->surface); + + wc = wl_resource_get_client(volume_cdata->surface); EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res) { if (wl_resource_get_client(res) != wc) continue; diff --git a/src/bin/video/e_client_video.c b/src/bin/video/e_client_video.c index db789f2b9c..d40c91cd1e 100644 --- a/src/bin/video/e_client_video.c +++ b/src/bin/video/e_client_video.c @@ -237,20 +237,23 @@ static E_Client * _e_client_video_ec_offscreen_parent_get(E_Client *ec) { E_Client *parent = NULL; + E_Comp_Wl_Client_Data *cdata = NULL, *parent_cdate = NULL; - if (!ec->comp_data || !ec->comp_data->sub.data) + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->sub.data) return NULL; - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; while (parent) { - if (!parent->comp_data || !parent->comp_data->sub.data) + parent_cdate = e_client_cdata_get(parent); + if (!parent_cdate || !parent_cdate->sub.data) return NULL; - if (parent->comp_data->sub.data->remote_surface.offscreen_parent) - return parent->comp_data->sub.data->remote_surface.offscreen_parent; + if (parent_cdate->sub.data->remote_surface.offscreen_parent) + return parent_cdate->sub.data->remote_surface.offscreen_parent; - parent = parent->comp_data->sub.data->parent; + parent = parent_cdate->sub.data->parent; } return NULL; diff --git a/src/bin/video/e_comp_wl_video.c b/src/bin/video/e_comp_wl_video.c index 0e340a9deb..c5c1b8ef73 100644 --- a/src/bin/video/e_comp_wl_video.c +++ b/src/bin/video/e_comp_wl_video.c @@ -329,11 +329,13 @@ _e_comp_wl_video_handle_viewport_get(struct wl_client *client, struct wl_resource *surface) { E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; if (!(ec = wl_resource_get_user_data(surface))) return; - if (!ec->comp_data) return; + cdata = e_client_cdata_get(ec); + if (!cdata) return; - if (ec->comp_data && ec->comp_data->scaler.viewport) + if (cdata->scaler.viewport) { wl_resource_post_error(resource, TIZEN_VIDEO_ERROR_VIEWPORT_EXISTS, diff --git a/src/bin/video/e_comp_wl_video_buffer.c b/src/bin/video/e_comp_wl_video_buffer.c index 812a38d0d1..1bf9e7de08 100644 --- a/src/bin/video/e_comp_wl_video_buffer.c +++ b/src/bin/video/e_comp_wl_video_buffer.c @@ -923,8 +923,9 @@ e_comp_wl_video_buffer_size_get(E_Client *ec, int *bw, int *bh) EINTERN void e_comp_wl_video_buffer_transform_scale_size_get(E_Client *ec, int *bw, int *bh) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); E_Comp_Wl_Buffer *buffer = e_pixmap_resource_get(ec->pixmap); - E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport; + E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport; int w, h, transform; if (bw) *bw = 0; diff --git a/src/bin/video/iface/e_video_hwc.c b/src/bin/video/iface/e_video_hwc.c index 8c5c674c12..1cd1ae309c 100644 --- a/src/bin/video/iface/e_video_hwc.c +++ b/src/bin/video/iface/e_video_hwc.c @@ -54,20 +54,23 @@ static E_Client * _e_video_hwc_client_offscreen_parent_get(E_Client *ec) { E_Client *parent = NULL; + E_Comp_Wl_Client_Data *cdata = NULL, *parent_cdata = NULL; - if (!ec->comp_data || !ec->comp_data->sub.data) + cdata = e_client_cdata_get(ec); + if (!cdata || !cdata->sub.data) return NULL; - parent = ec->comp_data->sub.data->parent; + parent = cdata->sub.data->parent; while (parent) { - if (!parent->comp_data || !parent->comp_data->sub.data) + parent_cdata = e_client_cdata_get(parent); + if (!parent_cdata || !parent_cdata->sub.data) return NULL; - if (parent->comp_data->sub.data->remote_surface.offscreen_parent) - return parent->comp_data->sub.data->remote_surface.offscreen_parent; + if (parent_cdata->sub.data->remote_surface.offscreen_parent) + return parent_cdata->sub.data->remote_surface.offscreen_parent; - parent = parent->comp_data->sub.data->parent; + parent = parent_cdata->sub.data->parent; } return NULL; @@ -77,6 +80,7 @@ static Eina_Bool _e_video_hwc_client_visible_get(E_Client *ec) { E_Client *offscreen_parent; + E_Comp_Wl_Client_Data *cdata = NULL; if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; @@ -86,7 +90,8 @@ _e_video_hwc_client_visible_get(E_Client *ec) return EINA_FALSE; } - if (ec->comp_data->sub.data && ec->comp_data->sub.data->stand_alone) + cdata = e_client_cdata_get(ec); + if (cdata->sub.data && cdata->sub.data->stand_alone) return EINA_TRUE; offscreen_parent = _e_video_hwc_client_offscreen_parent_get(ec); @@ -216,9 +221,10 @@ _e_video_hwc_input_buffer_get(E_Video_Hwc *evh, E_Comp_Wl_Buffer *comp_buffer) evh->input_buffer_list = eina_list_append(evh->input_buffer_list, vbuf); e_comp_wl_video_buffer_free_func_add(vbuf, _e_video_hwc_input_buffer_cb_free, evh); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(evh->ec); DBG("Client(%s):PID(%d) RscID(%d), Buffer(%p) created", e_client_util_name_get(evh->ec) ?: "No Name" , evh->ec->netwm.pid, - wl_resource_get_id(evh->ec->comp_data->surface), vbuf); + wl_resource_get_id(cdata->surface), vbuf); end: vbuf->content_r = evh->geo.input_r; return vbuf; @@ -387,9 +393,10 @@ _e_video_hwc_pp_input_buffer_get(E_Video_Hwc *evh, E_Comp_Wl_Buffer *comp_buffer evh->input_buffer_list = eina_list_append(evh->input_buffer_list, vbuf); e_comp_wl_video_buffer_free_func_add(vbuf, _e_video_hwc_input_buffer_cb_free, evh); + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(evh->ec); DBG("Client(%s):PID(%d) RscID(%d), Buffer(%p) created", e_client_util_name_get(evh->ec) ?: "No Name" , evh->ec->netwm.pid, - wl_resource_get_id(evh->ec->comp_data->surface), vbuf); + wl_resource_get_id(cdata->surface), vbuf); end: vbuf->content_r = evh->geo.input_r; return vbuf; @@ -1111,6 +1118,7 @@ _e_video_hwc_transform_merge_with_buffer_viewport(E_Comp_Wl_Buffer_Viewport *vp, static Eina_Bool _e_video_hwc_geometry_map_apply(E_Client *ec, E_Video_Hwc_Geometry *out) { + E_Comp_Wl_Client_Data *cdata = NULL; const Evas_Map *m; Evas_Point p[4]; Eina_Rectangle output_r; @@ -1140,12 +1148,13 @@ _e_video_hwc_geometry_map_apply(E_Client *ec, E_Video_Hwc_Geometry *out) return EINA_FALSE; } + cdata = e_client_cdata_get(ec); /* NOTE Merge transform value from evas_map with E_Comp_Wl_Buffer_Viewport's one. * Since buffer.transform isn't applied using evas_map, * it has to be taken into account here to apply buffer.transform * and rotation of e_client_transform together. */ transform = - _e_video_hwc_transform_merge_with_buffer_viewport(&ec->comp_data->scaler.buffer_viewport, + _e_video_hwc_transform_merge_with_buffer_viewport(&cdata->scaler.buffer_viewport, transform); if ((!memcmp(&out->output_r, &output_r, sizeof(Eina_Rectangle))) && @@ -1403,8 +1412,9 @@ _e_video_hwc_geometry_input_rect_get_with_viewport(tbm_surface_h tbm_surf, E_Com static E_Comp_Wl_Subsurf_Data * _e_video_hwc_client_subsurface_data_get(E_Client *ec) { - if (ec->comp_data && ec->comp_data->sub.data) - return ec->comp_data->sub.data; + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec); + if (cdata && cdata->sub.data) + return cdata->sub.data; return NULL; } @@ -1413,6 +1423,7 @@ static void _e_video_hwc_geometry_output_rect_get(E_Client *ec, Eina_Rectangle *out) { E_Comp_Wl_Subsurf_Data *sdata; + E_Comp_Wl_Client_Data *cdata = NULL; sdata = _e_video_hwc_client_subsurface_data_get(ec); if (sdata) @@ -1434,9 +1445,10 @@ _e_video_hwc_geometry_output_rect_get(E_Client *ec, Eina_Rectangle *out) out->y = ec->y; } - out->w = ec->comp_data->width_from_viewport; + cdata = e_client_cdata_get(ec); + out->w = cdata->width_from_viewport; out->w = (out->w + 1) & ~1; - out->h = ec->comp_data->height_from_viewport; + out->h = cdata->height_from_viewport; e_comp_object_frame_xy_unadjust(ec->frame, out->x, out->y, &out->x, &out->y); e_comp_object_frame_wh_unadjust(ec->frame, out->w, out->h, &out->w, &out->h); @@ -1446,6 +1458,7 @@ _e_video_hwc_geometry_output_rect_get(E_Client *ec, Eina_Rectangle *out) static Eina_Bool _e_video_hwc_geometry_viewport_apply(E_Client *ec, E_Video_Hwc_Geometry *out) { + E_Comp_Wl_Client_Data *cdata = NULL; E_Comp_Wl_Buffer_Viewport *vp; tbm_surface_h tbm_surf; @@ -1459,7 +1472,8 @@ _e_video_hwc_geometry_viewport_apply(E_Client *ec, E_Video_Hwc_Geometry *out) return EINA_FALSE; } - vp = &ec->comp_data->scaler.buffer_viewport; + cdata = e_client_cdata_get(ec); + vp = &cdata->scaler.buffer_viewport; _e_video_hwc_geometry_input_rect_get_with_viewport(tbm_surf, vp, &out->input_r); _e_video_hwc_geometry_output_rect_get(ec, &out->output_r); @@ -1629,17 +1643,21 @@ static E_Client * _e_video_hwc_child_client_get(E_Client *ec) { E_Client *subc = NULL; + E_Comp_Wl_Client_Data *cdata = NULL, *subc_cdata = NULL; Eina_List *l; + if (!ec) return NULL; if (e_object_is_del(E_OBJECT(ec))) return NULL; - if (!ec->comp_data) return NULL; + cdata = e_client_cdata_get(ec); + if (!cdata) return NULL; if (e_client_video_hw_composition_check(ec)) return ec; - EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + EINA_LIST_FOREACH(cdata->sub.below_list, l, subc) { E_Client *temp= NULL; - if (!subc->comp_data || e_object_is_del(E_OBJECT(subc))) continue; + subc_cdata = e_client_cdata_get(subc); + if (!subc_cdata || e_object_is_del(E_OBJECT(subc))) continue; temp = _e_video_hwc_child_client_get(subc); if(temp) return temp; } @@ -1659,7 +1677,7 @@ _e_video_hwc_cb_client_show(void *data, int type, void *event) EINA_SAFETY_ON_NULL_RETURN_VAL(ev->ec, ECORE_CALLBACK_PASS_ON); ec = ev->ec; - if (!ec->comp_data) return ECORE_CALLBACK_PASS_ON; + if (!e_client_cdata_get(ec)) return ECORE_CALLBACK_PASS_ON; video_ec = _e_video_hwc_child_client_get(ec); if (!video_ec) return ECORE_CALLBACK_PASS_ON; @@ -1713,6 +1731,7 @@ _e_video_hwc_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA { E_Video_Hwc *evh; E_Client *ec; + E_Comp_Wl_Client_Data *cdata = NULL; evh = data; ec = evh->ec; @@ -1726,8 +1745,9 @@ _e_video_hwc_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA _e_video_hwc_render_queue(evh); } + cdata = e_client_cdata_get(ec); /* if stand_alone is true, not show */ - if (ec->comp_data->sub.data && ec->comp_data->sub.data->stand_alone) + if (cdata->sub.data && cdata->sub.data->stand_alone) return; if (evh->current_fb) @@ -1749,11 +1769,13 @@ _e_video_hwc_cb_surface_viewport(struct wl_listener *listener, void *data) static void _e_video_hwc_client_event_init(E_Video_Hwc *evh) { + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(evh->ec); + /* In order to try to redraw video whenever viewport changes. */ evh->surface_viewport_listener.notify = _e_video_hwc_cb_surface_viewport; - if (evh->ec->comp_data) + if (cdata) { - wl_signal_add(&evh->ec->comp_data->apply_viewport_signal, + wl_signal_add(&cdata->apply_viewport_signal, &evh->surface_viewport_listener); } @@ -1773,8 +1795,10 @@ _e_video_hwc_client_event_init(E_Video_Hwc *evh) static void _e_video_hwc_client_event_deinit(E_Video_Hwc *evh) { - /* links for listener have to be removed only in case comp_data is valid. */ - if (evh->ec->comp_data) + E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(evh->ec); + + /* links for listener have to be removed only in case cdata is valid. */ + if (cdata) wl_list_remove(&evh->surface_viewport_listener.link); evas_object_event_callback_del_full(evh->ec->frame, EVAS_CALLBACK_SHOW, @@ -1999,6 +2023,7 @@ EINTERN void e_video_hwc_client_mask_update(E_Video_Hwc *evh) { E_Client *topmost; + E_Comp_Wl_Client_Data *topmost_cdata = NULL; Eina_Bool punch = EINA_FALSE; int bw, bh; @@ -2006,8 +2031,9 @@ e_video_hwc_client_mask_update(E_Video_Hwc *evh) punch = EINA_TRUE; else if ((topmost = e_comp_wl_topmost_parent_get(evh->ec))) { + topmost_cdata = e_client_cdata_get(topmost); /* if it's laid above main surface */ - if (eina_list_data_find(topmost->comp_data->sub.list, evh->ec)) + if (eina_list_data_find(topmost_cdata->sub.list, evh->ec)) punch = EINA_TRUE; /* if it's laid under main surface and main surface is transparent */ else if (topmost->argb) diff --git a/src/bin/video/iface/e_video_hwc_planes.c b/src/bin/video/iface/e_video_hwc_planes.c index 8bc935c0f9..6692ee4941 100644 --- a/src/bin/video/iface/e_video_hwc_planes.c +++ b/src/bin/video/iface/e_video_hwc_planes.c @@ -595,11 +595,12 @@ _e_video_hwc_planes_buffer_commit(E_Video_Hwc_Planes *evhp, E_Comp_Wl_Video_Buf e_video_hwc_client_mask_update((E_Video_Hwc *)evhp); + E_Comp_Wl_Client_Data *base_cdata = e_client_cdata_get(evhp->base.ec); DBG("Client(%s):PID(%d) RscID(%d), Buffer(%p, refcnt:%d) is shown." "Geometry details are : buffer size(%dx%d) src(%d,%d, %dx%d)" " dst(%d,%d, %dx%d), transform(%d)", e_client_util_name_get(evhp->base.ec) ?: "No Name" , evhp->base.ec->netwm.pid, - wl_resource_get_id(evhp->base.ec->comp_data->surface), vbuf, vbuf->ref_cnt, + wl_resource_get_id(base_cdata->surface), vbuf, vbuf->ref_cnt, info->src_config.size.h, info->src_config.size.v, info->src_config.pos.x, info->src_config.pos.y, info->src_config.pos.w, info->src_config.pos.h, info->dst_pos.x, info->dst_pos.y, info->dst_pos.w, info->dst_pos.h, info->transform); @@ -643,11 +644,14 @@ static void _e_video_hwc_planes_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { E_Video_Hwc_Planes *evhp = data; + E_Comp_Wl_Client_Data *base_cdata = NULL; if (e_object_is_del(E_OBJECT(evhp->base.ec))) return; + base_cdata = e_client_cdata_get(evhp->base.ec); + if (!base_cdata) return; /* if stand_alone is true, not hide */ - if (evhp->base.ec->comp_data->sub.data && evhp->base.ec->comp_data->sub.data->stand_alone) + if (base_cdata->sub.data && base_cdata->sub.data->stand_alone) return; VIN("evas hide", evhp->base.ec); diff --git a/src/bin/video/iface/e_video_hwc_windows.c b/src/bin/video/iface/e_video_hwc_windows.c index c5ce0b5f87..094a087be4 100644 --- a/src/bin/video/iface/e_video_hwc_windows.c +++ b/src/bin/video/iface/e_video_hwc_windows.c @@ -70,12 +70,14 @@ _e_video_hwc_windows_commit_data_set(E_Video_Hwc_Windows *evhw, E_Comp_Wl_Video_ * frame buffer. */ evhw->commit_data.wait_release = EINA_TRUE; + E_Comp_Wl_Client_Data *base_ec_cdata = e_client_cdata_get(evhw->base.ec); + DBG("Client(%s):PID(%d) RscID(%d), Buffer(%p, refcnt:%d) is shown." "Geometry details are : buffer size(%dx%d) src(%d,%d, %dx%d)" " dst(%d,%d, %dx%d), transform(%d)", e_client_util_name_get(evhw->base.ec) ?: "No Name" , evhw->base.ec->netwm.pid, - wl_resource_get_id(evhw->base.ec->comp_data->surface), + wl_resource_get_id(base_ec_cdata->surface), vbuf, vbuf->ref_cnt, evhw->commit_data.info.src_config.size.h, evhw->commit_data.info.src_config.size.v,