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 <sri.hebbar@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1456

Conflicts:
	src/lib/ecore_wayland/ecore_wl_private.h
This commit is contained in:
Srivardhan Hebbar 2014-09-17 09:11:46 -04:00 committed by Chris Michael
parent 7db6f1c198
commit c01c8456fe
4 changed files with 40 additions and 3 deletions

View File

@ -403,6 +403,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.
*

View 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"))
{

View 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));

View 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;