From: Doyoun Kang Date: Thu, 16 Jan 2020 02:00:48 +0000 (+0900) Subject: quickpanel: add code for quickpanel's scroll_state_set request X-Git-Tag: submit/tizen/20200116.044653^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04e9d382f118ada68c52b27faf40f1ba2e05bf7d;p=platform%2Fupstream%2Fenlightenment.git quickpanel: add code for quickpanel's scroll_state_set request New tzsh_quickpanel's request (scroll_state_set) and state (SCROLLABLE_FOLLOW) are added. We add code to handle these changes. Change-Id: Id83fc3736a6bacbd8aad7da4dfc50241bb077b9a --- diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 0470e80af0..112983d8ac 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -4884,6 +4884,35 @@ _tzsh_qp_iface_cb_type_set(struct wl_client *client EINA_UNUSED, struct wl_resou e_qp_client_add(ec, type); } +static void +_tzsh_qp_iface_cb_scroll_state_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp, int32_t state) +{ + E_Policy_Wl_Tzsh_Client *tzsh_client; + E_Client *ec; + + ELOGF("TZ_QUICKPANEL", "Request to Set scroll state to %d", NULL, state); + + tzsh_client = wl_resource_get_user_data(res_tzsh_qp); + EINA_SAFETY_ON_NULL_RETURN(tzsh_client); + EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh); + EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh->ec); + + /* unexpected case: this client doesn't have specific quickpanel type */ + EINA_SAFETY_ON_TRUE_RETURN(tzsh_client->qp_type == E_QUICKPANEL_TYPE_UNKNOWN); + + ec = tzsh_client->tzsh->ec; + if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client)) + return; + + if (state == TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_UNSET) + e_qp_client_scroll_state_set(ec, tzsh_client->qp_type, E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET); + else if (state == TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET) + e_qp_client_scroll_state_set(ec, tzsh_client->qp_type, E_QUICKPANEL_CLIENT_SCROLL_STATE_SET); + else if (state == TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_FOLLOW) + e_qp_client_scroll_state_set(ec, tzsh_client->qp_type, E_QUICKPANEL_CLIENT_SCROLL_STATE_FOLLOW); + +} + static const struct tws_quickpanel_interface _tzsh_qp_iface = { _tzsh_qp_iface_cb_release, @@ -4892,7 +4921,8 @@ static const struct tws_quickpanel_interface _tzsh_qp_iface = _tzsh_qp_iface_cb_enable, _tzsh_qp_iface_cb_disable, _tzsh_qp_iface_cb_state_get, - _tzsh_qp_iface_cb_type_set + _tzsh_qp_iface_cb_type_set, + _tzsh_qp_iface_cb_scroll_state_set }; static void diff --git a/src/bin/services/e_service_quickpanel.c b/src/bin/services/e_service_quickpanel.c index 9d3b13279a..f4917cabb4 100644 --- a/src/bin/services/e_service_quickpanel.c +++ b/src/bin/services/e_service_quickpanel.c @@ -155,7 +155,7 @@ struct _E_QP_Client struct { Eina_Bool vis; - Eina_Bool scrollable; + int scrollable; } hint; }; @@ -169,6 +169,8 @@ Eina_List *qp_clients = NULL; /* list of E_QP_Client */ static void _e_qp_srv_effect_update(E_Policy_Quickpanel *qp, int x, int y); static E_QP_Client * _e_qp_client_ec_get(E_Client *ec, E_Quickpanel_Type type); static Eina_Bool _e_qp_client_scrollable_update(E_Policy_Quickpanel *qp); +static Eina_Bool _e_qp_client_scroll_state_set(E_Client *ec, E_Quickpanel_Type type, int state); +static int _e_qp_client_scroll_state_get(E_Client *ec, E_Quickpanel_Type type); static void _quickpanel_client_evas_cb_show(void *data, Evas *evas, Evas_Object *obj, void *event); static void _quickpanel_client_evas_cb_hide(void *data, Evas *evas, Evas_Object *obj, void *event); @@ -975,6 +977,45 @@ _e_qp_srv_effect_disable_ref(E_Policy_Quickpanel *qp) _e_qp_srv_effect_stop(qp); } +static Eina_Bool +_e_qp_check_scrollable(E_Policy_Quickpanel *qp) +{ + E_Client *ec = NULL; + E_QP_Client *qp_client = NULL; + Eina_Bool scrollable = EINA_TRUE; + int x, y, w, h; + int zx = 0, zy = 0, zw = 0, zh = 0; + + if (!qp) return EINA_FALSE; + if (!qp->ec) return EINA_FALSE; + + e_zone_useful_geometry_get(qp->ec->zone, &zx, &zy, &zw, &zh); + + for (ec = e_client_below_get(qp->ec); ec; ec = e_client_below_get(ec)) + { + if (!ec->visible) continue; + if (_quickpanel_check_skip_client(ec)) continue; + e_client_geometry_get(ec, &x, &y, &w, &h); + if (!E_INTERSECTS(x, y, w, h, zx, zy, zw, zh)) continue; + + qp_client = _e_qp_client_ec_get(ec, (E_Quickpanel_Type)qp->type); + if (!qp_client) continue; + if (qp_client->hint.scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_FOLLOW) + continue; + + if (qp_client->hint.scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_SET) + scrollable = EINA_TRUE; + else + { + ELOGF("QUICKPANEL", "Scroll locked by owner client (ec:%p, win:%x)", qp->below, ec, e_client_util_win_get(ec)); + scrollable = EINA_FALSE; + } + break; + } + + return scrollable; +} + static void _region_obj_cb_gesture_start(void *data, Evas_Object *handler, int nfingers, int x, int y, unsigned int timestamp) { @@ -986,6 +1027,7 @@ _region_obj_cb_gesture_start(void *data, Evas_Object *handler, int nfingers, int int indi_x, indi_y, indi_w, indi_h; const int sensitivity = 50; Eina_Bool res; + Eina_Bool scrollable = EINA_TRUE; ELOGF("QUICKPANEL", "Start gesture for quickpanel", NULL); @@ -1068,10 +1110,19 @@ _region_obj_cb_gesture_start(void *data, Evas_Object *handler, int nfingers, int * to show and scroll the quickpanel window. */ qp_client = _e_qp_client_ec_get(qp->below, (E_Quickpanel_Type)qp->type); - if ((qp_client) && (!qp_client->hint.scrollable)) + if (qp_client) { - ELOGF("QUICKPANEL", "Scroll locked by current client", qp->below); - return; + if (qp_client->hint.scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET) + { + ELOGF("QUICKPANEL", "Scroll locked by current client", qp->below); + return; + } + else if (qp_client->hint.scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_FOLLOW) + { + ELOGF("QUICKPANEL", "Scroll follow by previous client", qp->below); + scrollable = _e_qp_check_scrollable(qp); + if (!scrollable) return; + } } res = _e_qp_srv_is_effect_running(qp); @@ -2386,17 +2437,52 @@ e_qp_client_hide(E_Client *ec, E_Quickpanel_Type type) EINTERN Eina_Bool e_qp_client_scrollable_set(E_Client *ec, E_Quickpanel_Type type, Eina_Bool set) { - E_Policy_Quickpanel *qp; - E_QP_Client *qp_client; + /* + USE e_qp_client_scroll_state_set() function instead of this function. + This will be DEPRECATED. + */ + Eina_Bool ret; ELOGF("QUICKPANEL", "Request to Set scrollable state of Quickpanel (type:%d) to %d", ec, type, set); BACKEND_FUNC_CALL_RET(qp_client_scrollable_set, ec, type, set); + if (set) + ret = _e_qp_client_scroll_state_set(ec, type, E_QUICKPANEL_CLIENT_SCROLL_STATE_SET); + else + ret = _e_qp_client_scroll_state_set(ec, type, E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET); + + return ret; +} + +EINTERN Eina_Bool +e_qp_client_scrollable_get(E_Client *ec, E_Quickpanel_Type type) +{ + /* + USE e_qp_client_scroll_state_get() function instead of this function. + This will be DEPRECATED. + */ + int scroll_state; + + BACKEND_FUNC_CALL_RET(qp_client_scrollable_get, ec, type); + + scroll_state = _e_qp_client_scroll_state_get(ec, type); + if (scroll_state == E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET) + return EINA_FALSE; + else + return EINA_TRUE; +} + +static Eina_Bool +_e_qp_client_scroll_state_set(E_Client *ec, E_Quickpanel_Type type, int state) +{ + E_Policy_Quickpanel *qp; + E_QP_Client *qp_client; + qp_client = _e_qp_client_ec_get(ec, type); EINA_SAFETY_ON_NULL_RETURN_VAL(qp_client, EINA_FALSE); - if (qp_client->hint.scrollable != set) - qp_client->hint.scrollable = set; + if (qp_client->hint.scrollable != state) + qp_client->hint.scrollable = state; qp = _quickpanel_get_with_client_type(qp_client); EINA_SAFETY_ON_NULL_RETURN_VAL(qp, EINA_FALSE); @@ -2408,12 +2494,32 @@ e_qp_client_scrollable_set(E_Client *ec, E_Quickpanel_Type type, Eina_Bool set) return EINA_TRUE; } +static int +_e_qp_client_scroll_state_get(E_Client *ec, E_Quickpanel_Type type) +{ + E_QP_Client *qp_client; + + qp_client = _e_qp_client_ec_get(ec, type); + EINA_SAFETY_ON_NULL_RETURN_VAL(qp_client, E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET); + + return qp_client->hint.scrollable; +} + EINTERN Eina_Bool -e_qp_client_scrollable_get(E_Client *ec, E_Quickpanel_Type type) +e_qp_client_scroll_state_set(E_Client *ec, E_Quickpanel_Type type, int state) +{ + ELOGF("QUICKPANEL", "Request to Set scroll state of Quickpanel(type:%d) to %d", ec, type, state); + BACKEND_FUNC_CALL_RET(qp_client_scroll_state_set, ec, type, state); + + return _e_qp_client_scroll_state_set(ec, type, state); +} + +EINTERN int +e_qp_client_scroll_state_get(E_Client *ec, E_Quickpanel_Type type) { E_QP_Client *qp_client; - BACKEND_FUNC_CALL_RET(qp_client_scrollable_get, ec, type); + BACKEND_FUNC_CALL_RET(qp_client_scroll_state_get, ec, type); qp_client = _e_qp_client_ec_get(ec, type); EINA_SAFETY_ON_NULL_RETURN_VAL(qp_client, EINA_FALSE); @@ -2447,7 +2553,8 @@ e_service_quickpanel_module_func_set(E_QP_Mgr_Funcs *fp) qp_mgr_funcs->qp_client_hide = fp->qp_client_hide; qp_mgr_funcs->qp_client_scrollable_set = fp->qp_client_scrollable_set; qp_mgr_funcs->qp_client_scrollable_get = fp->qp_client_scrollable_get; - + qp_mgr_funcs->qp_client_scroll_state_set = fp->qp_client_scroll_state_set; + qp_mgr_funcs->qp_client_scroll_state_get = fp->qp_client_scroll_state_get; return EINA_TRUE; } diff --git a/src/bin/services/e_service_quickpanel.h b/src/bin/services/e_service_quickpanel.h index 1e2694c779..858c58a510 100644 --- a/src/bin/services/e_service_quickpanel.h +++ b/src/bin/services/e_service_quickpanel.h @@ -13,6 +13,13 @@ typedef enum E_SERVICE_QUICKPANEL_EFFECT_TYPE_APP_CUSTOM = TZSH_QUICKPANEL_SERVICE_EFFECT_TYPE_APP_CUSTOM, } E_Service_Quickpanel_Effect_Type; +typedef enum +{ + E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET = 0, /* TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_UNSET */ + E_QUICKPANEL_CLIENT_SCROLL_STATE_SET = 1, /* TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET */ + E_QUICKPANEL_CLIENT_SCROLL_STATE_FOLLOW = 2, /* TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_FOLLOW */ +} E_Quickpanel_Client_Scroll_State; + struct _E_QP_Mgr_Funcs { void (*quickpanel_client_add)(E_Client *ec, E_Service_Quickpanel_Type type); @@ -33,6 +40,8 @@ struct _E_QP_Mgr_Funcs void (*qp_client_hide)(E_Client *ec, E_Quickpanel_Type type); Eina_Bool (*qp_client_scrollable_set)(E_Client *ec, E_Quickpanel_Type type, Eina_Bool set); Eina_Bool (*qp_client_scrollable_get)(E_Client *ec, E_Quickpanel_Type type); + Eina_Bool (*qp_client_scroll_state_set)(E_Client *ec, E_Quickpanel_Type type, int state); + int (*qp_client_scroll_state_get)(E_Client *ec, E_Quickpanel_Type type); }; E_API Eina_Bool e_service_quickpanel_module_func_set(E_QP_Mgr_Funcs *fp); @@ -58,5 +67,7 @@ EINTERN void e_qp_client_show(E_Client *ec, E_Quickpanel_Type type); EINTERN void e_qp_client_hide(E_Client *ec, E_Quickpanel_Type type); EINTERN Eina_Bool e_qp_client_scrollable_set(E_Client *ec, E_Quickpanel_Type type, Eina_Bool set); EINTERN Eina_Bool e_qp_client_scrollable_get(E_Client *ec, E_Quickpanel_Type type); +EINTERN Eina_Bool e_qp_client_scroll_state_set(E_Client *ec, E_Quickpanel_Type type, int state); +EINTERN int e_qp_client_scroll_state_get(E_Client *ec, E_Quickpanel_Type type); #endif