ecore/wayland: Implement the object_cursor_set method for wayland.

This allows to specify an Evas_Object (e.g. an edje object) as cursor
theme.

SVN revision: 78971
This commit is contained in:
Rafael Antognolli 2012-11-07 16:12:14 +00:00
parent 5ba83e3cdc
commit 76f067b9fb
4 changed files with 48 additions and 2 deletions

View File

@ -424,6 +424,7 @@ void _ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h);
void _ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h);
void _ecore_evas_wl_common_size_base_set(Ecore_Evas *ee, int w, int h);
void _ecore_evas_wl_common_size_step_set(Ecore_Evas *ee, int w, int h);
void _ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
void _ecore_evas_wl_common_layer_set(Ecore_Evas *ee, int layer);
void _ecore_evas_wl_common_iconified_set(Ecore_Evas *ee, int iconify);
void _ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, int max);

View File

@ -580,6 +580,51 @@ _ecore_evas_wl_common_size_step_set(Ecore_Evas *ee, int w, int h)
ee->prop.step.h = h;
}
static void
_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Ecore_Evas *ee;
ee = data;
if (ee) ee->prop.cursor.object = NULL;
}
void
_ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
{
int x, y;
if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
if (!obj)
{
ee->prop.cursor.object = NULL;
ee->prop.cursor.layer = 0;
ee->prop.cursor.hot.x = 0;
ee->prop.cursor.hot.y = 0;
ecore_wl_window_cursor_default_restore(ee->engine.wl.win);
return;
}
ee->prop.cursor.object = obj;
ee->prop.cursor.layer = layer;
ee->prop.cursor.hot.x = hot_x;
ee->prop.cursor.hot.y = hot_y;
ecore_wl_window_pointer_set(ee->engine.wl.win, NULL, 0, 0);
evas_pointer_output_xy_get(ee->evas, &x, &y);
evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
evas_object_move(ee->prop.cursor.object,
x - ee->prop.cursor.hot.x,
y - ee->prop.cursor.hot.y);
evas_object_pass_events_set(ee->prop.cursor.object, 1);
if (evas_pointer_inside_get(ee->evas))
evas_object_show(ee->prop.cursor.object);
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
}
void
_ecore_evas_wl_common_layer_set(Ecore_Evas *ee, int layer)
{

View File

@ -70,7 +70,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
_ecore_evas_wl_common_size_max_set,
_ecore_evas_wl_common_size_base_set,
_ecore_evas_wl_common_size_step_set,
NULL, // object_cursor_set
_ecore_evas_wl_common_object_cursor_set,
_ecore_evas_wl_common_layer_set,
NULL, // focus set
_ecore_evas_wl_common_iconified_set,

View File

@ -86,7 +86,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
_ecore_evas_wl_common_size_max_set,
_ecore_evas_wl_common_size_base_set,
_ecore_evas_wl_common_size_step_set,
NULL, // object_cursor_set
_ecore_evas_wl_common_object_cursor_set, // object_cursor_set
_ecore_evas_wl_common_layer_set,
NULL, // focus set
_ecore_evas_wl_common_iconified_set,