e_info: add zone focused client get
authorJunseok Kim <juns.kim@samsung.com>
Mon, 30 Dec 2024 02:23:50 +0000 (11:23 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 2 Jan 2025 06:51:57 +0000 (15:51 +0900)
Change-Id: I365f1eb1b63c97512e5164c544248ff6c417008c

src/bin/debug/e_info_client.c
src/bin/debug/e_info_server.c

index 1814c3f9f4b570da196a5ab6b1b966b0ebdf3706..cc4441ea5a4d90be91d1e4672cbbb5f85c6e795e 100644 (file)
@@ -6850,6 +6850,47 @@ finish:
    return;
 }
 
+static void
+_e_info_client_cb_zone_focused_ec_get(const Eldbus_Message *msg)
+{
+   const char *errname = NULL, *errtext = NULL;
+   int zone_id;
+   uint32_t res_id;
+   char *client_title = NULL;
+
+   EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
+   EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "ius", &zone_id, &res_id, &client_title), err);
+
+   printf("Zone[%d] focused client(0x%08d): %s\n", zone_id, res_id, client_title);
+
+   return;
+
+err:
+   if(errname || errtext)
+     printf("errname : %s, errmsg : %s\n", errname, errtext);
+   else
+     printf("Error occurred in %s\n", __func__);
+}
+
+static void
+_e_info_client_proc_zone_focused_ec_get(int argc, char **argv)
+{
+   Eina_Bool res;
+
+   if (argc != 3)
+     goto err;
+
+   res = _e_info_client_eldbus_message_with_args("zone_focus_get", _e_info_client_cb_zone_focused_ec_get,
+                                                 "i", atoi(argv[2]));
+   EINA_SAFETY_ON_FALSE_RETURN(res);
+
+   return;
+
+err:
+   printf("zone_focus_get: error: invalid argument\n\n");
+   printf("%s %s [Zone ID]\n", argv[0], argv[1]);
+}
+
 typedef struct _ProcInfo
 {
    const char *option;
@@ -7259,6 +7300,12 @@ static ProcInfo procs_to_execute[] =
       "The command for video shell",
       _e_info_client_proc_video_shell,
    },
+   {
+      "zone_focus_get",
+      "[zone ID]",
+      "To get focused client on specified zone",
+      _e_info_client_proc_zone_focused_ec_get,
+   },
 };
 
 ProcInfo procs_to_input[] =
index b6b66b22bd5bcd6c69ee62157cc787fc9402a2fe..583d430fc80383e80030cdfbaf2ab707d24e9be2 100644 (file)
@@ -7479,6 +7479,49 @@ _e_info_server_cb_pointer_thread_mode(const Eldbus_Service_Interface *iface EINA
    return reply;
 }
 
+static Eldbus_Message *
+_e_info_server_cb_zone_focus_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   E_Zone *zone;
+   E_Client *ec;
+   uint32_t win_id = 0;
+   int zone_id = 0;
+   const char *title = NULL;
+
+   if (!eldbus_message_arguments_get(msg, "i", &zone_id))
+     {
+        ELOGF("E_INFO", "failed to get argument", NULL);
+        return reply;
+     }
+
+   zone = e_zone_get_by_id(zone_id);
+   if (!zone)
+     {
+        ELOGF("E_INFO", "failed to get zone from zone_id:%d", NULL, zone_id);
+        title = "Failed to get zone";
+        goto finish;
+     }
+
+   ec = e_zone_focused_client_get(zone);
+   if (!ec)
+     {
+        ELOGF("E_INFO", "failed to get focused ec from zone:%p, zone_id:%d", NULL, zone, zone_id);
+        title = "No focused ec";
+        goto finish;
+     }
+
+   ELOGF("E_INFO", "zone(ID:%d):%p, focused ec(%p):%s", ec, zone_id, zone, ec, e_client_icccm_title_get(ec));
+
+   win_id = e_client_util_win_get(ec);
+   title = e_client_icccm_title_get(ec);
+
+finish:
+   eldbus_message_arguments_append(reply, "ius", zone_id, win_id, title);
+
+   return reply;
+}
+
 //{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG },
 static const Eldbus_Method methods[] = {
    { "get_window_info", NULL, ELDBUS_ARGS({"iiisiiia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
@@ -7583,6 +7626,7 @@ static const Eldbus_Method methods[] = {
    { VIDEO_SHELL_TRANSFORM_METHOD_NAME, ELDBUS_ARGS({"siiiiiii", "Transform video viewport"}), NULL, _e_info_server_cb_video_shell_transform, 0},
    { "input_elapsed_time", ELDBUS_ARGS({"si", "input elapsed time"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_input_elapsed_time, 0},
    { "pointer_thread_mode", ELDBUS_ARGS({"i", "set pointer_thread_mode"}), NULL, _e_info_server_cb_pointer_thread_mode, 0 },
+   { "zone_focus_get", ELDBUS_ARGS({"i", "Zone ID"}), ELDBUS_ARGS({"ius", "focused ec info"}), _e_info_server_cb_zone_focus_get, 0 },
    { NULL, NULL, NULL, NULL, 0 }
 };