e_comp_wl_input: do not apply cursor timer logic if client has unset cursor 61/292861/1
authorduna.oh <duna.oh@samsung.com>
Thu, 11 May 2023 00:42:58 +0000 (09:42 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 16 May 2023 04:39:40 +0000 (13:39 +0900)
add has_cursor_unset member variable in E_Client struct.
If ec->has_cursor_unset is TRUE, do not apply cursor timer logic which is
to hide cursor when mouse event doesn't come (idle for such sec.) and to show
cursor when mouse event starts to come.

Change-Id: I2442ac345832b2795bf211db3c6a18f35df76595

src/bin/e_client.h
src/bin/e_comp_wl.c
src/bin/e_comp_wl_input.c

index b3f3704..7b48b01 100644 (file)
@@ -958,6 +958,7 @@ struct E_Client
 
    Ecore_Timer *map_timer;
    Eina_Bool pointer_enter_sent;
+   Eina_Bool has_cursor_unset : 1; // The client has set cursor null to hide cursor image
 
    Eina_Bool launching : 1;
    Eina_Bool extra_animating : 1;
index 065b4bd..c132c7e 100644 (file)
@@ -1123,7 +1123,7 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
         return;
      }
 
-   if (e_config->use_cursor_timer)
+   if (!ec->has_cursor_unset && e_config->use_cursor_timer)
      {
         if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_IN, ec))
           return;
@@ -1177,7 +1177,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
         return;
      }
 
-   if (e_config->use_cursor_timer)
+   if (!ec->has_cursor_unset && e_config->use_cursor_timer)
      {
         if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_OUT, ec))
           return;
@@ -1362,7 +1362,7 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
           }
         else
           {
-             if (e_config->use_cursor_timer)
+             if (!ec->has_cursor_unset && e_config->use_cursor_timer)
                {
                  if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_MOVE, ec))
                    return;
@@ -1374,7 +1374,7 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
              e_pointer_mouse_move(e_comp->pointer, ev->cur.output.x, ev->cur.output.y);
              if (!need_send_released) // set cursor's hide_tmr only when mouse button is not pressed
                {
-                  if (e_config->use_cursor_timer)
+                  if (!ec->has_cursor_unset && e_config->use_cursor_timer)
                     _e_comp_wl_cursor_move_timer_control(ec);
                }
           }
@@ -1436,7 +1436,7 @@ _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
      }
    else
      {
-        if (e_config->use_cursor_timer)
+        if (!ec->has_cursor_unset && e_config->use_cursor_timer)
           {
              if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_DOWN, ec))
                return;
@@ -1511,7 +1511,7 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *even
      }
    else
      {
-        if (e_config->use_cursor_timer)
+        if (!ec->has_cursor_unset && e_config->use_cursor_timer)
           {
              if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_UP, ec))
                return;
@@ -1520,7 +1520,7 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *even
         e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
                                            WL_POINTER_BUTTON_STATE_RELEASED);
 
-        if (e_config->use_cursor_timer)
+        if (!ec->has_cursor_unset && e_config->use_cursor_timer)
           _e_comp_wl_cursor_move_timer_control(ec);
      }
 
@@ -1576,7 +1576,7 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *
    if (!eina_list_count(e_comp_wl->ptr.resources))
      return;
 
-   if (e_config->use_cursor_timer)
+   if (!ec->has_cursor_unset && e_config->use_cursor_timer)
       {
          if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, ec))
            return;
@@ -1588,7 +1588,7 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *
 
    if (!need_send_released) // set cursor's hide_tmr only when mouse button is not pressed
      {
-        if (e_config->use_cursor_timer)
+        if (!ec->has_cursor_unset && e_config->use_cursor_timer)
           _e_comp_wl_cursor_move_timer_control(ec);
      }
 }
@@ -5352,6 +5352,9 @@ e_comp_wl_input_cursor_timer_enable_set(Eina_Bool enabled)
           }
         cursor_timer_ec = NULL;
 
+        if (e_comp_wl->ptr.ec->has_cursor_unset)
+          return;
+
         if (e_pointer_is_hidden(e_comp->pointer))
           {
              _e_comp_wl_cursor_reload(e_comp_wl->ptr.ec);
@@ -5619,7 +5622,7 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev
    if (!time) time = e_util_timestamp_get();
    serial = wl_display_next_serial(e_comp_wl->wl.disp);
 
-   if (e_config->use_cursor_timer)
+   if (!ec->has_cursor_unset && e_config->use_cursor_timer)
       {
          if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, ec))
            return EINA_TRUE;
@@ -5632,7 +5635,7 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev
 
    if (!need_send_released) // set cursor's hide_tmr only when mouse button is not pressed
      {
-        if (e_config->use_cursor_timer)
+        if (!ec->has_cursor_unset && e_config->use_cursor_timer)
           _e_comp_wl_cursor_move_timer_control(ec);
      }
 
index 0efa019..f7b889c 100644 (file)
@@ -103,8 +103,12 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
    if (!surface_resource)
      {
         e_pointer_object_set(e_comp->pointer, NULL, x, y);
+        ec->has_cursor_unset = EINA_TRUE;
         return;
      }
+
+   ec->has_cursor_unset = EINA_FALSE;
+
    ec = e_client_from_surface_resource(surface_resource);
    if (!ec->re_manage)
      {