e_info: add -use_cursor_timer option in winfo (enlightenment_info) 26/291526/1
authorduna.oh <duna.oh@samsung.com>
Tue, 18 Apr 2023 03:59:05 +0000 (12:59 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 18 Apr 2023 05:11:01 +0000 (14:11 +0900)
new option 'use_cursor_timer' to enable/disable cursor_timer
which hides cursor when no mouse events comes
ex) winfo -use_cursor_timer [1:on] [0:off]

Change-Id: I1d8b0ba28650885c333b64f0623f6416c4ef985a

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

index 8230628..e9c9bde 100644 (file)
@@ -5859,6 +5859,10 @@ _e_info_client_inputgen_usage(void)
    printf("  \t : set input_log_enable [off/0][on/1] (default: on)\n");
    printf("  example> enlightenment_info -input_log_enable 1\n");
    printf("\n");
+   printf("  enlightenment_info -use_cursor_timer [0/1]\n");
+   printf("  \t : set use_cursor_timer [off/0][on/1]\n");
+   printf("  example> enlightenment_info -use_cursor_timer 1\n");
+   printf("\n");
 }
 
 static void
@@ -6432,6 +6436,61 @@ _e_info_client_proc_input_log_enable(int argc, char **argv)
 }
 
 static void
+_e_info_client_cb_use_cursor_timer(const Eldbus_Message *msg)
+{
+   const char *errname = NULL, *errtext = NULL;
+   char *result = NULL;
+
+   EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
+
+   EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
+
+   if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
+     printf("Use_Cursor_Timer Failed: %s\n", result);
+   else
+     printf("Use_Cursor_Timer Success\n");
+
+   return;
+
+err:
+   if(errname || errtext)
+     printf("errname : %s, errmsg : %s\n", errname, errtext);
+   else
+     printf("Error occurred in _e_info_client_cb_input_log_enable\n");
+}
+
+void
+_e_info_client_proc_use_cursor_timer(int argc, char **argv)
+{
+   uint32_t onoff;
+
+   if (argc < 3)
+     {
+        _e_info_client_inputgen_usage();
+        return;
+     }
+
+   if (!isdigit(*argv[2]))
+     {
+        printf("Error Check Args: enlightenment_info -use_cursor_timer [1: on, 0: off]\n");
+        return;
+     }
+
+   onoff = atoi(argv[2]);
+
+   if (onoff == 0 || onoff == 1)
+     {
+        if (!_e_info_client_eldbus_message_with_args("use_cursor_timer", _e_info_client_cb_use_cursor_timer, "i", onoff))
+          {
+             printf("_e_info_client_eldbus_message_with_args error");
+             return;
+          }
+     }
+   else
+     printf("Error Check Args: enlightenment_info -use_cursor_timer [1: on, 0: off]\n");
+}
+
+static void
 _e_info_client_cb_filter(const Eldbus_Message *msg)
 {
    const char *name = NULL, *text = NULL;
@@ -7183,6 +7242,12 @@ ProcInfo procs_to_input[] =
       "Set input log enable/disable", /* Description */
       _e_info_client_proc_input_log_enable /* func */
    },
+   {
+      "use_cursor_timer",      /* Option */
+      NULL,/* Params */
+      "Set use_cursor_timer enable/disable", /* Description */
+      _e_info_client_proc_use_cursor_timer /* func */
+   },
 };
 
 static Eina_List *list_tracelogs = NULL;
index 3e3647b..6057bdc 100644 (file)
@@ -7266,6 +7266,28 @@ _e_info_server_cb_input_log_enable(const Eldbus_Service_Interface *iface EINA_UN
 }
 
 static Eldbus_Message *
+_e_info_server_cb_use_cursor_timer(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply;
+   char *result = NULL;
+   int state = 0;
+
+   if (!eldbus_message_arguments_get(msg, "i", &state))
+     {
+        return eldbus_message_error_new(msg, "Use_cursor_timerFailed",
+                                        "cursor_timer: an attempt to set use_cursor_timer from method call message failed");
+     }
+
+   e_comp_wl_input_cursor_timer_enable_set(state);
+   result = E_INFO_INPUT_RESULT_NONE;
+   reply = eldbus_message_method_return_new(msg);
+
+   eldbus_message_arguments_append(reply, "s", result);
+
+   return reply;
+}
+
+static Eldbus_Message *
 _e_info_server_cb_filter(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
 {
    Eldbus_Message *reply;
@@ -7812,6 +7834,7 @@ static const Eldbus_Method methods[] = {
    { "mousegen", ELDBUS_ARGS({"iiii", "mouse information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_mousegen, 0},
    { "mouse_accel", ELDBUS_ARGS({"i", "set mouse acceleration"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_mouse_accel, 0},
    { "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({"sis", "win_id, on(1)/off(0), filter name"}), ELDBUS_ARGS({"s", "result of request"}), _e_info_server_cb_filter, 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},