devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=330ac8300466496513ab1a14ef8f1792b523e6bb

commit 330ac8300466496513ab1a14ef8f1792b523e6bb
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Thu Sep 10 12:09:14 2015 -0400

    ecore-wl2: Add support for initial setup of pointer cursor
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/ecore_wl2_input.c   | 36 ++++++++++++++++++++++++++++++++---
 src/lib/ecore_wl2/ecore_wl2_private.h |  3 ++-
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c 
b/src/lib/ecore_wl2/ecore_wl2_input.c
index dc62ae2..9cbd165 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -27,7 +27,12 @@ _seat_cb_capabilities(void *data, struct wl_seat *seat, enum 
wl_seat_capability
         input->wl.pointer = wl_seat_get_pointer(seat);
         wl_pointer_set_user_data(input->wl.pointer, input);
         /* TODO: pointer listener */
-        /* TODO: pointer surface */
+
+        if (!input->cursor.surface)
+          {
+             input->cursor.surface =
+               wl_compositor_create_surface(input->display->wl.compositor);
+          }
      }
    else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && (input->wl.pointer))
      {
@@ -67,6 +72,29 @@ static const struct wl_seat_listener _seat_listener =
    NULL
 };
 
+static void
+_ecore_wl2_input_cursor_setup(Ecore_Wl2_Input *input)
+{
+   char *tmp;
+
+   input->cursor.size = 32;
+   tmp = getenv("ECORE_WL_CURSOR_SIZE");
+   if (tmp) input->cursor.size = atoi(tmp);
+
+   tmp = getenv("ECORE_WL_CURSOR_THEME_NAME");
+   eina_stringshare_replace(&input->cursor.theme_name, tmp);
+
+   if (!input->cursor.name)
+     input->cursor.name = eina_stringshare_add("left_ptr");
+
+   if (input->display->wl.shm)
+     {
+        input->cursor.theme =
+          wl_cursor_theme_load(input->cursor.theme_name, input->cursor.size,
+                               input->display->wl.shm);
+     }
+}
+
 void
 _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id)
 {
@@ -83,7 +111,8 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned 
int id)
 
    wl_array_init(&input->data.types);
 
-   /* TODO: setup cursor size and theme */
+   /* setup cursor size and theme */
+   _ecore_wl2_input_cursor_setup(input);
 
    input->wl.seat =
      wl_registry_bind(wl_display_get_registry(display->wl.display),
@@ -116,7 +145,8 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input)
 
    if (input->cursor.surface) wl_surface_destroy(input->cursor.surface);
    if (input->cursor.name) eina_stringshare_del(input->cursor.name);
-   if (input->cursor.theme) eina_stringshare_del(input->cursor.theme);
+   if (input->cursor.theme_name)
+     eina_stringshare_del(input->cursor.theme_name);
 
    if (input->data.types.data)
      {
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index 0f1741a..0b5403f 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -127,9 +127,10 @@ struct _Ecore_Wl2_Input
 
    struct
      {
-        const char *name, *theme;
+        const char *name, *theme_name;
         unsigned int index, size;
         struct wl_cursor *wl_cursor;
+        struct wl_cursor_theme *theme;
         struct wl_surface *surface;
         struct wl_callback *frame_cb;
         Ecore_Timer *timer;

-- 


Reply via email to