From fa1ff0eddd1bc15489dee5093e207a8e02fdeb75 Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Wed, 14 Oct 2020 21:39:45 +0900 Subject: [PATCH] e_service_softkey: pending visible request if there is no softkey service when the softkey service is not launched yet, hide request from client can ignored. for fix this issue, this patch pending visible request if there is no softkey service. and restore requset after softkey service launch. Change-Id: I38c9cd3aa86ffe3638c68d60907fb318d726c884 Signed-off-by: Junseok, Kim --- src/bin/e_policy_wl.c | 19 ++++- src/bin/services/e_service_softkey.c | 105 +++++++++++++++++++++++++++ src/bin/services/e_service_softkey.h | 5 ++ 3 files changed, 128 insertions(+), 1 deletion(-) diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 459f9845b5..2fb04232cc 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -3595,7 +3595,10 @@ _tzsh_srv_iface_cb_softkey_get(struct wl_client *client, struct wl_resource *res softkey = e_service_softkey_get(softkey_ec->zone); ELOGF("TZSH", "[SOFTKEY SERVICE] resource set. res:%p, softkey:%p, softkey_ec:%p", NULL, res, softkey, softkey_ec); if (softkey) - e_service_softkey_wl_resource_set(softkey, res); + { + e_service_softkey_wl_resource_set(softkey, res); + e_service_softkey_restore_visible_request(softkey); + } } wl_resource_set_implementation(res, &_tzsh_srv_softkey_iface, tzsh_srv, NULL); @@ -5028,6 +5031,11 @@ _tzsh_softkey_iface_cb_show(struct wl_client *client EINA_UNUSED, struct wl_reso ELOGF("TZ_SOFTKEY", "Request to SHOW softkey. (service:%p)", NULL, softkey); e_service_softkey_visible_set(softkey, 1); } + else + { + ELOGF("TZ_SOFTKEY", "There is no softkey service. store show request", tzsh_client->tzsh->ec); + e_service_softkey_store_visible_request(tzsh_client->tzsh->ec, 1); + } } } @@ -5069,6 +5077,11 @@ _tzsh_softkey_iface_cb_hide(struct wl_client *client EINA_UNUSED, struct wl_reso ELOGF("TZ_SOFTKEY", "Request to HIDE softkey. (service:%p)", NULL, softkey); e_service_softkey_visible_set(softkey, 0); } + else + { + ELOGF("TZ_SOFTKEY", "There is no softkey service. store hide request", tzsh_client->tzsh->ec); + e_service_softkey_store_visible_request(tzsh_client->tzsh->ec, 0); + } } } @@ -7651,6 +7664,8 @@ e_policy_wl_init(void) E_EVENT_POLICY_INDICATOR_OPACITY_MODE_CHANGE = ecore_event_type_new(); E_EVENT_POLICY_INDICATOR_VISIBLE_STATE_CHANGE = ecore_event_type_new(); + e_service_softkey_client_remove_handler_add(); + e_policy_display_init(); return EINA_TRUE; @@ -7686,6 +7701,8 @@ e_policy_wl_shutdown(void) E_FREE_LIST(hooks_co, e_comp_object_intercept_hook_del); E_FREE_LIST(handlers, ecore_event_handler_del); + e_service_softkey_client_remove_handler_del(); + polwl->pending_vis = eina_list_free(polwl->pending_vis); for (i = 0; i < TZSH_SRV_ROLE_MAX; i++) diff --git a/src/bin/services/e_service_softkey.c b/src/bin/services/e_service_softkey.c index 92ecedcb8a..a86be5c50b 100644 --- a/src/bin/services/e_service_softkey.c +++ b/src/bin/services/e_service_softkey.c @@ -27,8 +27,21 @@ do \ } \ } while (0) +typedef struct _E_Service_Softkey_Pending_Visible_Request +{ + E_Client *ec; + Eina_Bool visible; +} E_Service_Softkey_Pending_Visible_Request; + +typedef struct _E_Service_Softkey_Pending_Request +{ + Eina_List *visible; + Ecore_Event_Handler *ec_remove_handler; +} E_Service_Softkey_Pending_Request; + static Eina_List *_e_softkey_list; static E_Service_Softkey_Funcs *_e_softkey_funcs = NULL; +static E_Service_Softkey_Pending_Request _e_softkey_pending_req; E_API Eina_Bool e_service_softkey_module_func_set(E_Service_Softkey_Funcs *fp) @@ -422,6 +435,98 @@ e_service_softkey_opacity_get(E_Service_Softkey *softkey, E_Policy_Softkey_Opaci } } +static Eina_Bool +_e_service_softkey_cb_hide_request_client_remove(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + E_Event_Client *ev; + E_Client *ec; + E_Service_Softkey_Pending_Visible_Request *vis_req; + Eina_List *l, *ll; + + ev = event; + if (!ev) return ECORE_CALLBACK_PASS_ON; + + ec = ev->ec; + if (!ec) return ECORE_CALLBACK_PASS_ON; + + EINA_LIST_FOREACH_SAFE(_e_softkey_pending_req.visible, l, ll, vis_req) + { + if (vis_req->ec == ec) + { + _e_softkey_pending_req.visible = eina_list_remove(_e_softkey_pending_req.visible, vis_req); + E_FREE(vis_req); + } + } + + return ECORE_CALLBACK_PASS_ON; +} + +EINTERN void +e_service_softkey_client_remove_handler_add(void) +{ + if (!_e_softkey_pending_req.ec_remove_handler) + _e_softkey_pending_req.ec_remove_handler = + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, + _e_service_softkey_cb_hide_request_client_remove, + NULL); +} + +EINTERN void +e_service_softkey_client_remove_handler_del(void) +{ + E_FREE_FUNC(_e_softkey_pending_req.ec_remove_handler, ecore_event_handler_del); +} + +EINTERN void +e_service_softkey_restore_visible_request(E_Service_Softkey *softkey_srv) +{ + E_Service_Softkey_Pending_Visible_Request *vis_req; + Eina_List *l, *ll; + Eina_Bool restored = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN(softkey_srv); + + EINA_LIST_REVERSE_FOREACH_SAFE(_e_softkey_pending_req.visible, l, ll, vis_req) + { + if (vis_req->ec->zone == softkey_srv->zone) + { + if (!restored) + { + ELOGF("SOFTKEY_SRV", "restore visible request (zone:%p, softkey:%p, vis:%d)", + vis_req->ec, softkey_srv->zone, softkey_srv, vis_req->visible); + e_service_softkey_visible_set(softkey_srv, vis_req->visible); + restored = EINA_TRUE; + } + _e_softkey_pending_req.visible = eina_list_remove(_e_softkey_pending_req.visible, vis_req); + E_FREE(vis_req); + } + } +} + +EINTERN void +e_service_softkey_store_visible_request(E_Client *ec, Eina_Bool visible) +{ + E_Service_Softkey_Pending_Visible_Request *vis_req; + Eina_List *l, *ll; + EINA_SAFETY_ON_NULL_RETURN(ec); + + EINA_LIST_FOREACH_SAFE(_e_softkey_pending_req.visible, l, ll, vis_req) + { + if (vis_req->ec == ec) + { + _e_softkey_pending_req.visible = eina_list_remove(_e_softkey_pending_req.visible, vis_req); + E_FREE(vis_req); + break; + } + } + + vis_req = E_NEW(E_Service_Softkey_Pending_Visible_Request, 1); + vis_req->ec = ec; + vis_req->visible = visible; + + _e_softkey_pending_req.visible = eina_list_append(_e_softkey_pending_req.visible, vis_req); +} + E_API E_Service_Softkey * e_service_softkey_get(E_Zone *zone) { diff --git a/src/bin/services/e_service_softkey.h b/src/bin/services/e_service_softkey.h index 1342e7ee8b..9010054f69 100644 --- a/src/bin/services/e_service_softkey.h +++ b/src/bin/services/e_service_softkey.h @@ -59,6 +59,11 @@ EINTERN Eina_Bool e_service_softkey_expand_get(E_Service_Softkey *softke EINTERN void e_service_softkey_opacity_set(E_Service_Softkey *softkey, E_Policy_Softkey_Opacity opacity); EINTERN Eina_Bool e_service_softkey_opacity_get(E_Service_Softkey *softkey, E_Policy_Softkey_Opacity *opacity); +EINTERN void e_service_softkey_client_remove_handler_add(void); +EINTERN void e_service_softkey_client_remove_handler_del(void); +EINTERN void e_service_softkey_restore_visible_request(E_Service_Softkey *softkey_srv); +EINTERN void e_service_softkey_store_visible_request(E_Client *ec, Eina_Bool visible); + E_API E_Service_Softkey *e_service_softkey_get(E_Zone *zone); #endif -- 2.34.1