From: Doyoun Kang Date: Thu, 19 Sep 2024 01:17:07 +0000 (+0900) Subject: refactoring: change code to use E_APIs to access the E_Comp_Wl_Client_Data structure X-Git-Tag: accepted/tizen/unified/20240920.050150~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F317802%2F1;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wl-textinput.git refactoring: change code to use E_APIs to access the E_Comp_Wl_Client_Data structure Change-Id: I708c9344ba506c9b0ed23da6af282ad52a9d1b25 --- diff --git a/src/e_mod_input_panel.c b/src/e_mod_input_panel.c index ee0c816..386a1fa 100644 --- a/src/e_mod_input_panel.c +++ b/src/e_mod_input_panel.c @@ -411,20 +411,18 @@ _e_input_panel_surface_resource_destroy(struct wl_resource *resource) ec = ips->ec; if (ec && (!e_object_is_del(E_OBJECT(ec)))) { - if (ec->comp_data) + if (e_comp_wl_data_check(ec)) { - if (ec->comp_data->mapped) + if (e_comp_wl_mapped_get(ec)) { - if ((ec->comp_data->shell.surface) && - (ec->comp_data->shell.unmap)) - ec->comp_data->shell.unmap(ec->comp_data->shell.surface); + e_comp_wl_shell_unmap(ec); } if (ec->parent) { ec->parent->transients = eina_list_remove(ec->parent->transients, ec); } - ec->comp_data->shell.surface = NULL; + e_comp_wl_shell_surface_set(ec, NULL); } } @@ -835,7 +833,7 @@ _e_input_panel_surface_map(struct wl_resource *resource) return; } - if (!ec->comp_data) + if (!e_comp_wl_data_check(ec)) { WTI_WARNING(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -844,9 +842,9 @@ _e_input_panel_surface_map(struct wl_resource *resource) } /* NOTE: we need to set mapped, so that avoid showing evas_object and continue buffer's commit process. */ - if ((!ec->comp_data->mapped) && (e_pixmap_usable_get(ec->pixmap))) + if ((!e_comp_wl_mapped_get(ec)) && (e_pixmap_usable_get(ec->pixmap))) { - ec->comp_data->mapped = EINA_TRUE; + e_comp_wl_mapped_set(ec, EINA_TRUE); ec->first_mapped = EINA_TRUE; } @@ -864,7 +862,7 @@ _e_input_panel_surface_unmap(struct wl_resource *resource) ec = ips->ec; CHECK_ECLIENT(ec, resource); - if (!ec->comp_data) + if (!e_comp_wl_data_check(ec)) { WTI_WARNING(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -874,11 +872,11 @@ _e_input_panel_surface_unmap(struct wl_resource *resource) if (e_object_is_del(E_OBJECT(ec))) return; - if (ec->comp_data->mapped) + if (e_comp_wl_mapped_get(ec)) { e_client_visible_set(ec, EINA_FALSE); e_view_client_hide(e_client_view_get(ec)); - ec->comp_data->mapped = EINA_FALSE; + e_comp_wl_mapped_set(ec, EINA_FALSE); } } @@ -1165,7 +1163,7 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso E_Input_Panel *input_panel = wl_resource_get_user_data(resource); E_Client *ec = e_client_from_surface_resource(surface_resource); E_Input_Panel_Surface *ips = NULL; - E_Comp_Wl_Client_Data *cdata = NULL; + struct wl_resource *shell_surface; LOGI("client %p input_panel %p ec %p resource %p surface_resource %p", client, input_panel, ec, resource, surface_resource); @@ -1183,7 +1181,7 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; - if (!(cdata = ec->comp_data)) + if (!e_comp_wl_data_check(ec)) { WTI_WARNING(surface_resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -1192,7 +1190,7 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso } /* check for existing shell surface */ - if (cdata->shell.surface) + if (e_comp_wl_shell_surface_get(ec)) { WTI_WARNING(surface_resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -1200,13 +1198,14 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso return; } - if (!(cdata->shell.surface = + if (!(shell_surface = wl_resource_create(client, &zwp_input_panel_surface_v1_interface, 1, id))) { wl_resource_post_no_memory(surface_resource); /* NOTE: Cleanup E_client. */ return; } + e_comp_wl_shell_surface_set(ec, shell_surface); if (ec->ignored) e_client_unignore(ec); @@ -1233,11 +1232,14 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_DOWN, _e_ips_cb_mouse_down, ec); evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_MOVE, _e_ips_cb_mouse_move, ec); - cdata->shell.configure_send = NULL; - cdata->shell.configure = _e_input_panel_surface_configure; - cdata->shell.ping = NULL; - cdata->shell.map = _e_input_panel_surface_map; - cdata->shell.unmap = _e_input_panel_surface_unmap; + E_Comp_Wl_Shell_Surface_Api api = { + .configure_send = NULL, + .configure = _e_input_panel_surface_configure, + .ping = NULL, + .map = _e_input_panel_surface_map, + .unmap = _e_input_panel_surface_unmap, + }; + e_comp_wl_shell_surface_api_set(ec, &api); if (!(ips = E_NEW(E_Input_Panel_Surface, 1))) { @@ -1255,7 +1257,7 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso _e_input_panel_surface_append(input_panel, ips, resource); - wl_resource_set_implementation(cdata->shell.surface, + wl_resource_set_implementation(shell_surface, &_e_input_panel_surface_implementation, ips, _e_input_panel_surface_resource_destroy); @@ -1310,16 +1312,15 @@ _e_input_panel_unbind(struct wl_resource *resource) if (ips && ips->resource == resource) { E_Client *ec; - E_Comp_Wl_Client_Data *cdata; input_panel->surfaces = eina_list_remove_list(input_panel->surfaces, l); LOGI("Removed surface %p from list %p", l, input_panel->surfaces); if (!(ec = ips->ec)) continue; if (e_object_is_del(E_OBJECT(ec))) continue; - if (!(cdata = ec->comp_data)) continue; + if (!e_comp_wl_data_check(ec)) continue; - cdata->shell.surface = NULL; + e_comp_wl_shell_surface_set(ec, NULL); } } } @@ -1629,9 +1630,9 @@ e_input_panel_transient_for_set(E_Client *parent) if (ec_parent) { if (!e_object_is_del(E_OBJECT(ec_parent)) && - (ec_parent->comp_data) && (ec_parent->comp_data->remote_surface.onscreen_parent)) + e_comp_wl_remote_surface_onscreen_parent_get(ec_parent)) { - ec_parent = ec_parent->comp_data->remote_surface.onscreen_parent; + ec_parent = e_comp_wl_remote_surface_onscreen_parent_get(ec_parent); } }