ecore_wl2_input: support client that requests to unset cursor 57/290657/4
authorduna.oh <duna.oh@samsung.com>
Thu, 30 Mar 2023 07:55:28 +0000 (16:55 +0900)
committerDuna Oh <duna.oh@samsung.com>
Mon, 15 May 2023 23:59:39 +0000 (23:59 +0000)
fix to support clients to hide its cursor by calling
ecore_wl2_window/input_pointer_set(,surface=null,,)

@tizen_only

Change-Id: I42dab9d565dba04e5bb98ca80fcf084272de145d

src/lib/ecore_wl2/ecore_wl2_input.c
src/lib/ecore_wl2/ecore_wl2_window.c

index 265ec67..0a701b5 100644 (file)
@@ -1062,7 +1062,7 @@ _pointer_cb_enter(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned i
    input->pointer.sy = wl_fixed_to_double(sy);
 
    // Cursor change from configuration is applied only for default cursor
-   if (!input->cursor.theme_name || eina_streq(input->cursor.theme_name, "default"))
+   if (eina_streq(input->cursor.theme_name, "default"))
      {
         _ecore_wl2_cursor_config_reload();
         config_cursor_name = _ecore_wl2_cursor_config_name_get();
@@ -1074,8 +1074,13 @@ _pointer_cb_enter(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned i
      }
 
    // TIZEN_ONLY(20171207): add functions to set client's custom cursors
+   // TIZEN_ONLY(20230330): support client that requests to unset cursor
    /* The cursor on the surface is undefined until we set it */
-   ecore_wl2_input_cursor_from_name_set(input, input->cursor.name);
+   if (!input->cursor.name)
+     ecore_wl2_input_pointer_set(input, NULL, 0, 0);
+   else
+     ecore_wl2_input_cursor_from_name_set(input, input->cursor.name);
+   //
    //
 
    /* find the window which this surface belongs to */
@@ -2112,6 +2117,11 @@ _ecore_wl2_input_cursor_setup(Ecore_Wl2_Input *input)
 
    cursor_theme_name = getenv("ECORE_WL_CURSOR_THEME_NAME");
    ecore_wl2_input_cursor_theme_name_set(input, cursor_theme_name);
+
+   // TIZEN_ONLY(20230330): support client that requests to unset cursor
+   if (!input->cursor.name)
+     input->cursor.name = eina_stringshare_add("left_ptr");
+   //
    #endif
    //
 }
@@ -3785,6 +3795,16 @@ ecore_wl2_input_pointer_set(Ecore_Wl2_Input *input, struct wl_surface *surface,
                            surface, hot_x, hot_y);
    //
 
+   // TIZEN_ONLY(20230330): support client that requests to unset cursor
+   if (!surface)
+     {
+        if (input->cursor.name) eina_stringshare_del(input->cursor.name);
+        input->cursor.name = NULL;
+        ecore_wl2_display_flush(input->display);
+        return;
+     }
+   //
+
    input->cursor.surface = surface;
    input->cursor.hot_x = hot_x;
    input->cursor.hot_y = hot_y;
index 2a31948..85396fe 100644 (file)
@@ -4480,8 +4480,15 @@ ecore_wl2_window_cursor_from_name_set(Ecore_Wl2_Window *win, const char *cursor_
 
    eina_stringshare_replace(&win->pointer.cursor_name, cursor_name);
 
-   if ((input->cursor.name) && (strcmp(input->cursor.name, win->pointer.cursor_name)))
+   // TIZEN_ONLY(20230330): support client that requests to unset cursor
+   if (input->cursor.name)
+     {
+        if (strcmp(input->cursor.name, win->pointer.cursor_name))
+          ecore_wl2_input_cursor_from_name_set(input, cursor_name);
+     }
+   else
      ecore_wl2_input_cursor_from_name_set(input, cursor_name);
+   //
 }
 
 EAPI void