e_info: Add functionaility for add and delete aux hint of window 89/284289/1
authorJunseok Kim <juns.kim@samsung.com>
Thu, 10 Nov 2022 05:14:00 +0000 (14:14 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 15 Nov 2022 04:42:59 +0000 (13:42 +0900)
Added new functionality for add and delete aux hint of window

enlightenment_info -aux_hint add [win id] [hint id] [hint] [val]
 - Add or replace aux hint of the window that matched hint id.

enlightenment_info -aux_hint del [win id] [hint id]
 - Delete aux hint of the window that matched hint id.

Change-Id: I7c9ac4f9b2bbd7f36fc8a4e3843bda093fde1228

src/bin/e_info_client.c
src/bin/e_info_server.c
src/bin/e_policy_wl.c
src/bin/e_policy_wl.h

index 20057946e28e1886eb3dc50f33421ee204e7df01..38a4aa3a4d1a2fe5aa7ce0e46f189ef32fe8f5b0 100644 (file)
@@ -3872,6 +3872,77 @@ _e_info_client_proc_aux_message(int argc, char **argv)
    ecore_main_loop_begin();
 }
 
+static void
+_e_info_client_proc_aux_hint(int argc, char **argv)
+{
+   const char *cmd, *win, *id, *hint, *val;
+   Eldbus_Message *msg;
+   Eldbus_Message_Iter *itr;
+   Eldbus_Pending *p;
+   uint32_t hint_id;
+   Eina_Bool res;
+
+   if ((argc != 5) && (argc != 7))
+     {
+        goto usage;
+        return;
+     }
+
+   cmd = argv[2];
+   win = argv[3];
+   id = argv[4];
+
+   res = _util_string_to_uint(id, &hint_id, 10);
+   if (!res)
+     {
+        printf("\"aux_hint\" hint id isn't uint");
+        goto usage;
+        return;
+     }
+
+   if ((argc == 7) && !strncmp(cmd, "add", 3))
+     {
+        hint = argv[5];
+        val = argv[6];
+        msg = eldbus_proxy_method_call_new(e_info_client.proxy, "aux_hint_add");
+        itr = eldbus_message_iter_get(msg);
+        eldbus_message_iter_basic_append(itr, 's', win);
+        eldbus_message_iter_basic_append(itr, 'u', hint_id);
+        eldbus_message_iter_basic_append(itr, 's', hint);
+        eldbus_message_iter_basic_append(itr, 's', val);
+     }
+   else if(!strncmp(cmd, "del", 3))
+     {
+        msg = eldbus_proxy_method_call_new(e_info_client.proxy, "aux_hint_del");
+        itr = eldbus_message_iter_get(msg);
+        eldbus_message_iter_basic_append(itr, 's', win);
+        eldbus_message_iter_basic_append(itr, 'u', hint_id);
+     }
+   else
+     {
+        goto usage;
+        return;
+     }
+
+   p = eldbus_proxy_send(e_info_client.proxy, msg,
+                        _e_info_client_eldbus_message_cb,
+                         NULL, -1);
+   if (!p)
+     {
+        printf("\"aux_hint\" proxy_send error");
+        return;
+     }
+
+   ecore_main_loop_begin();
+   return;
+
+usage :
+   printf("Error Check Args: enlightenment_info -aux_hint add [window id] [hint id] [hint] [val]\n");
+   printf("                  enlightenment_info -aux_hint del [window id] [hint id]\n");
+   return;
+}
+
+
 static void
 _e_info_client_cb_scrsaver(const Eldbus_Message *msg)
 {
@@ -6838,6 +6909,12 @@ static ProcInfo procs_to_execute[] =
       "Send aux message to client",
       _e_info_client_proc_aux_message
    },
+   {
+      "aux_hint",
+      "[window] [hint id] [hint] [value]",
+      "Set aux hint to client",
+      _e_info_client_proc_aux_hint
+   },
    {
       "scrsaver",
       USAGE_SCRSAVER,
index 1adcd89c24d6b8600366bf8bd894424dd5989e00..e85dc494c84b4f39e8b8f7209a11e16b99ce6ccb 100644 (file)
@@ -5609,6 +5609,96 @@ e_info_server_cb_aux_message(const Eldbus_Service_Interface *iface EINA_UNUSED,
    return reply;
 }
 
+static Eldbus_Message *
+e_info_server_cb_aux_hint_add(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   const char *win_str, *hint, *val;
+   uint32_t hint_id;
+   unsigned long tmp = 0;
+   uint64_t win_id = 0;
+   E_Client *ec;
+   Evas_Object *o;
+   Eina_Bool res = EINA_FALSE;
+
+   if (!e_policy)
+     {
+        ERR("e_policy is not initialized!");
+        return reply;
+     }
+
+   if (!eldbus_message_arguments_get(msg, "suss", &win_str, &hint_id, &hint, &val))
+     {
+        ERR("Error getting arguments.");
+        return reply;
+     }
+
+   res = e_util_string_to_ulong(win_str, &tmp, 16);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
+
+   win_id = (uint64_t)tmp;
+
+   for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+     {
+        ec = evas_object_data_get(o, "E_Client");
+        if (!ec) continue;
+
+        if (e_client_util_win_get(ec) == win_id)
+          {
+             res = e_hints_aux_hint_add(ec, hint_id, hint, val);
+             if (res) e_policy_wl_aux_hint_apply(ec);
+             break;
+          }
+     }
+
+   return reply;
+}
+
+static Eldbus_Message *
+e_info_server_cb_aux_hint_del(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   const char *win_str;
+   uint32_t hint_id;
+   unsigned long tmp = 0;
+   uint64_t win_id = 0;
+   E_Client *ec;
+   Evas_Object *o;
+   Eina_Bool res = EINA_FALSE;
+
+   if (!e_policy)
+     {
+        ERR("e_policy is not initialized!");
+        return reply;
+     }
+
+   if (!eldbus_message_arguments_get(msg, "su", &win_str, &hint_id))
+     {
+        ERR("Error getting arguments.");
+        return reply;
+     }
+
+   res = e_util_string_to_ulong(win_str, &tmp, 16);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
+
+   win_id = (uint64_t)tmp;
+
+   for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+     {
+        ec = evas_object_data_get(o, "E_Client");
+        if (!ec) continue;
+
+        if (e_client_util_win_get(ec) == win_id)
+          {
+             res = e_hints_aux_hint_del(ec, hint_id);
+             if (res) e_policy_wl_aux_hint_apply(ec);
+             break;
+          }
+     }
+
+   return reply;
+}
+
 static Eldbus_Message *
 _e_info_server_cb_force_render(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
 {
@@ -7547,6 +7637,8 @@ static const Eldbus_Method methods[] = {
    { "get_keygrab_status", ELDBUS_ARGS({"s", "get_keygrab_status"}), NULL, _e_info_server_cb_keygrab_status_get, 0},
    { "get_module_info", ELDBUS_ARGS({"ss", "get_module_info"}), NULL, _e_info_server_cb_module_info_get, 0},
    { "aux_msg", ELDBUS_ARGS({"s","window id" }, {"s", "key"}, {"s", "value"}, {"as", "options"}), NULL, e_info_server_cb_aux_message, 0},
+   { "aux_hint_add", ELDBUS_ARGS({"s","window id" }, {"u", "hint id"}, {"s", "hint"}, {"s", "value"}), NULL, e_info_server_cb_aux_hint_add, 0},
+   { "aux_hint_del", ELDBUS_ARGS({"s","window id" }, {"u", "hint id"}), NULL, e_info_server_cb_aux_hint_del, 0},
    { "scrsaver", ELDBUS_ARGS({SIGNATURE_SCRSAVER_CLIENT, "scrsaver_params"}), ELDBUS_ARGS({SIGNATURE_SCRSAVER_SERVER, "scrsaver_result"}), _e_info_server_cb_scrsaver, 0},
    { "slot_message", ELDBUS_ARGS({"iiiiii", "slot_message"}), ELDBUS_ARGS({"a(ss)", "array of ec"}), e_info_server_cb_slot_message, 0},
    { "desktop_geometry_set", ELDBUS_ARGS({"iiii", "Geometry"}), NULL, _e_info_server_cb_desktop_geometry_set, 0},
index 5d5de3ca7296e241c40e79cf1c908bed7ec8f1f6..fc70df622e0689f3669d17422507cac76ccaec14 100644 (file)
@@ -7999,6 +7999,12 @@ e_policy_wl_generate_request(E_Client *ec, E_Policy_Wl_Gen_Request type)
      }
 }
 
+EINTERN void
+e_policy_wl_aux_hint_apply(E_Client *ec)
+{
+   _e_policy_wl_aux_hint_apply(ec);
+}
+
 // --------------------------------------------------------
 // public functions
 // --------------------------------------------------------
index c635bcfa5aff1af193d4ff990aec8fd10199aa49..3102712a11a44b44dc0af576ce19a2499249fd1e 100644 (file)
@@ -64,6 +64,7 @@ void      e_policy_wl_win_scrmode_apply(void);
 /* aux_hint */
 void      e_policy_wl_aux_hint_init(void);
 void      e_policy_wl_aux_message_send(E_Client *ec, const char *key, const char *val, Eina_List *options);
+EINTERN void e_policy_wl_aux_hint_apply(E_Client *ec);
 
 /* window brightness */
 Eina_Bool e_policy_wl_win_brightness_apply(E_Client *ec);