* Ecore_Input: Make it generic.

SVN revision: 39577
This commit is contained in:
Cedric BAIL 2009-03-19 13:06:16 +00:00
parent ca0470e59f
commit 2bf2c79957
12 changed files with 260 additions and 350 deletions

View File

@ -2484,3 +2484,41 @@ _ecore_evas_idle_timeout_update(Ecore_Evas *ee)
_ecore_evas_cb_idle_flush,
ee);
}
void
_ecore_evas_mouse_move_process(void *ecore_evas, int x, int y, unsigned int timestamp)
{
Ecore_Evas *ee = ecore_evas;
ee->mouse.x = x;
ee->mouse.y = y;
if (ee->prop.cursor.object)
{
evas_object_show(ee->prop.cursor.object);
if (ee->rotation == 0)
evas_object_move(ee->prop.cursor.object,
x - ee->prop.cursor.hot.x,
y - ee->prop.cursor.hot.y);
else if (ee->rotation == 90)
evas_object_move(ee->prop.cursor.object,
ee->h - y - 1 - ee->prop.cursor.hot.x,
x - ee->prop.cursor.hot.y);
else if (ee->rotation == 180)
evas_object_move(ee->prop.cursor.object,
ee->w - x - 1 - ee->prop.cursor.hot.x,
ee->h - y - 1 - ee->prop.cursor.hot.y);
else if (ee->rotation == 270)
evas_object_move(ee->prop.cursor.object,
y - ee->prop.cursor.hot.x,
ee->w - x - 1 - ee->prop.cursor.hot.y);
}
if (ee->rotation == 0)
evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
else if (ee->rotation == 90)
evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
else if (ee->rotation == 180)
evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
else if (ee->rotation == 270)
evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
}

View File

@ -212,7 +212,7 @@ _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *ob
x = ev->cur.canvas.x;
y = ev->cur.canvas.y;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
_ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
}
static void

View File

@ -118,7 +118,7 @@ _ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, vo
ee = _ecore_evas_directfb_match(e->win);
if (!ee) return 1; /* pass on event */
ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -132,7 +132,7 @@ _ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED_
ee = _ecore_evas_directfb_match(e->win);
if (!ee) return 1; /* pass on event */
// ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
// _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL);
return 1;
}
@ -148,7 +148,7 @@ _ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__,
ee = _ecore_evas_directfb_match(e->win);
if (!ee) return 1; /* pass on event */
//ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
//_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL);
return 1;
}
@ -164,7 +164,7 @@ _ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, voi
if (!ee) return 1; /* pass on event */
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
//ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
//_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -179,7 +179,7 @@ _ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, voi
if (!ee) return 1; /* pass on event */
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
//ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
//_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
return 1;

View File

@ -327,5 +327,6 @@ void _ecore_evas_fps_debug_shutdown(void);
void _ecore_evas_fps_debug_rendertime_add(double t);
void _ecore_evas_free(Ecore_Evas *ee);
void _ecore_evas_idle_timeout_update(Ecore_Evas *ee);
void _ecore_evas_mouse_move_process(void *ecore_evas, int x, int y, unsigned int timestamp);
#endif

View File

@ -79,19 +79,6 @@ static NSWindow * main_window;
@end
static void
_ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
{
ee->mouse.x = x;
ee->mouse.y = y;
if (ee->prop.cursor.object)
{
evas_object_show(ee->prop.cursor.object);
evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y);
}
evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
}
static Ecore_Evas *
_ecore_evas_quartz_match(void)
{

View File

@ -191,7 +191,7 @@ _ecore_evas_sdl_init(int w, int h)
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
#endif /* _WIN32 */
ecore_evas_event_init();
ecore_event_evas_init();
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL);
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL);
@ -210,9 +210,10 @@ _ecore_evas_sdl_shutdown(void)
int i;
while (ecore_evases) _ecore_evas_free(ecore_evases);
for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
ecore_event_handler_del(ecore_evas_event_handlers[i]);
ecore_evas_event_shutdown();
ecore_event_evas_shutdown();
ecore_idle_enterer_del(ecore_evas_idle_enterer);
ecore_evas_idle_enterer = NULL;
ecore_poller_del(ecore_evas_event);
@ -229,7 +230,7 @@ static void
_ecore_evas_sdl_free(Ecore_Evas *ee)
{
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
ecore_evas_unregister(ee, 0);
ecore_event_window_unregister(0);
_ecore_evas_sdl_shutdown();
ecore_sdl_shutdown();
}
@ -410,9 +411,6 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
einfo->info.alpha = alpha;
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
}
ecore_evas_register(ee, 0);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
if (!ecore_sdl_init(name))
{
@ -424,6 +422,10 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
_ecore_evas_sdl_init(w, h);
ecore_event_window_register(0, ee, ee->evas, _ecore_evas_mouse_move_process);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
SDL_ShowCursor(SDL_DISABLE);
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);

View File

@ -313,41 +313,6 @@ _ecore_evas_win32_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__,
return 1;
}
static void
_ecore_evas_win32_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
{
ee->mouse.x = x;
ee->mouse.y = y;
if (ee->prop.cursor.object)
{
evas_object_show(ee->prop.cursor.object);
if (ee->rotation == 0)
evas_object_move(ee->prop.cursor.object,
x - ee->prop.cursor.hot.x,
y - ee->prop.cursor.hot.y);
else if (ee->rotation == 90)
evas_object_move(ee->prop.cursor.object,
ee->h - y - 1 - ee->prop.cursor.hot.x,
x - ee->prop.cursor.hot.y);
else if (ee->rotation == 180)
evas_object_move(ee->prop.cursor.object,
ee->w - x - 1 - ee->prop.cursor.hot.x,
ee->h - y - 1 - ee->prop.cursor.hot.y);
else if (ee->rotation == 270)
evas_object_move(ee->prop.cursor.object,
y - ee->prop.cursor.hot.x,
ee->w - x - 1 - ee->prop.cursor.hot.y);
}
if (ee->rotation == 0)
evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
else if (ee->rotation == 90)
evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
else if (ee->rotation == 180)
evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
else if (ee->rotation == 270)
evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
}
static int
_ecore_evas_win32_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
{
@ -362,7 +327,7 @@ _ecore_evas_win32_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, v
if (e->window != ee->engine.win32.window) return 1;
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
_ecore_evas_win32_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -384,7 +349,7 @@ _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
_ecore_evas_win32_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -404,7 +369,7 @@ _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
_ecore_evas_win32_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
@ -568,8 +533,8 @@ _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSE
{
if ((ee->expecting_resize.w == ee->w) &&
(ee->expecting_resize.h == ee->h))
_ecore_evas_win32_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_win32_current_time_get());
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_win32_current_time_get());
ee->expecting_resize.w = 0;
ee->expecting_resize.h = 0;
}
@ -756,15 +721,15 @@ _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation)
ecore_evas_size_max_set(ee, maxh, maxw);
ecore_evas_size_base_set(ee, baseh, basew);
ecore_evas_size_step_set(ee, steph, stepw);
_ecore_evas_win32_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_win32_current_time_get());
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_win32_current_time_get());
}
else
{
einfo->info.rotation = rotation;
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
ee->rotation = rotation;
_ecore_evas_win32_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_win32_current_time_get());
if (ee->func.fn_resize) ee->func.fn_resize(ee);
}

View File

@ -210,41 +210,6 @@ _ecore_evas_wince_match(Ecore_WinCE_Window *window)
return ee;
}
static void
_ecore_evas_wince_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
{
ee->mouse.x = x;
ee->mouse.y = y;
if (ee->prop.cursor.object)
{
evas_object_show(ee->prop.cursor.object);
if (ee->rotation == 0)
evas_object_move(ee->prop.cursor.object,
x - ee->prop.cursor.hot.x,
y - ee->prop.cursor.hot.y);
else if (ee->rotation == 90)
evas_object_move(ee->prop.cursor.object,
ee->h - y - 1 - ee->prop.cursor.hot.x,
x - ee->prop.cursor.hot.y);
else if (ee->rotation == 180)
evas_object_move(ee->prop.cursor.object,
ee->w - x - 1 - ee->prop.cursor.hot.x,
ee->h - y - 1 - ee->prop.cursor.hot.y);
else if (ee->rotation == 270)
evas_object_move(ee->prop.cursor.object,
y - ee->prop.cursor.hot.x,
ee->w - x - 1 - ee->prop.cursor.hot.y);
}
if (ee->rotation == 0)
evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
else if (ee->rotation == 90)
evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
else if (ee->rotation == 180)
evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
else if (ee->rotation == 270)
evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
}
static int
_ecore_evas_wince_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
@ -343,7 +308,7 @@ _ecore_evas_wince_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, v
if (e->window != ee->engine.wince.window) return 1;
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
_ecore_evas_wince_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -365,7 +330,7 @@ _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
_ecore_evas_wince_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -385,7 +350,7 @@ _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
_ecore_evas_wince_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);

View File

@ -441,7 +441,7 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__,
Ecore_X_Event_Window_Property *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
@ -542,7 +542,7 @@ _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__
Ecore_X_Event_Window_Visibility_Change *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
// printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured);
@ -558,7 +558,7 @@ _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *e
Ecore_X_Event_Mouse_In *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
/* { */
@ -596,9 +596,9 @@ _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *e
// return 0;
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
return 1;
}
@ -609,7 +609,7 @@ _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *
Ecore_X_Event_Mouse_Out *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if ((!ee) || (ee->ignore_events)) return 1;
/* pass on event */
if (e->win != ee->prop.window) return 1;
@ -647,8 +647,8 @@ _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *
// (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
// return 0;
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
if (e->mode == ECORE_X_EVENT_MODE_GRAB)
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
@ -664,7 +664,7 @@ _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__,
Ecore_X_Event_Window_Focus_In *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
ee->prop.focused = 1;
@ -679,7 +679,7 @@ _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__,
Ecore_X_Event_Window_Focus_Out *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (ee->prop.fullscreen)
@ -696,7 +696,7 @@ _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, vo
Ecore_X_Event_Window_Damage *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (ee->engine.x.using_bg_pixmap) return 1;
@ -768,7 +768,7 @@ _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, v
Ecore_X_Event_Window_Destroy *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
@ -783,7 +783,7 @@ _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__,
Ecore_X_Event_Window_Configure *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (ee->engine.x.direct_resize) return 1;
@ -826,8 +826,8 @@ _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__,
{
if ((ee->expecting_resize.w == ee->w) &&
(ee->expecting_resize.h == ee->h))
ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_x_current_time_get());
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_x_current_time_get());
ee->expecting_resize.w = 0;
ee->expecting_resize.h = 0;
}
@ -843,7 +843,7 @@ _ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUS
Ecore_X_Event_Window_Delete_Request *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
@ -857,7 +857,7 @@ _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void
Ecore_X_Event_Window_Show *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (ee->visible) return 0; /* dont pass it on */
@ -874,7 +874,7 @@ _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void
Ecore_X_Event_Window_Hide *e;
e = event;
ee = ecore_evas_window_match(e->win);
ee = ecore_event_window_match(e->win);
if (!ee) return 1; /* pass on event */
if (e->win != ee->prop.window) return 1;
if (!ee->visible) return 0; /* dont pass it on */
@ -1092,7 +1092,7 @@ _ecore_evas_x_init(void)
ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, _ecore_evas_x_event_window_hide, NULL);
ecore_evas_event_handlers[10] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _ecore_evas_x_event_property_change, NULL);
ecore_evas_event_handlers[11] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, _ecore_evas_x_event_visibility_change, NULL);
ecore_evas_event_init();
ecore_event_evas_init();
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
return _ecore_evas_init_count;
}
@ -1117,14 +1117,14 @@ _ecore_evas_x_free(Ecore_Evas *ee)
#else
ee->engine.x.damages = 0;
#endif /* ! HAVE_ECORE_X_XCB */
ecore_evas_unregister(ee, ee->prop.window);
ecore_event_window_unregister(ee->prop.window);
while (ee->engine.x.win_extra)
{
Ecore_X_Window *winp;
winp = ee->engine.x.win_extra->data;
ee->engine.x.win_extra = eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra);
ecore_evas_unregister(ee, *winp);
ecore_event_window_unregister(*winp);
free(winp);
}
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
@ -1351,15 +1351,15 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation,
ecore_evas_size_max_set(ee, maxh, maxw);
ecore_evas_size_base_set(ee, baseh, basew);
ecore_evas_size_step_set(ee, steph, stepw);
ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_x_current_time_get());
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_x_current_time_get());
}
else
{
evas_engine_info_set(ee->evas, einfo);
ee->rotation = rotation;
ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_x_current_time_get());
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_x_current_time_get());
if (ee->func.fn_resize) ee->func.fn_resize(ee);
}
@ -1597,7 +1597,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ee->shaped = 0;
ee->alpha = alpha;
ecore_x_window_del(ee->prop.window);
ecore_evas_unregister(ee, ee->prop.window);
ecore_event_window_unregister(ee->prop.window);
if (ee->alpha)
{
if (ee->prop.override)
@ -1645,7 +1645,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
ecore_x_window_shape_mask_set(ee->prop.window, 0);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
if (ee->prop.borderless)
ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
if (ee->visible) ecore_x_window_show(ee->prop.window);
@ -1669,7 +1669,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ee->shaped = 0;
ee->alpha = alpha;
ecore_x_window_del(ee->prop.window);
ecore_evas_unregister(ee, ee->prop.window);
ecore_event_window_unregister(ee->prop.window);
if (ee->alpha)
{
if (ee->prop.override)
@ -1710,7 +1710,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
ecore_x_window_shape_mask_set(ee->prop.window, 0);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
if (ee->prop.borderless)
ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
if (ee->visible) ecore_x_window_show(ee->prop.window);
@ -1733,7 +1733,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ee->shaped = 0;
ee->alpha = alpha;
ecore_x_window_del(ee->prop.window);
ecore_evas_unregister(ee, ee->prop.window);
ecore_event_window_unregister(ee->prop.window);
if (ee->alpha)
{
if (ee->prop.override)
@ -1768,7 +1768,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
ecore_x_window_shape_mask_set(ee->prop.window, 0);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
if (ee->prop.borderless)
ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
if (ee->visible) ecore_x_window_show(ee->prop.window);
@ -2266,7 +2266,7 @@ _ecore_evas_x_shutdown(void)
ecore_idle_enterer_del(ecore_evas_idle_enterer);
ecore_evas_idle_enterer = NULL;
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
ecore_evas_event_shutdown();
ecore_event_evas_shutdown();
}
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
return _ecore_evas_init_count;
@ -2560,7 +2560,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent,
}
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
return ee;
#else
return NULL;
@ -2661,7 +2661,7 @@ ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window wi
{
*winp = win;
ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
ecore_evas_register(ee, win);
ecore_event_window_register(win, ee, ee->evas, _ecore_evas_mouse_move_process);
}
#else
#endif
@ -2739,7 +2739,7 @@ ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent,
}
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
# endif /* HAVE_ECORE_X_XCB */
return ee;
@ -2973,7 +2973,7 @@ ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent,
}
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
return ee;
#else
return NULL;
@ -3178,7 +3178,7 @@ ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent,
}
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);
ecore_evas_register(ee, ee->prop.window);
ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process);
return ee;
#else
return NULL;
@ -3279,7 +3279,7 @@ ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window
{
*winp = win;
ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
ecore_evas_register(ee, win);
ecore_event_window_register(win, ee, ee->evas, _ecore_evas_mouse_move_process);
}
#else
#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */

View File

@ -22,6 +22,8 @@
# endif
#endif
#include <Evas.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -46,7 +48,7 @@ EAPI extern int ECORE_EVENT_MOUSE_OUT;
#define ECORE_EVENT_LOCK_NUM 0x0100
#define ECORE_EVENT_LOCK_CAPS 0x0200
typedef unsigned int Ecore_Window;
typedef uintptr_t Ecore_Window;
typedef struct _Ecore_Event_Key Ecore_Event_Key;
struct _Ecore_Event_Key
@ -180,34 +182,32 @@ struct _Ecore_Event_Modifiers
unsigned int array[ECORE_LAST];
};
typedef void (*Ecore_Event_Mouse_Move_Cb)(void *window, int x, int y, unsigned int timestamp);
EAPI int ecore_event_init(void);
EAPI int ecore_event_shutdown(void);
EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
EAPI unsigned int ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
#ifdef _ECORE_EVAS_H
EAPI int ecore_event_evas_init(void);
EAPI int ecore_event_evas_shutdown(void);
EAPI int ecore_evas_event_init(void);
EAPI int ecore_evas_event_shutdown(void);
EAPI int ecore_event_evas_key_down(void *data, int type, void *event);
EAPI int ecore_event_evas_key_up(void *data, int type, void *event);
EAPI int ecore_event_evas_mouse_button_up(void *data, int type, void *event);
EAPI int ecore_event_evas_mouse_button_down(void *data, int type, void *event);
EAPI int ecore_event_evas_mouse_wheel(void *data, int type, void *event);
EAPI int ecore_event_evas_mouse_move(void *data, int type, void *event);
EAPI int ecore_event_evas_mouse_in(void *data, int type, void *event);
EAPI int ecore_event_evas_mouse_out(void *data, int type, void *event);
EAPI int ecore_evas_event_key_down(void *data, int type, void *event);
EAPI int ecore_evas_event_key_up(void *data, int type, void *event);
EAPI int ecore_evas_event_mouse_button_up(void *data, int type, void *event);
EAPI int ecore_evas_event_mouse_button_down(void *data, int type, void *event);
EAPI int ecore_evas_event_mouse_wheel(void *data, int type, void *event);
EAPI int ecore_evas_event_mouse_move(void *data, int type, void *event);
EAPI int ecore_evas_event_mouse_in(void *data, int type, void *event);
EAPI int ecore_evas_event_mouse_out(void *data, int type, void *event);
EAPI void ecore_event_window_register(Ecore_Window id, void *window, Evas *evas, Ecore_Event_Mouse_Move_Cb move_mouse);
EAPI void ecore_event_window_unregister(Ecore_Window id);
EAPI void* ecore_event_window_match(Ecore_Window id);
EAPI void ecore_event_window_ignore_events(Ecore_Window id, int ignore_event);
EAPI void ecore_evas_register(Ecore_Evas *ee, Ecore_Window window);
EAPI void ecore_evas_unregister(Ecore_Evas *ee, Ecore_Window window);
EAPI Ecore_Evas *ecore_evas_window_match(Ecore_Window window);
EAPI void ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp);
EAPI void ecore_evas_event_modifier_lock_update(Evas *e, unsigned int modifiers);
#endif
EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers);
#ifdef __cplusplus
}

View File

@ -1,52 +1,10 @@
MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_X
ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x
else
ECORE_X_INC =
endif
if BUILD_ECORE_FB
ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb
else
ECORE_FB_INC =
endif
if BUILD_ECORE_DIRECTFB
ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@
else
ECORE_DIRECTFB_INC =
endif
if BUILD_ECORE_WIN32
ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32
else
ECORE_WIN32_INC =
endif
if BUILD_ECORE_WINCE
ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince
else
ECORE_WINCE_INC =
endif
if BUILD_ECORE_SDL
ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@
else
ECORE_SDL_INC =
endif
AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_evas \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_evas \
$(ECORE_X_INC) \
$(ECORE_FB_INC) \
$(ECORE_DIRECTFB_INC) \
$(ECORE_WIN32_INC) \
$(ECORE_WINCE_INC) \
$(ECORE_SDL_INC) \
@EVAS_CFLAGS@
if BUILD_ECORE_INPUT

View File

@ -4,6 +4,18 @@
#include "Ecore.h"
#include "ecore_private.h"
#include "Ecore_Input.h"
#include "Evas.h"
#include <stdio.h>
typedef struct _Ecore_Input_Window Ecore_Input_Window;
struct _Ecore_Input_Window
{
Evas *evas;
void *window;
Ecore_Event_Mouse_Move_Cb move_mouse;
int ignore_event;
};
EAPI int ECORE_EVENT_KEY_DOWN = 0;
EAPI int ECORE_EVENT_KEY_UP = 0;
@ -19,35 +31,13 @@ static int _ecore_event_init_count = 0;
#ifdef BUILD_ECORE_EVAS
#include "ecore_evas_private.h"
static Ecore_Event_Handler *ecore_evas_event_handlers[8];
static Evas_Hash *_ecore_evases_hash = NULL;
static Ecore_Event_Handler *ecore_event_evas_handlers[8];
static Eina_Hash *_window_hash = NULL;
static int _ecore_evas_event_init_count = 0;
static const char*
_ecore_evas_winid_str_get(Ecore_Window window)
{
const char *vals = "qWeRtYuIoP5-$&<~";
static char id[9];
#define COMPUTE_ID(Result, Index, Source, Window) \
Result[Index] = Source[(Window >> (28 - Index * 4)) & 0xf];
COMPUTE_ID(id, 0, vals, window);
COMPUTE_ID(id, 1, vals, window);
COMPUTE_ID(id, 2, vals, window);
COMPUTE_ID(id, 3, vals, window);
COMPUTE_ID(id, 4, vals, window);
COMPUTE_ID(id, 5, vals, window);
COMPUTE_ID(id, 6, vals, window);
COMPUTE_ID(id, 7, vals, window);
id[8] = '\0';
return id;
}
static int _ecore_event_evas_init_count = 0;
EAPI void
ecore_evas_event_modifier_lock_update(Evas *e, unsigned int modifiers)
ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers)
{
if (modifiers & ECORE_EVENT_MODIFIER_SHIFT)
evas_key_modifier_on(e, "Shift");
@ -86,178 +76,178 @@ ecore_evas_event_modifier_lock_update(Evas *e, unsigned int modifiers)
}
EAPI void
ecore_evas_register(Ecore_Evas *ee, Ecore_Window window)
ecore_event_window_register(Ecore_Window id, void *window, Evas *evas, Ecore_Event_Mouse_Move_Cb move_mouse)
{
_ecore_evases_hash = evas_hash_add(_ecore_evases_hash, _ecore_evas_winid_str_get(window), ee);
Ecore_Input_Window *new;
evas_key_modifier_add(ee->evas, "Shift");
evas_key_modifier_add(ee->evas, "Control");
evas_key_modifier_add(ee->evas, "Alt");
evas_key_modifier_add(ee->evas, "Meta");
evas_key_modifier_add(ee->evas, "Hyper");
evas_key_modifier_add(ee->evas, "Super");
evas_key_lock_add(ee->evas, "Caps_Lock");
evas_key_lock_add(ee->evas, "Num_Lock");
evas_key_lock_add(ee->evas, "Scroll_Lock");
new = malloc(sizeof (Ecore_Input_Window));
if (!new) return ;
new->evas = evas;
new->window = window;
new->move_mouse = move_mouse;
new->ignore_event = 0;
eina_hash_add(_window_hash, &id, new);
evas_key_modifier_add(evas, "Shift");
evas_key_modifier_add(evas, "Control");
evas_key_modifier_add(evas, "Alt");
evas_key_modifier_add(evas, "Meta");
evas_key_modifier_add(evas, "Hyper");
evas_key_modifier_add(evas, "Super");
evas_key_lock_add(evas, "Caps_Lock");
evas_key_lock_add(evas, "Num_Lock");
evas_key_lock_add(evas, "Scroll_Lock");
}
EAPI void
ecore_evas_unregister(Ecore_Evas *ee, Ecore_Window window)
ecore_event_window_unregister(Ecore_Window id)
{
_ecore_evases_hash = evas_hash_del(_ecore_evases_hash, _ecore_evas_winid_str_get(window), ee);
eina_hash_del(_window_hash, &id, NULL);
}
EAPI Ecore_Evas*
ecore_evas_window_match(Ecore_Window window)
EAPI void*
ecore_event_window_match(Ecore_Window id)
{
return evas_hash_find(_ecore_evases_hash, _ecore_evas_winid_str_get(window));
Ecore_Input_Window *lookup;
lookup = eina_hash_find(_window_hash, &id);
if (lookup) return lookup->window;
return NULL;
}
EAPI void
ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
ecore_event_window_ignore_events(Ecore_Window id, int ignore_event)
{
ee->mouse.x = x;
ee->mouse.y = y;
if (ee->prop.cursor.object)
{
evas_object_show(ee->prop.cursor.object);
if (ee->rotation == 0)
evas_object_move(ee->prop.cursor.object,
x - ee->prop.cursor.hot.x,
y - ee->prop.cursor.hot.y);
else if (ee->rotation == 90)
evas_object_move(ee->prop.cursor.object,
ee->h - y - 1 - ee->prop.cursor.hot.x,
x - ee->prop.cursor.hot.y);
else if (ee->rotation == 180)
evas_object_move(ee->prop.cursor.object,
ee->w - x - 1 - ee->prop.cursor.hot.x,
ee->h - y - 1 - ee->prop.cursor.hot.y);
else if (ee->rotation == 270)
evas_object_move(ee->prop.cursor.object,
y - ee->prop.cursor.hot.x,
ee->w - x - 1 - ee->prop.cursor.hot.y);
}
if (ee->rotation == 0)
evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
else if (ee->rotation == 90)
evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
else if (ee->rotation == 180)
evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
else if (ee->rotation == 270)
evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
Ecore_Input_Window *lookup;
lookup = eina_hash_find(_window_hash, &id);
if (!lookup) return ;
lookup->ignore_event = ignore_event;
}
static Ecore_Input_Window*
_ecore_event_window_match(Ecore_Window id)
{
Ecore_Input_Window *lookup;
lookup = eina_hash_find(_window_hash, &id);
if (!lookup) return NULL;
if (lookup->ignore_event) return NULL; /* Pass on event. */
return lookup;
}
static int
_ecore_evas_event_key(Ecore_Event_Key *e, Ecore_Event_Press press)
_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
{
Ecore_Evas *ee;
Ecore_Input_Window *lookup;
ee = ecore_evas_window_match(e->window);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
lookup = _ecore_event_window_match(e->window);
if (!lookup) return 1;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (press == ECORE_DOWN)
evas_event_feed_key_down(ee->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
evas_event_feed_key_down(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
else
evas_event_feed_key_up(ee->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
evas_event_feed_key_up(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
return 1;
}
static int
_ecore_evas_event_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press)
_ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press)
{
Ecore_Evas *ee;
Ecore_Input_Window *lookup;
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
ee = ecore_evas_window_match(e->window);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
lookup = _ecore_event_window_match(e->window);
if (!lookup) return 1;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
if (press == ECORE_DOWN)
evas_event_feed_mouse_down(ee->evas, e->buttons, flags, e->timestamp, NULL);
evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, e->timestamp, NULL);
else
evas_event_feed_mouse_up(ee->evas, e->buttons, flags, e->timestamp, NULL);
evas_event_feed_mouse_up(lookup->evas, e->buttons, flags, e->timestamp, NULL);
return 1;
}
static int
_ecore_evas_event_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
_ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
{
Ecore_Evas *ee;
Ecore_Input_Window *lookup;
ee = ecore_evas_window_match(e->window);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
lookup = _ecore_event_window_match(e->window);
if (!lookup) return 1;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
switch (io)
{
case ECORE_IN:
evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL);
evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL);
break;
case ECORE_OUT:
evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL);
evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL);
break;
default:
break;
}
ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
return 1;
}
#endif
EAPI int
ecore_evas_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
return _ecore_evas_event_key((Ecore_Event_Key*) event, ECORE_DOWN);
return _ecore_event_evas_key((Ecore_Event_Key*) event, ECORE_DOWN);
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
return _ecore_evas_event_key((Ecore_Event_Key*) event, ECORE_UP);
return _ecore_event_evas_key((Ecore_Event_Key*) event, ECORE_UP);
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
return _ecore_evas_event_mouse_button((Ecore_Event_Mouse_Button*) event, ECORE_DOWN);
return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button*) event, ECORE_DOWN);
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
return _ecore_evas_event_mouse_button((Ecore_Event_Mouse_Button*) event, ECORE_UP);
return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button*) event, ECORE_UP);
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
Ecore_Event_Mouse_Wheel *e;
Ecore_Evas *ee;
Ecore_Input_Window *lookup;
e = event;
ee = ecore_evas_window_match(e->window);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->timestamp, NULL);
lookup = _ecore_event_window_match(e->window);
if (!lookup) return 1;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL);
return 1;
#else
@ -266,17 +256,17 @@ ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *e
}
EAPI int
ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
Ecore_Event_Mouse_Move *e;
Ecore_Evas *ee;
Ecore_Input_Window *lookup;
e = event;
ee = ecore_evas_window_match(e->window);
if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers);
ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
lookup = _ecore_event_window_match(e->window);
if (!lookup) return 1;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
return 1;
#else
return 0;
@ -284,81 +274,85 @@ ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *ev
}
EAPI int
ecore_evas_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
return _ecore_evas_event_mouse_io((Ecore_Event_Mouse_IO*) event, ECORE_IN);
return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO*) event, ECORE_IN);
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
ecore_event_evas_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
#ifdef BUILD_ECORE_EVAS
return _ecore_evas_event_mouse_io((Ecore_Event_Mouse_IO*) event, ECORE_OUT);
return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO*) event, ECORE_OUT);
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_init(void)
ecore_event_evas_init(void)
{
#ifdef BUILD_ECORE_EVAS
if (!_ecore_evas_event_init_count)
if (!_ecore_event_evas_init_count)
{
ecore_init();
ecore_event_init();
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
ecore_evas_event_key_down,
ecore_event_evas_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
ecore_event_evas_key_down,
NULL);
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
ecore_evas_event_key_up,
ecore_event_evas_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
ecore_event_evas_key_up,
NULL);
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
ecore_evas_event_mouse_button_down,
ecore_event_evas_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
ecore_event_evas_mouse_button_down,
NULL);
ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
ecore_evas_event_mouse_button_up,
ecore_event_evas_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
ecore_event_evas_mouse_button_up,
NULL);
ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
ecore_evas_event_mouse_move,
ecore_event_evas_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
ecore_event_evas_mouse_move,
NULL);
ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
ecore_evas_event_mouse_wheel,
ecore_event_evas_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
ecore_event_evas_mouse_wheel,
NULL);
ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
ecore_evas_event_mouse_in,
ecore_event_evas_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
ecore_event_evas_mouse_in,
NULL);
ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
ecore_evas_event_mouse_out,
ecore_event_evas_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
ecore_event_evas_mouse_out,
NULL);
_window_hash = eina_hash_pointer_new(free);
}
return ++_ecore_evas_event_init_count;
return ++_ecore_event_evas_init_count;
#else
return 0;
#endif
}
EAPI int
ecore_evas_event_shutdown(void)
ecore_event_evas_shutdown(void)
{
#ifdef BUILD_ECORE_EVAS
if (_ecore_evas_event_init_count == 1)
if (_ecore_event_evas_init_count == 1)
{
int i;
for (i = 0; i < sizeof(ecore_evas_event_handlers)/sizeof(Ecore_Event_Handler*); ++i)
for (i = 0; i < sizeof(ecore_event_evas_handlers)/sizeof(Ecore_Event_Handler*); ++i)
{
ecore_event_handler_del(ecore_evas_event_handlers[i]);
ecore_evas_event_handlers[i] = NULL;
ecore_event_handler_del(ecore_event_evas_handlers[i]);
ecore_event_evas_handlers[i] = NULL;
}
ecore_event_shutdown();
ecore_shutdown();
}
return --_ecore_evas_event_init_count;
return --_ecore_event_evas_init_count;
#else
return 0;
#endif