e_policy_wl/e_service_quickpanel: refactoring for scrollable state of quickpanel 81/262681/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 18 Aug 2021 00:29:50 +0000 (09:29 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 18 Aug 2021 00:55:12 +0000 (09:55 +0900)
1. Change code to use E_Quickpanel_Client_Scroll_State enumeration not integer.
   - E_QP_Client's scrollable value
   - e_qp_client_scrollable_state_set
   - e_qp_client_scrollable_state_get

2. Change code to use recommended function not deprecated function.
   - e_qp_client_scrollable_set -> e_qp_client_scrollable_state_set
   - e_qp_client_scrollable_get -> e_qp_client_scrollable_state_get

Change-Id: I822fe6ce40f7ffc58a9b432fa2d6437172425d56

src/bin/e_policy_wl.c
src/bin/services/e_service_quickpanel.c
src/bin/services/e_service_quickpanel.h

index 98c41a1..583eadf 100644 (file)
@@ -4859,7 +4859,7 @@ _tzsh_qp_iface_cb_enable(struct wl_client *client EINA_UNUSED, struct wl_resourc
    if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
      return;
 
-   e_qp_client_scrollable_set(ec, tzsh_client->qp_type, EINA_TRUE);
+   e_qp_client_scrollable_state_set(ec, tzsh_client->qp_type, E_QUICKPANEL_CLIENT_SCROLL_STATE_SET);
 }
 
 static void
@@ -4883,7 +4883,7 @@ _tzsh_qp_iface_cb_disable(struct wl_client *client EINA_UNUSED, struct wl_resour
    if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
      return;
 
-   e_qp_client_scrollable_set(ec, tzsh_client->qp_type, EINA_FALSE);
+   e_qp_client_scrollable_state_set(ec, tzsh_client->qp_type, E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET);
 }
 
 static void
@@ -4891,7 +4891,8 @@ _tzsh_qp_iface_cb_state_get(struct wl_client *client EINA_UNUSED, struct wl_reso
 {
    E_Policy_Wl_Tzsh_Client *tzsh_client;
    E_Client *ec;
-   Eina_Bool vis, scrollable;
+   Eina_Bool vis;
+   E_Quickpanel_Client_Scroll_State scrollable;
    int ridx;
    int val = TWS_QUICKPANEL_STATE_VALUE_UNKNOWN;
 
@@ -4916,9 +4917,15 @@ _tzsh_qp_iface_cb_state_get(struct wl_client *client EINA_UNUSED, struct wl_reso
         if (vis) val = TWS_QUICKPANEL_STATE_VALUE_VISIBLE_SHOW;
         break;
       case TWS_QUICKPANEL_STATE_TYPE_SCROLLABLE:
-        val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_UNSET;
-        scrollable = e_qp_client_scrollable_get(ec, tzsh_client->qp_type);
-        if (scrollable) val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET;
+        scrollable = e_qp_client_scrollable_state_get(ec, tzsh_client->qp_type);
+        if (scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_UNSET)
+          val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_UNSET;
+        else if (scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_SET)
+          val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET;
+        else if (scrollable == E_QUICKPANEL_CLIENT_SCROLL_STATE_RETAIN)
+          val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_RETAIN;
+        else
+          val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET;
         break;
       case TWS_QUICKPANEL_STATE_TYPE_ORIENTATION:
         ridx = e_qp_orientation_get(ec, tzsh_client->qp_type);
index 702d2bd..d6ee695 100644 (file)
@@ -155,7 +155,7 @@ struct _E_QP_Client
    struct
    {
       Eina_Bool vis;
-      int scrollable;
+      E_Quickpanel_Client_Scroll_State scrollable;
    } hint;
 };
 
@@ -169,8 +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_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, int state);
-static int           _e_qp_client_scrollable_state_get(E_Client *ec, E_Quickpanel_Type type);
+static Eina_Bool     _e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, E_Quickpanel_Client_Scroll_State state);
+static E_Quickpanel_Client_Scroll_State _e_qp_client_scrollable_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);
@@ -2536,7 +2536,7 @@ e_qp_client_add(E_Client *ec, E_Quickpanel_Type type)
    qp_client->ec = ec;
    qp_client->ref = 1;
    qp_client->hint.vis = EINA_TRUE;
-   qp_client->hint.scrollable = EINA_TRUE;
+   qp_client->hint.scrollable = E_QUICKPANEL_CLIENT_SCROLL_STATE_SET;
    qp_client->type = type;
 
    qp_clients = eina_list_append(qp_clients, qp_client);
@@ -2643,7 +2643,7 @@ e_qp_client_scrollable_get(E_Client *ec, E_Quickpanel_Type type)
 }
 
 static Eina_Bool
-_e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, int state)
+_e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, E_Quickpanel_Client_Scroll_State state)
 {
    E_Policy_Quickpanel *qp;
    E_QP_Client *qp_client;
@@ -2664,7 +2664,7 @@ _e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, int stat
    return EINA_TRUE;
 }
 
-static int
+static E_Quickpanel_Client_Scroll_State
 _e_qp_client_scrollable_state_get(E_Client *ec, E_Quickpanel_Type type)
 {
    E_QP_Client *qp_client;
@@ -2676,7 +2676,7 @@ _e_qp_client_scrollable_state_get(E_Client *ec, E_Quickpanel_Type type)
 }
 
 EINTERN Eina_Bool
-e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, int state)
+e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, E_Quickpanel_Client_Scroll_State state)
 {
    ELOGF("QUICKPANEL", "Request to Set scrollable state of Quickpanel(type:%d) to %d", ec, type, state);
    BACKEND_FUNC_CALL_RET(qp_client_scrollable_state_set, ec, type, state);
@@ -2684,7 +2684,7 @@ e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, int state
    return _e_qp_client_scrollable_state_set(ec, type, state);
 }
 
-EINTERN int
+EINTERN E_Quickpanel_Client_Scroll_State
 e_qp_client_scrollable_state_get(E_Client *ec, E_Quickpanel_Type type)
 {
    E_QP_Client *qp_client;
index 870e3f5..02b9143 100644 (file)
@@ -41,8 +41,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_scrollable_state_set)(E_Client *ec, E_Quickpanel_Type type, int state);
-   int       (*qp_client_scrollable_state_get)(E_Client *ec, E_Quickpanel_Type type);
+   Eina_Bool (*qp_client_scrollable_state_set)(E_Client *ec, E_Quickpanel_Type type, E_Quickpanel_Client_Scroll_State state);
+   E_Quickpanel_Client_Scroll_State (*qp_client_scrollable_state_get)(E_Client *ec, E_Quickpanel_Type type);
 };
 
 E_API Eina_Bool   e_service_quickpanel_module_func_set(E_QP_Mgr_Funcs *fp);
@@ -69,7 +69,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_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, int state);
-EINTERN int       e_qp_client_scrollable_state_get(E_Client *ec, E_Quickpanel_Type type);
+EINTERN Eina_Bool e_qp_client_scrollable_state_set(E_Client *ec, E_Quickpanel_Type type, E_Quickpanel_Client_Scroll_State state);
+EINTERN E_Quickpanel_Client_Scroll_State e_qp_client_scrollable_state_get(E_Client *ec, E_Quickpanel_Type type);
 
 #endif