e_comp_wl_input: do not apply cursor timer logic if client has unset cursor 69/292869/1
authorduna.oh <duna.oh@samsung.com>
Thu, 11 May 2023 00:42:58 +0000 (09:42 +0900)
committerduna.oh <duna.oh@samsung.com>
Tue, 16 May 2023 05:52:18 +0000 (14:52 +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 921cbb08b45da853f22a8b4d09df2224421e638a..cd83a913291b62a9b83dfce6e316b4aa80e21776 100644 (file)
@@ -960,6 +960,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 e20dc480d080da3848b96c85f2bf430b46d74938..6c90caaf0ef7f8a290cccb883457f2ec0835ad52 100644 (file)
@@ -1144,7 +1144,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;
@@ -1200,7 +1200,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;
@@ -1386,7 +1386,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;
@@ -1398,7 +1398,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);
                }
           }
@@ -1460,7 +1460,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;
@@ -1535,7 +1535,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;
@@ -1544,7 +1544,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);
      }
 
@@ -1600,7 +1600,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;
@@ -1612,7 +1612,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);
      }
 }
@@ -5448,6 +5448,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);
@@ -5749,7 +5752,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;
@@ -5762,7 +5765,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 4ca678b5858459307da4b701975632c833408fcd..7c0f49c53ba52864dbcab4cf01e6a0de390cda5f 100644 (file)
@@ -149,8 +149,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 = wl_resource_get_user_data(surface_resource);
    if (!ec->re_manage)
      {