forked from enlightenment/enlightenment
parent
a85cbce2cb
commit
024ec09c48
|
@ -10,7 +10,7 @@ typedef struct _E_Pointer_Stack E_Pointer_Stack;
|
|||
|
||||
struct _E_Pointer_Stack
|
||||
{
|
||||
void *obj;
|
||||
void *obj;
|
||||
const char *type;
|
||||
};
|
||||
|
||||
|
@ -19,16 +19,28 @@ static Eina_List *handlers = NULL;
|
|||
|
||||
static void _e_pointer_canvas_add(E_Pointer *p);
|
||||
static void _e_pointer_canvas_del(E_Pointer *p);
|
||||
static void _e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
|
||||
static void _e_pointer_free(E_Pointer *p);
|
||||
static void _e_pointer_stack_free(E_Pointer_Stack *elem);
|
||||
static void _e_pointer_type_set(E_Pointer *p, const char *type);
|
||||
static void _e_pointer_active_handle(E_Pointer *p);
|
||||
static void _e_pointer_cb_move(void *data,
|
||||
Evas *e __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info);
|
||||
static void _e_pointer_free(E_Pointer *p);
|
||||
static void _e_pointer_stack_free(E_Pointer_Stack *elem);
|
||||
static void _e_pointer_type_set(E_Pointer *p,
|
||||
const char *type);
|
||||
static void _e_pointer_active_handle(E_Pointer *p);
|
||||
|
||||
static Eina_Bool _e_pointer_cb_mouse_down(void *data, int type, void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_up(void *data, int type, void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_move(void *data, int type, void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_wheel(void *data, int type, void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_down(void *data,
|
||||
int type,
|
||||
void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_up(void *data,
|
||||
int type,
|
||||
void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_move(void *data,
|
||||
int type,
|
||||
void *event);
|
||||
static Eina_Bool _e_pointer_cb_mouse_wheel(void *data,
|
||||
int type,
|
||||
void *event);
|
||||
static Eina_Bool _e_pointer_cb_idle_timer_pre(void *data);
|
||||
static Eina_Bool _e_pointer_cb_idle_timer_wait(void *data);
|
||||
static Eina_Bool _e_pointer_cb_idle_poller(void *data);
|
||||
|
@ -37,21 +49,21 @@ static Eina_Bool _e_pointer_cb_idle_poller(void *data);
|
|||
EINTERN int
|
||||
e_pointer_init(void)
|
||||
{
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
_e_pointer_cb_mouse_down, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
||||
_e_pointer_cb_mouse_up, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
|
||||
_e_pointer_cb_mouse_move, NULL));
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
|
||||
handlers =
|
||||
eina_list_append(handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
|
||||
_e_pointer_cb_mouse_wheel, NULL));
|
||||
return 1;
|
||||
}
|
||||
|
@ -64,7 +76,8 @@ e_pointer_shutdown(void)
|
|||
}
|
||||
|
||||
EAPI E_Pointer *
|
||||
e_pointer_window_new(Ecore_X_Window win, int filled)
|
||||
e_pointer_window_new(Ecore_X_Window win,
|
||||
int filled)
|
||||
{
|
||||
E_Pointer *p = NULL;
|
||||
|
||||
|
@ -79,7 +92,7 @@ e_pointer_window_new(Ecore_X_Window win, int filled)
|
|||
|
||||
ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4);
|
||||
if (filled) e_pointer_type_push(p, p, "default");
|
||||
_e_pointers = eina_list_append(_e_pointers, p);
|
||||
_e_pointers = eina_list_append(_e_pointers, p);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -92,40 +105,40 @@ e_pointers_size_set(int size)
|
|||
if (!e_config->show_cursor) return;
|
||||
EINA_LIST_FOREACH(_e_pointers, l, p)
|
||||
{
|
||||
Evas_Engine_Info_Buffer *einfo;
|
||||
Evas_Engine_Info_Buffer *einfo;
|
||||
|
||||
if (p->evas)
|
||||
{
|
||||
p->w = p->h = size;
|
||||
evas_output_size_set(p->evas, p->w, p->h);
|
||||
evas_output_viewport_set(p->evas, 0, 0, p->w, p->h);
|
||||
if (p->evas)
|
||||
{
|
||||
p->w = p->h = size;
|
||||
evas_output_size_set(p->evas, p->w, p->h);
|
||||
evas_output_viewport_set(p->evas, 0, 0, p->w, p->h);
|
||||
|
||||
p->pixels = realloc(p->pixels, p->w * p->h * sizeof(int));
|
||||
p->pixels = realloc(p->pixels, p->w * p->h * sizeof(int));
|
||||
|
||||
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(p->evas);
|
||||
if (einfo)
|
||||
{
|
||||
einfo->info.dest_buffer = p->pixels;
|
||||
einfo->info.dest_buffer_row_bytes = p->w * sizeof(int);
|
||||
evas_engine_info_set(p->evas, (Evas_Engine_Info *)einfo);
|
||||
}
|
||||
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(p->evas);
|
||||
if (einfo)
|
||||
{
|
||||
einfo->info.dest_buffer = p->pixels;
|
||||
einfo->info.dest_buffer_row_bytes = p->w * sizeof(int);
|
||||
evas_engine_info_set(p->evas, (Evas_Engine_Info *)einfo);
|
||||
}
|
||||
|
||||
evas_object_move(p->pointer_object, 0, 0);
|
||||
evas_object_resize(p->pointer_object, p->w, p->h);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *type;
|
||||
evas_object_move(p->pointer_object, 0, 0);
|
||||
evas_object_resize(p->pointer_object, p->w, p->h);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *type;
|
||||
|
||||
ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4);
|
||||
type = p->type;
|
||||
if (type)
|
||||
{
|
||||
p->type = NULL;
|
||||
_e_pointer_type_set(p, type);
|
||||
eina_stringshare_del(type);
|
||||
}
|
||||
}
|
||||
ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4);
|
||||
type = p->type;
|
||||
if (type)
|
||||
{
|
||||
p->type = NULL;
|
||||
_e_pointer_type_set(p, type);
|
||||
eina_stringshare_del(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +151,9 @@ e_pointer_hide(E_Pointer *p)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_pointer_type_push(E_Pointer *p, void *obj, const char *type)
|
||||
e_pointer_type_push(E_Pointer *p,
|
||||
void *obj,
|
||||
const char *type)
|
||||
{
|
||||
E_Pointer_Stack *stack;
|
||||
|
||||
|
@ -152,14 +167,16 @@ e_pointer_type_push(E_Pointer *p, void *obj, const char *type)
|
|||
stack = E_NEW(E_Pointer_Stack, 1);
|
||||
if (stack)
|
||||
{
|
||||
stack->type = eina_stringshare_add(p->type);
|
||||
stack->obj = p->obj;
|
||||
p->stack = eina_list_prepend(p->stack, stack);
|
||||
stack->type = eina_stringshare_add(p->type);
|
||||
stack->obj = p->obj;
|
||||
p->stack = eina_list_prepend(p->stack, stack);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_pointer_type_pop(E_Pointer *p, void *obj, const char *type)
|
||||
e_pointer_type_pop(E_Pointer *p,
|
||||
void *obj,
|
||||
const char *type)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Pointer_Stack *stack;
|
||||
|
@ -167,21 +184,21 @@ e_pointer_type_pop(E_Pointer *p, void *obj, const char *type)
|
|||
if (!p) return;
|
||||
EINA_LIST_FOREACH(p->stack, l, stack)
|
||||
{
|
||||
if ((stack->obj == obj) && ((!type) || (!strcmp(stack->type, type))))
|
||||
{
|
||||
_e_pointer_stack_free(stack);
|
||||
p->stack = eina_list_remove_list(p->stack, l);
|
||||
if (type) break;
|
||||
}
|
||||
if ((stack->obj == obj) && ((!type) || (!strcmp(stack->type, type))))
|
||||
{
|
||||
_e_pointer_stack_free(stack);
|
||||
p->stack = eina_list_remove_list(p->stack, l);
|
||||
if (type) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p->stack)
|
||||
{
|
||||
if (p->evas) _e_pointer_canvas_del(p);
|
||||
ecore_x_window_cursor_set(p->win, 0);
|
||||
if (p->type) eina_stringshare_del(p->type);
|
||||
p->type = NULL;
|
||||
return;
|
||||
if (p->evas) _e_pointer_canvas_del(p);
|
||||
ecore_x_window_cursor_set(p->win, 0);
|
||||
if (p->type) eina_stringshare_del(p->type);
|
||||
p->type = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
stack = eina_list_data_get(p->stack);
|
||||
|
@ -204,23 +221,23 @@ e_pointer_idler_before(void)
|
|||
if (!e_config->show_cursor) return;
|
||||
EINA_LIST_FOREACH(_e_pointers, l, p)
|
||||
{
|
||||
Eina_List *updates;
|
||||
Eina_List *updates;
|
||||
|
||||
if (!p->e_cursor) continue;
|
||||
if (!p->evas) continue;
|
||||
if (!p->e_cursor) continue;
|
||||
if (!p->evas) continue;
|
||||
|
||||
updates = evas_render_updates(p->evas);
|
||||
if ((updates) || (p->hot.update))
|
||||
{
|
||||
Ecore_X_Cursor cur;
|
||||
updates = evas_render_updates(p->evas);
|
||||
if ((updates) || (p->hot.update))
|
||||
{
|
||||
Ecore_X_Cursor cur;
|
||||
|
||||
cur = ecore_x_cursor_new(p->win, p->pixels, p->w, p->h,
|
||||
cur = ecore_x_cursor_new(p->win, p->pixels, p->w, p->h,
|
||||
p->hot.x, p->hot.y);
|
||||
ecore_x_window_cursor_set(p->win, cur);
|
||||
ecore_x_cursor_free(cur);
|
||||
evas_render_updates_free(updates);
|
||||
p->hot.update = 0;
|
||||
}
|
||||
ecore_x_window_cursor_set(p->win, cur);
|
||||
ecore_x_cursor_free(cur);
|
||||
evas_render_updates_free(updates);
|
||||
p->hot.update = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,8 +257,8 @@ _e_pointer_canvas_add(E_Pointer *p)
|
|||
p->evas = evas_new();
|
||||
if (!p->evas)
|
||||
{
|
||||
e_object_del(E_OBJECT(p));
|
||||
return;
|
||||
e_object_del(E_OBJECT(p));
|
||||
return;
|
||||
}
|
||||
rmethod = evas_render_method_lookup("buffer");
|
||||
evas_output_method_set(p->evas, rmethod);
|
||||
|
@ -252,13 +269,13 @@ _e_pointer_canvas_add(E_Pointer *p)
|
|||
if (!p->pixels)
|
||||
{
|
||||
_e_pointer_canvas_del(p);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(p->evas);
|
||||
if (!einfo)
|
||||
{
|
||||
_e_pointer_canvas_del(p);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
|
||||
einfo->info.dest_buffer = p->pixels;
|
||||
|
@ -275,9 +292,9 @@ _e_pointer_canvas_add(E_Pointer *p)
|
|||
/* Create the hotspot object */
|
||||
o = evas_object_rectangle_add(p->evas);
|
||||
evas_object_color_set(o, 0, 0, 0, 0);
|
||||
p->hot_object = o;
|
||||
p->hot_object = o;
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE,
|
||||
_e_pointer_cb_move, p);
|
||||
_e_pointer_cb_move, p);
|
||||
/* init edje */
|
||||
evas_object_move(p->pointer_object, 0, 0);
|
||||
evas_object_resize(p->pointer_object, p->w, p->h);
|
||||
|
@ -299,7 +316,10 @@ _e_pointer_canvas_del(E_Pointer *p)
|
|||
}
|
||||
|
||||
static void
|
||||
_e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
_e_pointer_cb_move(void *data,
|
||||
Evas *e __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
E_Pointer *p;
|
||||
Evas_Coord x, y;
|
||||
|
@ -309,12 +329,12 @@ _e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
|
|||
if (!(p = data)) return;
|
||||
if (!p->e_cursor) return;
|
||||
edje_object_part_geometry_get(p->pointer_object, "e.swallow.hotspot",
|
||||
&x, &y, NULL, NULL);
|
||||
&x, &y, NULL, NULL);
|
||||
if ((p->hot.x != x) || (p->hot.y != y))
|
||||
{
|
||||
p->hot.x = x;
|
||||
p->hot.y = y;
|
||||
p->hot.update = 1;
|
||||
p->hot.x = x;
|
||||
p->hot.y = y;
|
||||
p->hot.update = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,8 +365,9 @@ _e_pointer_stack_free(E_Pointer_Stack *elem)
|
|||
free(elem);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_pointer_type_set(E_Pointer *p, const char *type)
|
||||
static void
|
||||
_e_pointer_type_set(E_Pointer *p,
|
||||
const char *type)
|
||||
{
|
||||
if (!p) return;
|
||||
|
||||
|
@ -359,79 +380,79 @@ _e_pointer_type_set(E_Pointer *p, const char *type)
|
|||
/* Do not set type if in "hidden mode" */
|
||||
if (!e_config->show_cursor)
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win, 0);
|
||||
return;
|
||||
ecore_x_window_cursor_set(p->win, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->e_cursor)
|
||||
{
|
||||
char cursor[1024];
|
||||
Evas_Coord x, y;
|
||||
char cursor[1024];
|
||||
Evas_Coord x, y;
|
||||
|
||||
if (!p->evas) _e_pointer_canvas_add(p);
|
||||
if (p->color)
|
||||
snprintf(cursor, sizeof(cursor),
|
||||
if (!p->evas) _e_pointer_canvas_add(p);
|
||||
if (p->color)
|
||||
snprintf(cursor, sizeof(cursor),
|
||||
"e/pointer/enlightenment/%s/color", type);
|
||||
else
|
||||
snprintf(cursor, sizeof(cursor),
|
||||
else
|
||||
snprintf(cursor, sizeof(cursor),
|
||||
"e/pointer/enlightenment/%s/mono", type);
|
||||
if (!e_theme_edje_object_set(p->pointer_object,
|
||||
if (!e_theme_edje_object_set(p->pointer_object,
|
||||
"base/theme/pointer", cursor))
|
||||
goto fallback;
|
||||
edje_object_part_swallow(p->pointer_object, "e.swallow.hotspot",
|
||||
edje_object_part_swallow(p->pointer_object, "e.swallow.hotspot",
|
||||
p->hot_object);
|
||||
edje_object_part_geometry_get(p->pointer_object, "e.swallow.hotspot",
|
||||
&x, &y, NULL, NULL);
|
||||
if ((p->hot.x != x) || (p->hot.y != y))
|
||||
{
|
||||
p->hot.x = x;
|
||||
p->hot.y = y;
|
||||
}
|
||||
p->hot.update = 1;
|
||||
return;
|
||||
edje_object_part_geometry_get(p->pointer_object, "e.swallow.hotspot",
|
||||
&x, &y, NULL, NULL);
|
||||
if ((p->hot.x != x) || (p->hot.y != y))
|
||||
{
|
||||
p->hot.x = x;
|
||||
p->hot.y = y;
|
||||
}
|
||||
p->hot.update = 1;
|
||||
return;
|
||||
}
|
||||
fallback:
|
||||
{
|
||||
Ecore_X_Cursor cursor = 0;
|
||||
fallback:
|
||||
{
|
||||
Ecore_X_Cursor cursor = 0;
|
||||
|
||||
if (p->evas) _e_pointer_canvas_del(p);
|
||||
if (!strcmp(type, "move"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR);
|
||||
if (p->evas) _e_pointer_canvas_del(p);
|
||||
if (!strcmp(type, "move"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR);
|
||||
#if 0
|
||||
else if (!strcmp(type, "resize"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_SIZING);
|
||||
else if (!strcmp(type, "resize"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_SIZING);
|
||||
#endif
|
||||
else if (!strcmp(type, "resize_tl"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER);
|
||||
else if (!strcmp(type, "resize_t"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE);
|
||||
else if (!strcmp(type, "resize_tr"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER);
|
||||
else if (!strcmp(type, "resize_r"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE);
|
||||
else if (!strcmp(type, "resize_br"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER);
|
||||
else if (!strcmp(type, "resize_b"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE);
|
||||
else if (!strcmp(type, "resize_bl"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER);
|
||||
else if (!strcmp(type, "resize_l"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE);
|
||||
else if (!strcmp(type, "entry"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_XTERM);
|
||||
else if (!strcmp(type, "default"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR);
|
||||
else if (!strcmp(type, "plus"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_PLUS);
|
||||
else
|
||||
{
|
||||
printf("Unknown pointer type: %s\n", type);
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_ARROW);
|
||||
}
|
||||
if (!cursor) printf("X Cursor for %s is missing\n", type);
|
||||
ecore_x_window_cursor_set(p->win, cursor);
|
||||
if (cursor) ecore_x_cursor_free(cursor);
|
||||
}
|
||||
else if (!strcmp(type, "resize_tl"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER);
|
||||
else if (!strcmp(type, "resize_t"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE);
|
||||
else if (!strcmp(type, "resize_tr"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER);
|
||||
else if (!strcmp(type, "resize_r"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE);
|
||||
else if (!strcmp(type, "resize_br"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER);
|
||||
else if (!strcmp(type, "resize_b"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE);
|
||||
else if (!strcmp(type, "resize_bl"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER);
|
||||
else if (!strcmp(type, "resize_l"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE);
|
||||
else if (!strcmp(type, "entry"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_XTERM);
|
||||
else if (!strcmp(type, "default"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR);
|
||||
else if (!strcmp(type, "plus"))
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_PLUS);
|
||||
else
|
||||
{
|
||||
printf("Unknown pointer type: %s\n", type);
|
||||
cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_ARROW);
|
||||
}
|
||||
if (!cursor) printf("X Cursor for %s is missing\n", type);
|
||||
ecore_x_window_cursor_set(p->win, cursor);
|
||||
if (cursor) ecore_x_cursor_free(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -443,19 +464,19 @@ _e_pointer_active_handle(E_Pointer *p)
|
|||
* signal as we WERE idle, NOW we are active */
|
||||
if (p->idle_timer)
|
||||
{
|
||||
ecore_timer_del(p->idle_timer);
|
||||
p->idle_timer = NULL;
|
||||
ecore_timer_del(p->idle_timer);
|
||||
p->idle_timer = NULL;
|
||||
}
|
||||
if (p->idle_poller)
|
||||
{
|
||||
ecore_poller_del(p->idle_poller);
|
||||
p->idle_poller = NULL;
|
||||
ecore_poller_del(p->idle_poller);
|
||||
p->idle_poller = NULL;
|
||||
}
|
||||
if (p->idle)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object, "e,state,mouse,active", "e");
|
||||
p->idle = 0;
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object, "e,state,mouse,active", "e");
|
||||
p->idle = 0;
|
||||
}
|
||||
if (e_powersave_mode_get() >= E_POWERSAVE_MODE_MEDIUM) return;
|
||||
/* and schedule a pre-idle check in 1 second if no more events happen */
|
||||
|
@ -464,77 +485,85 @@ _e_pointer_active_handle(E_Pointer *p)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_pointer_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||
_e_pointer_cb_mouse_down(void *data __UNUSED__,
|
||||
int type __UNUSED__,
|
||||
void *event __UNUSED__)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Pointer *p;
|
||||
|
||||
EINA_LIST_FOREACH(_e_pointers, l, p)
|
||||
{
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_EXTREME)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_EXTREME)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
"e,action,mouse,down", "e");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_pointer_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||
_e_pointer_cb_mouse_up(void *data __UNUSED__,
|
||||
int type __UNUSED__,
|
||||
void *event __UNUSED__)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Pointer *p;
|
||||
|
||||
EINA_LIST_FOREACH(_e_pointers, l, p)
|
||||
{
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_EXTREME)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_EXTREME)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
"e,action,mouse,up", "e");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_pointer_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||
_e_pointer_cb_mouse_move(void *data __UNUSED__,
|
||||
int type __UNUSED__,
|
||||
void *event __UNUSED__)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Pointer *p;
|
||||
|
||||
EINA_LIST_FOREACH(_e_pointers, l, p)
|
||||
{
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_HIGH)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_HIGH)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
"e,action,mouse,move", "e");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_pointer_cb_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||
_e_pointer_cb_mouse_wheel(void *data __UNUSED__,
|
||||
int type __UNUSED__,
|
||||
void *event __UNUSED__)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Pointer *p;
|
||||
|
||||
EINA_LIST_FOREACH(_e_pointers, l, p)
|
||||
{
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_EXTREME)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
_e_pointer_active_handle(p);
|
||||
if (e_powersave_mode_get() < E_POWERSAVE_MODE_EXTREME)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
"e,action,mouse,wheel", "e");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
@ -562,14 +591,14 @@ _e_pointer_cb_idle_timer_wait(void *data)
|
|||
if ((e_powersave_mode_get() >= E_POWERSAVE_MODE_MEDIUM) ||
|
||||
(!e_config->idle_cursor))
|
||||
{
|
||||
if (p->idle_poller) ecore_poller_del(p->idle_poller);
|
||||
p->idle_poller = NULL;
|
||||
p->idle_timer = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
if (p->idle_poller) ecore_poller_del(p->idle_poller);
|
||||
p->idle_poller = NULL;
|
||||
p->idle_timer = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
if (!p->idle_poller)
|
||||
p->idle_poller = ecore_poller_add(ECORE_POLLER_CORE, 64,
|
||||
_e_pointer_cb_idle_poller, p);
|
||||
_e_pointer_cb_idle_poller, p);
|
||||
p->idle_timer = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
@ -584,34 +613,35 @@ _e_pointer_cb_idle_poller(void *data)
|
|||
if ((e_powersave_mode_get() >= E_POWERSAVE_MODE_MEDIUM) ||
|
||||
(!e_config->idle_cursor))
|
||||
{
|
||||
p->idle_poller = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
p->idle_poller = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
/* check if pointer actually moved since the 1 second post-mouse move idle
|
||||
* pre-timer that fetches the position */
|
||||
ecore_x_pointer_xy_get(p->win, &x, &y);
|
||||
if ((x != p->x) || (y != p->y))
|
||||
{
|
||||
/* it moved - so we are not idle yet - record position and wait
|
||||
* 4 secons more */
|
||||
p->x = x;
|
||||
p->y = y;
|
||||
if (p->idle)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
"e,state,mouse,active", "e");
|
||||
p->idle = 0;
|
||||
}
|
||||
/* use poller to check from now on */
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
/* it moved - so we are not idle yet - record position and wait
|
||||
* 4 secons more */
|
||||
p->x = x;
|
||||
p->y = y;
|
||||
if (p->idle)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object,
|
||||
"e,state,mouse,active", "e");
|
||||
p->idle = 0;
|
||||
}
|
||||
/* use poller to check from now on */
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
/* we are idle - report it if not idle before */
|
||||
if (!p->idle)
|
||||
{
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object, "e,state,mouse,idle", "e");
|
||||
p->idle = 1;
|
||||
if (p->pointer_object)
|
||||
edje_object_signal_emit(p->pointer_object, "e,state,mouse,idle", "e");
|
||||
p->idle = 1;
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue