e_info: add new winfo process blur_option 42/325142/1
authorhojoon-ryou <hojoon.ryou@samsung.com>
Thu, 22 May 2025 12:26:23 +0000 (21:26 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 4 Jun 2025 03:47:47 +0000 (12:47 +0900)
Change-Id: I99ec19045ae6795c872c7a0fa93c56effa462a06

src/bin/debug/e_info_client.c
src/bin/debug/e_info_server.c
src/include/e_info_shared_types.h

index bc2d5d39f2dbebca287e1a2efec563abb81bd1bb..90924f4df8dc4f2dab282d1625fd772993730e91 100644 (file)
@@ -6605,6 +6605,67 @@ usage:
    printf("Usage: %s", USAGE_FILTER);
 }
 
+static void
+_e_info_client_cb_blur_option(const Eldbus_Message *msg)
+{
+   
+   const char *name = NULL, *text = NULL;
+   Eina_Bool res;
+   const char *reply;
+
+   res = eldbus_message_error_get(msg, &name, &text);
+   EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+   res = eldbus_message_arguments_get(msg, "s", &reply);
+   printf("%s\n", reply);
+
+finish:
+   if ((name) || (text))
+     {
+        printf("errname:%s errmsg:%s\n", name, text);
+     };
+}
+
+static void
+_e_info_client_proc_edit_blur_option(int argc, char **argv)
+{
+   int onoff = -1;
+   char msg_args[8][32] = {"", "", "", "", "", "", "", ""};
+   Eina_Bool res;
+   if (argc == 2)
+     {
+        // print current blur_manager config
+        res = _e_info_client_eldbus_message_with_args("blur_option",
+                                                      _e_info_client_cb_blur_option,
+                                                      "sissssssss",
+                                                      "", -1, "", "", "", "", "", "", "", "");
+        if (!res) printf("Error occured while sending message\n\n");
+     }
+   else if (argc > 3)
+     {
+        // filter target - argv[2]
+        // onoff - argv[3]
+        EINA_SAFETY_ON_FALSE_GOTO((!strncmp(argv[3], "on", 3)) ||
+                                  (!strncmp(argv[3], "off", 4)) ||
+                                  (!strncmp(argv[3], "1", 2)) ||
+                                  (!strncmp(argv[3], "0", 2)), usage);
+        if (!strncmp(argv[3], "on", 3) || !strncmp(argv[3], "1", 2)) onoff = 1;
+        else onoff = 0;
+        for (int idx = 4; idx < argc; ++idx)
+          strncpy(msg_args[idx-4], argv[idx], sizeof(msg_args[idx-4]));
+        res = _e_info_client_eldbus_message_with_args("blur_option",
+                                                      _e_info_client_cb_blur_option,
+                                                      "sissssssss",
+                                                      argv[2], onoff,
+                                                      msg_args[0], msg_args[1], msg_args[2], msg_args[3],
+                                                      msg_args[4], msg_args[5], msg_args[6], msg_args[7]);
+        if (!res) printf("Error occured while sending message\n\n");
+     }
+   return;
+usage:
+   printf("Usage: %s", USAGE_BLUR_OPTION);
+}
+
 static void
 _e_info_client_proc_mtrace(int argc, char **argv)
 {
@@ -7703,6 +7764,12 @@ static ProcInfo procs_to_execute[] =
       "apply filter option to windows",
       _e_info_client_proc_apply_filter
    },
+   {
+      "blur_option",
+      USAGE_BLUR_OPTION,
+      "edit blur configs",
+      _e_info_client_proc_edit_blur_option
+   },
    {
       "gcov",
       NULL,
index 0064cafa59972bf109e59df2f42fe87ebc02f2a7..84e5cb03d2570ba0cf991ede3b750184b768859f 100644 (file)
@@ -45,6 +45,7 @@
 #include "e_comp_canvas.h"
 #include "e_view_intern.h"
 #include "e_view_client_intern.h"
+#include "e_blur.h"
 #include "e_blur_intern.h"
 #include "e_blur_video_capture_intern.h"
 #include "e_compositor_intern.h"
@@ -7132,6 +7133,69 @@ reply:
    return reply;
 }
 
+static Eldbus_Message *
+_e_info_server_cb_blur_option(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply;
+   const char *config_target = NULL;
+   const char *param[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+   int onoff = -1;
+   char msg_to_client[125] = {0};
+   Eina_Bool res;
+   E_Blur_Dim_Config dim_config;
+
+   if (!eldbus_message_arguments_get(msg, "sissssssss", &config_target, &onoff,
+                                     &param[0], &param[1], &param[2], &param[3], &param[4], &param[5], &param[6], &param[7]))
+     {
+        return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
+                                        "blur_option: failed to get arguments from method call message\n");
+     }
+   reply = eldbus_message_method_return_new(msg);
+
+   if (onoff == -1)
+     {
+        e_blur_dim_config_get(&dim_config);
+        snprintf(msg_to_client, sizeof(msg_to_client), "Current setting:\n"
+                                                       "DIM - enabled:%d\n"
+                                                       "      color.r:%d\n"
+                                                       "      color.g:%d\n"
+                                                       "      color.b:%d\n"
+                                                       "      color.a:%d\n",
+                                                       dim_config.enabled,
+                                                       dim_config.color.r, dim_config.color.g, dim_config.color.b, dim_config.color.a);
+     }
+
+   if (!strncmp(config_target, "dim", 4))
+     {
+        e_blur_dim_config_get(&dim_config);
+        dim_config.enabled = onoff == 1 ? EINA_TRUE : EINA_FALSE;
+        for (int i=0; i<8; i+=2)
+          {
+             unsigned int val;
+             if (!param[i] || strlen(param[i]) == 0) break;
+             res = e_util_string_to_uint(param[i+1], &val, 10);
+             if (!res || val > 255)
+               {
+                  snprintf(msg_to_client, sizeof(msg_to_client), "Wrong value - %s is not uint\n", param[i+1]);
+                  goto reply;
+               }
+             if (!strncmp(param[i], "-R", 3)) dim_config.color.r = val;
+             if (!strncmp(param[i], "-G", 3)) dim_config.color.g = val;
+             if (!strncmp(param[i], "-B", 3)) dim_config.color.b = val;
+             if (!strncmp(param[i], "-A", 3)) dim_config.color.a = val;
+          }
+        e_blur_dim_config_set(&dim_config);
+     }
+   else
+     snprintf(msg_to_client, sizeof(msg_to_client),
+              "Config filter %s not supported!\n", config_target);
+
+reply:
+   eldbus_message_arguments_append(reply, "s", msg_to_client);
+
+   return reply;
+}
+
 static Eldbus_Message *
 _e_info_server_cb_mtrace(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
 {
@@ -7960,6 +8024,7 @@ static const Eldbus_Method methods[] = {
    { "input_log_enable", ELDBUS_ARGS({"i", "set input log enable"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_input_log_enable, 0},
    { "use_cursor_timer", ELDBUS_ARGS({"i", "set use_cursor_timer enable"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_use_cursor_timer, 0},
    { "filter", ELDBUS_ARGS({"sisss", "win_id, on(1)/off(0), filter name, param1, param2"}), ELDBUS_ARGS({"s", "result of request"}), _e_info_server_cb_filter, 0},
+   { "blur_option", ELDBUS_ARGS({"sissssssss", "config_target, on(1)/off(0), param1, param2, param3, param4, param5, param6, param7, param8"}), ELDBUS_ARGS({"s", "result of request"}), _e_info_server_cb_blur_option, 0},
    { "gcov", ELDBUS_ARGS({"i", "option"}), NULL, _e_info_server_cb_gcov, 0},
    { "basic_op_gen", ELDBUS_ARGS({"s","window id" }, {"s", "operation"}), NULL, _e_info_server_cb_basic_operation_generate, 0},
    { "process_info", NULL, ELDBUS_ARGS({"s", "process information"}), _e_info_server_cb_process_info, 0 },
index 0406e57c4b5ed66e51367bcd3e140944cc6bbeff..69dcf7292813a5ad7e160c936eb691c845e7479d 100644 (file)
@@ -262,6 +262,23 @@ typedef enum
    "\twinfo -filter 0xabcabcde blur on\n"                                      \
    "\twinfo -filter 0xbcaa11aa grayscale off\n"                                \
 
+/* -------------------------------------------------------------------------- */
+/* BLUR_OPTION                                                                   */
+/* -------------------------------------------------------------------------- */
+#define USAGE_BLUR_OPTION                                                     \
+   "-blur_option {dim} {on | off} {detail options...}\n"               \
+   "\tblur options: -radius {radius}\n"                                       \
+   "\tdim options: -R {red}\n"                                                \
+   "\tdim options: -G {green}\n"                                              \
+   "\tdim options: -B {blue}\n"                                               \
+   "\tdim options: -A {alpha}\n"                                              \
+   "Example:\n"                                                               \
+   "\twinfo -blur_option dim on -R 15\n"                                      \
+   "\twinfo -blur_option dim on -G 15\n"                                      \
+   "\twinfo -blur_option dim on -B 15\n"                                      \
+   "\twinfo -blur_option dim on -A 153\n"                                     \
+   "\twinfo -blur_option dim off\n"                                           \
+
 /* -------------------------------------------------------------------------- */
 /* DESK GROUP                                                                 */
 /* -------------------------------------------------------------------------- */