ecore_wayland: Added cursor_size in Ecore_Wl_Input.
authorSrivardhan Hebbar <sri.hebbar@samsung.com>
Wed, 17 Sep 2014 13:11:46 +0000 (09:11 -0400)
committerChris Michael <cp.michael@samsung.com>
Wed, 17 Sep 2014 13:12:58 +0000 (09:12 -0400)
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 <sri.hebbar@samsung.com>
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
src/lib/ecore_wayland/ecore_wl.c
src/lib/ecore_wayland/ecore_wl_input.c
src/lib/ecore_wayland/ecore_wl_private.h

index 781b14f..c3c9689 100644 (file)
@@ -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
index d6e0d4a..b283a2f 100644 (file)
@@ -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"))
      {
index 9bab9a1..18da631 100644 (file)
@@ -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));
index 3226253..d6c7fe9 100644 (file)
@@ -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;