devilhorns pushed a commit to branch master.

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

commit c01c8456fecbf979ce0d4a91d6291a93e56486c8
Author: Srivardhan Hebbar <[email protected]>
Date:   Wed Sep 17 09:11:46 2014 -0400

    ecore_wayland: Added cursor_size in Ecore_Wl_Input.
    
    Summary:
    1. Added cursor_size to Ecore_Wl_Input struct.
    2. Made it configurable through environment variable 
ECORE_WL_INPUT_CURSOR_SIZE.
    3. Added a API ecore_wl_input_cursor_size_set for user to set manually.
    
    Signed-off-by: Srivardhan Hebbar <[email protected]>
    
    Reviewers: devilhorns
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D1456
    
    Conflicts:
        src/lib/ecore_wayland/ecore_wl_private.h
---
 src/lib/ecore_wayland/Ecore_Wayland.h    |  6 ++++++
 src/lib/ecore_wayland/ecore_wl.c         | 10 +++++++---
 src/lib/ecore_wayland/ecore_wl_input.c   | 21 +++++++++++++++++++++
 src/lib/ecore_wayland/ecore_wl_private.h |  6 ++++++
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h 
b/src/lib/ecore_wayland/Ecore_Wayland.h
index 781b14f..c3c9689 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -404,6 +404,12 @@ EAPI struct wl_seat 
*ecore_wl_input_seat_get(Ecore_Wl_Input *input);
 EAPI Eina_Inlist *ecore_wl_outputs_get(void);
 
 /**
+ * @ingroup Ecore_Wl_Input_Group
+ * @since 1.12
+ */
+EAPI void ecore_wl_input_cursor_size_set(Ecore_Wl_Input *input, const int 
size);
+
+/**
  * Retrieves the Wayland Globals Interface list used for the current Wayland 
connection.
  *
  * This call, if done after the ECORE_WL_EVENT_INTERFACES_BOUND event was
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index d6e0d4a..b283a2f 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -635,9 +635,13 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry 
*registry, unsigned in
      {
         ewd->wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
 
-        /* FIXME: We should not hard-code a cursor size here, and we should
-         * also import the theme name from a config or env variable */
-        ewd->cursor_theme = wl_cursor_theme_load(NULL, 32, ewd->wl.shm);
+        /* FIXME: we should import the theme name from a config or env 
variable */
+        if (ewd->input)
+          ewd->cursor_theme = wl_cursor_theme_load(NULL, 
ewd->input->cursor_size,
+                                                   ewd->wl.shm);
+        else
+          ewd->cursor_theme = wl_cursor_theme_load(NULL, 
ECORE_WL_DEFAULT_CURSOR_SIZE,
+                                                   ewd->wl.shm);
      }
    else if (!strcmp(interface, "wl_data_device_manager"))
      {
diff --git a/src/lib/ecore_wayland/ecore_wl_input.c 
b/src/lib/ecore_wayland/ecore_wl_input.c
index 9bab9a1..18da631 100644
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -209,6 +209,18 @@ ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct 
wl_surface *surface, in
                            surface, hot_x, hot_y);
 }
 
+EAPI void
+ecore_wl_input_cursor_size_set(Ecore_Wl_Input *input, const int size)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!input) return;
+
+   input->cursor_size = size;
+   input->display->cursor_theme = wl_cursor_theme_load(NULL, 
input->cursor_size,
+                                                       input->display->wl.shm);
+}
+
 static Eina_Bool
 _ecore_wl_input_cursor_update(void *data)
 {
@@ -327,6 +339,8 @@ void
 _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)
 {
    Ecore_Wl_Input *input;
+   char *temp;
+   unsigned int cursor_size;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -339,6 +353,13 @@ _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)
    input->keyboard_focus = NULL;
    input->touch_focus = NULL;
 
+   temp = getenv("ECORE_WL_CURSOR_SIZE");
+   if (temp)
+     cursor_size = atoi(temp);
+   else
+     cursor_size = ECORE_WL_DEFAULT_CURSOR_SIZE;
+   ecore_wl_input_cursor_size_set(input, cursor_size);
+
    input->seat = 
      wl_registry_bind(ewd->wl.registry, id, &wl_seat_interface, 1);
    ewd->inputs = eina_inlist_append(ewd->inputs, EINA_INLIST_GET(input));
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h 
b/src/lib/ecore_wayland/ecore_wl_private.h
index 3226253..d6c7fe9 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -53,6 +53,11 @@ extern int _ecore_wl_log_dom;
 # endif
 # define CRI(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__)
 
+# ifdef ECORE_WL_DEFAULT_CURSOR_SIZE
+#  undef ECORE_WL_DEFAULT_CURSOR_SIZE
+# endif
+# define ECORE_WL_DEFAULT_CURSOR_SIZE 32
+
 typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
 
 struct _Ecore_Wl_Display
@@ -175,6 +180,7 @@ struct _Ecore_Wl_Input
    struct wl_callback *cursor_frame_cb;
    Ecore_Timer *cursor_timer;
    unsigned int cursor_current_index;
+   unsigned int cursor_size;
 
    struct wl_data_device *data_device;
    struct wl_data_source *data_source;

-- 


Reply via email to