From f8646c4d9c453f8d7aeb0a7aad57be6219d97932 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Tue, 14 Apr 2009 20:04:16 +0000 Subject: [PATCH] use ecore_input for the windows xp code SVN revision: 40054 --- .../src/lib/ecore_evas/ecore_evas_buffer.c | 6 +- .../src/lib/ecore_evas/ecore_evas_directfb.c | 6 +- .../ecore/src/lib/ecore_evas/ecore_evas_fb.c | 8 +- .../src/lib/ecore_evas/ecore_evas_private.h | 1 - .../src/lib/ecore_evas/ecore_evas_quartz.c | 2 +- .../ecore/src/lib/ecore_evas/ecore_evas_sdl.c | 10 +- .../src/lib/ecore_evas/ecore_evas_win32.c | 322 ++++-------------- .../src/lib/ecore_evas/ecore_evas_wince.c | 9 +- .../ecore/src/lib/ecore_evas/ecore_evas_x.c | 10 +- .../ecore/src/lib/ecore_win32/Ecore_Win32.h | 71 ---- legacy/ecore/src/lib/ecore_win32/Makefile.am | 5 + .../ecore/src/lib/ecore_win32/ecore_win32.c | 22 +- .../src/lib/ecore_win32/ecore_win32_event.c | 207 +++++------ 13 files changed, 209 insertions(+), 470 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c index 3c6be1bdde..dd435696ca 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c @@ -2,12 +2,12 @@ # include #endif -#include "Ecore.h" -#include "Ecore_Evas.h" -#include "Ecore_Input.h" +#include +#include #include "ecore_private.h" #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER static int _ecore_evas_init_count = 0; diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c index 355abeb3f7..f92d6463a6 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c @@ -8,14 +8,14 @@ #include -#include "Ecore.h" -#include "Ecore_Evas.h" +#include #ifdef BUILD_ECORE_EVAS_DIRECTFB -#include "Ecore_DirectFB.h" +#include #endif #include "ecore_private.h" #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_DIRECTFB static int _ecore_evas_init_count = 0; diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c index 6c13ea59b3..cd574fd458 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c @@ -9,15 +9,15 @@ #include #include -#include "Ecore.h" -#include "Ecore_Evas.h" +#include #ifdef BUILD_ECORE_EVAS_FB -#include "Ecore_Fb.h" -#include "ecore_fb_private.h" +#include +#include #endif #include "ecore_private.h" #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_FB static int _ecore_evas_init_count = 0; diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_private.h b/legacy/ecore/src/lib/ecore_evas/ecore_evas_private.h index ef0a262dff..20708770ee 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_private.h +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_private.h @@ -204,7 +204,6 @@ struct _Ecore_Evas_Engine #ifdef BUILD_ECORE_EVAS_WIN32 struct { Ecore_Win32_Window *parent; - Ecore_Win32_Window *window; struct { unsigned char fullscreen : 1; } state; diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_quartz.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_quartz.c index 7fc03ac06b..07231f4364 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_quartz.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_quartz.c @@ -12,10 +12,10 @@ #include "Ecore.h" #include "Ecore_Input.h" -#include "Ecore_Evas.h" #include "ecore_private.h" #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_QUARTZ #include "Ecore_Quartz.h" diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c index 7b39e06769..40adc6b9b4 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c @@ -6,15 +6,15 @@ # include #endif -#include "Ecore.h" -#include "Ecore_Evas.h" -#include "Ecore_Input.h" +#include +#include #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL -#include "Ecore_Sdl.h" -#include "Evas_Engine_SDL.h" +#include +#include #endif #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c index 1679aa403d..5e530a1302 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c @@ -8,23 +8,22 @@ #include /* for NULL */ -#include "Ecore.h" +#include #ifdef BUILD_ECORE_EVAS_WIN32 # define WIN32_LEAN_AND_MEAN # include # undef WIN32_LEAN_AND_MEAN -# include "Ecore_Win32.h" -# include "ecore_win32_private.h" +# include +# include #endif /* BUILD_ECORE_EVAS_WIN32 */ -#include "Ecore_Evas.h" - #include "ecore_private.h" #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_WIN32 -#define ECORE_EVAS_EVENT_COUNT 14 +#define ECORE_EVAS_EVENT_COUNT 6 static int _ecore_evas_init_count = 0; static int _ecore_evas_fps_debug = 0; @@ -34,18 +33,6 @@ static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; static Ecore_Evas *ecore_evases = NULL; static Eina_Hash *ecore_evases_hash = NULL; -static int _ecore_evas_win32_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event); - -static int _ecore_evas_win32_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event); - -static int _ecore_evas_win32_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event); - -static int _ecore_evas_win32_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event); - -static int _ecore_evas_win32_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); - -static int _ecore_evas_win32_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); - static int _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); static int _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); @@ -145,20 +132,14 @@ _ecore_evas_win32_init(void) ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_win32_idle_enter, NULL); - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_KEY_DOWN, _ecore_evas_win32_event_key_down, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_KEY_UP, _ecore_evas_win32_event_key_up, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_win32_event_mouse_button_down, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, _ecore_evas_win32_event_mouse_button_up, NULL); - ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_WHEEL, _ecore_evas_win32_event_mouse_wheel, NULL); - ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_MOVE, _ecore_evas_win32_event_mouse_move, NULL); - ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL); - ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL); - ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL); - ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, _ecore_evas_win32_event_window_destroy, NULL); - ecore_evas_event_handlers[10] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_SHOW, _ecore_evas_win32_event_window_show, NULL); - ecore_evas_event_handlers[11] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_HIDE, _ecore_evas_win32_event_window_hide, NULL); - ecore_evas_event_handlers[12] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, _ecore_evas_win32_event_window_configure, NULL); - ecore_evas_event_handlers[13] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_win32_event_window_delete_request, NULL); + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, _ecore_evas_win32_event_window_destroy, NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_SHOW, _ecore_evas_win32_event_window_show, NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_HIDE, _ecore_evas_win32_event_window_hide, NULL); + ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, _ecore_evas_win32_event_window_configure, NULL); + ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_win32_event_window_delete_request, NULL); return _ecore_evas_init_count; } @@ -183,155 +164,6 @@ _ecore_evas_win32_shutdown(void) return _ecore_evas_init_count; } -static char * -_ecore_evas_win32_winid_str_get(Ecore_Win32_Window *window) -{ - static char id[9]; - const char *vals = "qWeRtYuIoP5-$&<~"; - unsigned int val; - - val = (unsigned int)window; - id[0] = vals[(val >> 28) & 0xf]; - id[1] = vals[(val >> 24) & 0xf]; - id[2] = vals[(val >> 20) & 0xf]; - id[3] = vals[(val >> 16) & 0xf]; - id[4] = vals[(val >> 12) & 0xf]; - id[5] = vals[(val >> 8) & 0xf]; - id[6] = vals[(val >> 4) & 0xf]; - id[7] = vals[(val ) & 0xf]; - id[8] = 0; - - return id; -} - -static Ecore_Evas * -_ecore_evas_win32_match(Ecore_Win32_Window *window) -{ - Ecore_Evas *ee; - - ee = eina_hash_find(ecore_evases_hash, _ecore_evas_win32_winid_str_get(window)); - - return ee; -} - -static int -_ecore_evas_win32_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Win32_Event_Key_Down *e; - - e = event; - ee = _ecore_evas_win32_match(e->window); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - /* FIXME to do */ -/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - evas_event_feed_key_down(ee->evas, e->keyname, e->keysymbol, e->keycompose, NULL, e->time, NULL); - - return 1; -} - -static int -_ecore_evas_win32_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Win32_Event_Key_Up *e; - - e = event; - ee = _ecore_evas_win32_match(e->window); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - /* FIXME to do */ -/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - evas_event_feed_key_up(ee->evas, e->keyname, e->keysymbol, e->keycompose, NULL, e->time, NULL); - - return 1; -} - -static int -_ecore_evas_win32_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Win32_Event_Mouse_Button_Down *e; - Evas_Button_Flags flags = EVAS_BUTTON_NONE; - - EINA_ERROR_PINFO("mouse button down\n"); - - e = event; - ee = _ecore_evas_win32_match(e->window); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; - /* FIXME to do */ -/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; - if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; - evas_event_feed_mouse_down(ee->evas, e->button, flags, e->time, NULL); - - EINA_ERROR_PINFO("mouse button down (%f %dx%d)\n", e->time, e->x, e->y); - - return 1; -} - -static int -_ecore_evas_win32_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Win32_Event_Mouse_Button_Up *e; - Evas_Button_Flags flags = EVAS_BUTTON_NONE; - - EINA_ERROR_PINFO("mouse button up\n"); - - e = event; - ee = _ecore_evas_win32_match(e->window); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; - /* FIXME to do */ -/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; - if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; - evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL); - - EINA_ERROR_PINFO("mouse button up (%f %dx%d)\n", e->time, e->x, e->y); - - return 1; -} - -static int -_ecore_evas_win32_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Win32_Event_Mouse_Wheel *e; - - EINA_ERROR_PINFO("mouse wheel\n"); - - e = event; - ee = _ecore_evas_win32_match(e->window); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; - /* FIXME to do */ -/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL); - - return 1; -} - -static int -_ecore_evas_win32_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Win32_Event_Mouse_Move *e; - - EINA_ERROR_PINFO("mouse move\n"); - - e = event; - ee = _ecore_evas_win32_match(e->window); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; - /* FIXME to do */ -/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - - return 1; -} - static int _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) { @@ -341,9 +173,9 @@ _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi EINA_ERROR_PINFO("mouse in\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); /* FIXME to do */ @@ -363,9 +195,9 @@ _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo EINA_ERROR_PINFO("mouse out\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; /* FIXME to do */ /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ @@ -387,9 +219,9 @@ _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__ EINA_ERROR_PINFO("window damage\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if (!ee) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if (ee->prop.avoid_damage) { @@ -439,9 +271,9 @@ _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED_ EINA_ERROR_PINFO("window destroy\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if (!ee) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if (ee->func.fn_destroy) ee->func.fn_destroy(ee); ecore_evas_free(ee); @@ -457,9 +289,9 @@ _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, EINA_ERROR_PINFO("window show\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if (!ee) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if (ee->visible) return 0; /* dont pass it on */ ee->visible = 1; if (ee->func.fn_show) ee->func.fn_show(ee); @@ -476,9 +308,9 @@ _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, EINA_ERROR_PINFO("window hide\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if (!ee) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if (!ee->visible) return 0; /* dont pass it on */ ee->visible = 0; if (ee->func.fn_hide) ee->func.fn_hide(ee); @@ -495,9 +327,9 @@ _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSE EINA_ERROR_PINFO("window configure\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if (!ee) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if ((ee->x != e->x) || (ee->y != e->y)) { @@ -553,9 +385,9 @@ _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __ EINA_ERROR_PINFO("window delete request\n"); e = event; - ee = _ecore_evas_win32_match(e->window); + ee = ecore_event_window_match(e->window); if (!ee) return 1; /* pass on event */ - if (e->window != ee->engine.win32.window) return 1; + if (e->window != ee->prop.window) return 1; if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); printf (" * ee event delete\n"); @@ -570,8 +402,8 @@ _ecore_evas_win32_free(Ecore_Evas *ee) { EINA_ERROR_PINFO("ecore evas free\n"); - ecore_win32_window_free(ee->engine.win32.window); - eina_hash_del(ecore_evases_hash, _ecore_evas_win32_winid_str_get(ee->engine.win32.window), ee); + ecore_win32_window_free(ee->prop.window); + ecore_event_window_unregister(ee->prop.window); ecore_evases = _ecore_list2_remove(ecore_evases, ee); _ecore_evas_win32_shutdown(); ecore_win32_shutdown(); @@ -593,7 +425,7 @@ _ecore_evas_win32_move(Ecore_Evas *ee, int x, int y) { ee->x = x; ee->y = y; - ecore_win32_window_move(ee->engine.win32.window, x, y); + ecore_win32_window_move(ee->prop.window, x, y); if (ee->func.fn_move) ee->func.fn_move(ee); } } @@ -607,7 +439,7 @@ _ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height) { ee->w = width; ee->h = height; - ecore_win32_window_resize(ee->engine.win32.window, width, height); + ecore_win32_window_resize(ee->prop.window, width, height); if ((ee->rotation == 90) || (ee->rotation == 270)) { evas_output_size_set(ee->evas, ee->h, ee->w); @@ -641,7 +473,7 @@ _ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int heigh ee->y = y; ee->w = width; ee->h = height; - ecore_win32_window_move_resize(ee->engine.win32.window, x, y, width, height); + ecore_win32_window_move_resize(ee->prop.window, x, y, width, height); if ((ee->rotation == 90) || (ee->rotation == 270)) { evas_output_size_set(ee->evas, ee->h, ee->w); @@ -690,7 +522,7 @@ _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation) evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); if (!ee->prop.fullscreen) { - ecore_win32_window_resize(ee->engine.win32.window, ee->h, ee->w); + ecore_win32_window_resize(ee->prop.window, ee->h, ee->w); ee->expecting_resize.w = ee->h; ee->expecting_resize.h = ee->w; } @@ -698,8 +530,8 @@ _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation) { int w, h; - ecore_win32_window_size_get(ee->engine.win32.window, &w, &h); - ecore_win32_window_resize(ee->engine.win32.window, h, w); + ecore_win32_window_size_get(ee->prop.window, &w, &h); + ecore_win32_window_resize(ee->prop.window, h, w); if ((rotation == 0) || (rotation == 180)) { evas_output_size_set(ee->evas, ee->w, ee->h); @@ -749,9 +581,9 @@ _ecore_evas_win32_show(Ecore_Evas *ee) ee->should_be_visible = 1; if (ee->prop.avoid_damage) _ecore_evas_win32_render(ee); - ecore_win32_window_show(ee->engine.win32.window); + ecore_win32_window_show(ee->prop.window); /* if (ee->prop.fullscreen) */ -/* ecore_win32_window_focus(ee->engine.win32.window); */ +/* ecore_win32_window_focus(ee->prop.window); */ } static void @@ -759,7 +591,7 @@ _ecore_evas_win32_hide(Ecore_Evas *ee) { EINA_ERROR_PINFO("ecore evas hide\n"); - ecore_win32_window_hide(ee->engine.win32.window); + ecore_win32_window_hide(ee->prop.window); ee->should_be_visible = 0; } @@ -769,9 +601,9 @@ _ecore_evas_win32_raise(Ecore_Evas *ee) EINA_ERROR_PINFO("ecore evas raise\n"); if (!ee->prop.fullscreen) - ecore_win32_window_raise(ee->engine.win32.window); + ecore_win32_window_raise(ee->prop.window); else - ecore_win32_window_raise(ee->engine.win32.window); + ecore_win32_window_raise(ee->prop.window); } static void @@ -780,9 +612,9 @@ _ecore_evas_win32_lower(Ecore_Evas *ee) EINA_ERROR_PINFO("ecore evas lower\n"); if (!ee->prop.fullscreen) - ecore_win32_window_lower(ee->engine.win32.window); + ecore_win32_window_lower(ee->prop.window); else - ecore_win32_window_lower(ee->engine.win32.window); + ecore_win32_window_lower(ee->prop.window); } static void @@ -790,7 +622,7 @@ _ecore_evas_win32_activate(Ecore_Evas *ee) { EINA_ERROR_PINFO("ecore evas activate\n"); - ecore_win32_window_focus_set(ee->engine.win32.window); + ecore_win32_window_focus_set(ee->prop.window); } static void @@ -801,7 +633,7 @@ _ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title) if (ee->prop.title) free(ee->prop.title); ee->prop.title = NULL; if (title) ee->prop.title = strdup(title); - ecore_win32_window_title_set(ee->engine.win32.window, ee->prop.title); + ecore_win32_window_title_set(ee->prop.window, ee->prop.title); } static void @@ -812,7 +644,7 @@ _ecore_evas_win32_size_min_set(Ecore_Evas *ee, int width, int height) if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; ee->prop.min.w = width; ee->prop.min.h = height; - ecore_win32_window_size_min_set(ee->engine.win32.window, width, height); + ecore_win32_window_size_min_set(ee->prop.window, width, height); } static void @@ -823,7 +655,7 @@ _ecore_evas_win32_size_max_set(Ecore_Evas *ee, int width, int height) if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; ee->prop.max.w = width; ee->prop.max.h = height; - ecore_win32_window_size_max_set(ee->engine.win32.window, width, height); + ecore_win32_window_size_max_set(ee->prop.window, width, height); } static void @@ -834,7 +666,7 @@ _ecore_evas_win32_size_base_set(Ecore_Evas *ee, int width, int height) if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; ee->prop.base.w = width; ee->prop.base.h = height; - ecore_win32_window_size_base_set(ee->engine.win32.window, width, height); + ecore_win32_window_size_base_set(ee->prop.window, width, height); } static void @@ -845,7 +677,7 @@ _ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height) if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; ee->prop.step.w = width; ee->prop.step.h = height; - ecore_win32_window_size_step_set(ee->engine.win32.window, width, height); + ecore_win32_window_size_step_set(ee->prop.window, width, height); } static void @@ -862,7 +694,7 @@ _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - ecore_win32_window_cursor_show(ee->engine.win32.window, 1); + ecore_win32_window_cursor_show(ee->prop.window, 1); return; } @@ -871,7 +703,7 @@ _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - ecore_win32_window_cursor_show(ee->engine.win32.window, 0); + ecore_win32_window_cursor_show(ee->prop.window, 0); evas_pointer_output_xy_get(ee->evas, &x, &y); evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); @@ -887,7 +719,7 @@ _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho static void _ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__) { - ecore_win32_window_focus_set(ee->engine.win32.window); + ecore_win32_window_focus_set(ee->prop.window); } static void @@ -896,7 +728,7 @@ _ecore_evas_win32_iconified_set(Ecore_Evas *ee, int on) /* if (((ee->prop.borderless) && (on)) || */ /* ((!ee->prop.borderless) && (!on))) return; */ ee->prop.iconified = on; - ecore_win32_window_iconified_set(ee->engine.win32.window, ee->prop.iconified); + ecore_win32_window_iconified_set(ee->prop.window, ee->prop.iconified); } static void @@ -905,7 +737,7 @@ _ecore_evas_win32_borderless_set(Ecore_Evas *ee, int on) if (((ee->prop.borderless) && (on)) || ((!ee->prop.borderless) && (!on))) return; ee->prop.borderless = on; - ecore_win32_window_borderless_set(ee->engine.win32.window, ee->prop.borderless); + ecore_win32_window_borderless_set(ee->prop.window, ee->prop.borderless); } static void @@ -922,12 +754,12 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) ee->engine.win32.state.fullscreen = on; ee->prop.fullscreen = on; - window = (struct _Ecore_Win32_Window *)ee->engine.win32.window; + window = (struct _Ecore_Win32_Window *)ee->prop.window; if (on != 0) { - ecore_win32_window_shape_set(ee->engine.win32.window, 0, 0, NULL); - ecore_win32_window_fullscreen_set(ee->engine.win32.window, on); + ecore_win32_window_shape_set(ee->prop.window, 0, 0, NULL); + ecore_win32_window_fullscreen_set(ee->prop.window, on); } else { @@ -970,12 +802,6 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) } -static void * -_ecore_evas_win32_window_get(const Ecore_Evas *ee) -{ - return ee->engine.win32.window; -} - static const Ecore_Evas_Engine_Func _ecore_win32_engine_func = { _ecore_evas_win32_free, @@ -1022,8 +848,7 @@ static const Ecore_Evas_Engine_Func _ecore_win32_engine_func = NULL, /* _ecore_evas_x_withdrawn_set */ NULL, /* _ecore_evas_x_sticky_set */ NULL, /* _ecore_evas_x_ignore_events_set */ - NULL, /* _ecore_evas_x_alpha_set */ - _ecore_evas_win32_window_get + NULL /* _ecore_evas_x_alpha_set */ }; #endif /* BUILD_ECORE_EVAS_WIN32 */ @@ -1051,7 +876,7 @@ _ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee) if (einfo) { /* FIXME: REDRAW_DEBUG missing for now */ - einfo->info.window = ((struct _Ecore_Win32_Window *)ee->engine.win32.window)->window; + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; einfo->info.depth = ecore_win32_screen_depth_get(); einfo->info.rotation = 0; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -1082,7 +907,7 @@ _ecore_evas_engine_direct3d_init(Ecore_Evas *ee) if (einfo) { /* FIXME: REDRAW_DEBUG missing for now */ - einfo->info.window = ((struct _Ecore_Win32_Window *)ee->engine.win32.window)->window; + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; einfo->info.depth = ecore_win32_screen_depth_get(); einfo->info.rotation = 0; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -1113,7 +938,7 @@ _ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee) if (einfo) { /* FIXME: REDRAW_DEBUG missing for now */ - einfo->info.window = ((struct _Ecore_Win32_Window *)ee->engine.win32.window)->window; + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; einfo->info.depth = ecore_win32_screen_depth_get(); evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } @@ -1146,7 +971,7 @@ _ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee) if (einfo) { /* FIXME: REDRAW_DEBUG missing for now */ - einfo->info.window = ((struct _Ecore_Win32_Window *)ee->engine.win32.window)->window; + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; einfo->info.depth = ecore_win32_screen_depth_get(); einfo->info.rotation = 0; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -1193,6 +1018,7 @@ _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), ee->prop.request_pos = 0; ee->prop.sticky = 0; /* FIXME: sticky to add */ + ee->prop.window = 0; /* init evas here */ ee->evas = evas_new(); @@ -1201,8 +1027,8 @@ _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), evas_output_viewport_set(ee->evas, 0, 0, width, height); ee->engine.win32.parent = parent; - ee->engine.win32.window = ecore_win32_window_new(parent, x, y, width, height); - if (!ee->engine.win32.window) + ee->prop.window = ecore_win32_window_new(parent, x, y, width, height); + if (!ee->prop.window) { _ecore_evas_win32_shutdown(); free(ee); @@ -1216,20 +1042,8 @@ _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), return NULL; } - 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"); - ecore_evases = _ecore_list2_prepend(ecore_evases, ee); - if (!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_win32_winid_str_get(ee->engine.win32.window), ee); + ecore_event_window_register(ee->prop.window, ee, ee->evas, _ecore_evas_mouse_move_process); return ee; } @@ -1369,7 +1183,7 @@ ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__, EAPI Ecore_Win32_Window * ecore_evas_win32_window_get(const Ecore_Evas *ee) { - return (Ecore_Win32_Window *) _ecore_evas_win32_window_get(ee); + return (Ecore_Win32_Window *) ecore_evas_window_get(ee); } #else diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c index 8462f0ba3b..eb217c751d 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c @@ -8,19 +8,18 @@ #include /* for NULL */ -#include "Ecore.h" +#include #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE # define WIN32_LEAN_AND_MEAN # include # undef WIN32_LEAN_AND_MEAN -# include "Ecore_WinCE.h" -# include "ecore_wince_private.h" +# include +# include #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ -#include "Ecore_Evas.h" - #include "ecore_private.h" #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c index 3422fb6b68..0462e4cb5a 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c @@ -8,15 +8,15 @@ #include -#include "Ecore.h" -#include "Ecore_Evas.h" -#include "Ecore_Input.h" +#include +#include #ifdef BUILD_ECORE_EVAS_X11 -# include "Ecore_X.h" -# include "Ecore_X_Atoms.h" +# include +# include #endif #include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_X11 static int _ecore_evas_init_count = 0; diff --git a/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h b/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h index 9e6182c345..eef0f27faf 100644 --- a/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h +++ b/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h @@ -121,14 +121,8 @@ typedef enum /* Events */ -typedef struct _Ecore_Win32_Event_Key_Down Ecore_Win32_Event_Key_Down; -typedef struct _Ecore_Win32_Event_Key_Up Ecore_Win32_Event_Key_Up; -typedef struct _Ecore_Win32_Event_Mouse_Button_Down Ecore_Win32_Event_Mouse_Button_Down; -typedef struct _Ecore_Win32_Event_Mouse_Button_Up Ecore_Win32_Event_Mouse_Button_Up; -typedef struct _Ecore_Win32_Event_Mouse_Move Ecore_Win32_Event_Mouse_Move; typedef struct _Ecore_Win32_Event_Mouse_In Ecore_Win32_Event_Mouse_In; typedef struct _Ecore_Win32_Event_Mouse_Out Ecore_Win32_Event_Mouse_Out; -typedef struct _Ecore_Win32_Event_Mouse_Wheel Ecore_Win32_Event_Mouse_Wheel; typedef struct _Ecore_Win32_Event_Window_Focus_In Ecore_Win32_Event_Window_Focus_In; typedef struct _Ecore_Win32_Event_Window_Focus_Out Ecore_Win32_Event_Window_Focus_Out; typedef struct _Ecore_Win32_Event_Window_Damage Ecore_Win32_Event_Window_Damage; @@ -140,54 +134,6 @@ typedef struct _Ecore_Win32_Event_Window_Configure Ecore_Win32_Event_Window typedef struct _Ecore_Win32_Event_Window_Resize Ecore_Win32_Event_Window_Resize; typedef struct _Ecore_Win32_Event_Window_Delete_Request Ecore_Win32_Event_Window_Delete_Request; -struct _Ecore_Win32_Event_Key_Down -{ - Ecore_Win32_Window *window; - char *keyname; - char *keysymbol; - char *keycompose; - double time; -}; - -struct _Ecore_Win32_Event_Key_Up -{ - Ecore_Win32_Window *window; - char *keyname; - char *keysymbol; - char *keycompose; - double time; -}; - -struct _Ecore_Win32_Event_Mouse_Button_Down -{ - Ecore_Win32_Window *window; - int button; - int x; - int y; - double time; - unsigned int double_click : 1; - unsigned int triple_click : 1; -}; - -struct _Ecore_Win32_Event_Mouse_Button_Up -{ - Ecore_Win32_Window *window; - int button; - int x; - int y; - double time; - unsigned int double_click : 1; - unsigned int triple_click : 1; -}; - -struct _Ecore_Win32_Event_Mouse_Move -{ - Ecore_Win32_Window *window; - int x; - int y; - double time; -}; - struct _Ecore_Win32_Event_Mouse_In { Ecore_Win32_Window *window; @@ -204,17 +150,6 @@ struct _Ecore_Win32_Event_Mouse_Out double time; }; -struct _Ecore_Win32_Event_Mouse_Wheel -{ - Ecore_Win32_Window *window; - int direction; /* 0 = default up/down wheel FIXME: more wheel types */ - int z; /* ...,-2,-1 = down, 1,2,... = up */ - int modifiers; - int x; - int y; - double time; -}; - struct _Ecore_Win32_Event_Window_Focus_In { Ecore_Win32_Window *window; @@ -294,14 +229,8 @@ struct _Ecore_Win32_Event_Window_Delete_Request typedef int (*Ecore_Win32_Dnd_DropTarget_Callback)(void *window, int event, int pt_x, int pt_y, void *data, int size); -EAPI extern int ECORE_WIN32_EVENT_KEY_DOWN; -EAPI extern int ECORE_WIN32_EVENT_KEY_UP; -EAPI extern int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN; -EAPI extern int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP; -EAPI extern int ECORE_WIN32_EVENT_MOUSE_MOVE; EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN; EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT; -EAPI extern int ECORE_WIN32_EVENT_MOUSE_WHEEL; EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN; EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT; EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE; diff --git a/legacy/ecore/src/lib/ecore_win32/Makefile.am b/legacy/ecore/src/lib/ecore_win32/Makefile.am index 234932ac6c..bb1856187e 100644 --- a/legacy/ecore/src/lib/ecore_win32/Makefile.am +++ b/legacy/ecore/src/lib/ecore_win32/Makefile.am @@ -2,8 +2,11 @@ MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ -I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ @EFL_ECORE_WIN32_BUILD@ \ +@EVAS_CFLAGS@ \ @EINA_CFLAGS@ @@ -29,6 +32,8 @@ libecore_win32_la_LIBADD = \ @ecore_win32_libs@ \ @WIN32_LIBS@ \ $(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EVAS_LIBS@ \ @EINA_LIBS@ libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32.c index 5416918abc..cc3ce6c0d8 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32.c @@ -15,8 +15,9 @@ #include #include +#include +#include -#include "Ecore.h" #include "Ecore_Win32.h" #include "ecore_win32_private.h" @@ -39,14 +40,8 @@ double _ecore_win32_double_click_time = 0.25; double _ecore_win32_event_last_time = 0.0; Ecore_Win32_Window *_ecore_win32_event_last_window = NULL; -int ECORE_WIN32_EVENT_KEY_DOWN = 0; -int ECORE_WIN32_EVENT_KEY_UP = 0; -int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = 0; -int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = 0; -int ECORE_WIN32_EVENT_MOUSE_MOVE = 0; int ECORE_WIN32_EVENT_MOUSE_IN = 0; int ECORE_WIN32_EVENT_MOUSE_OUT = 0; -int ECORE_WIN32_EVENT_MOUSE_WHEEL = 0; int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0; int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0; int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0; @@ -128,16 +123,10 @@ ecore_win32_init() return 0; } - if (!ECORE_WIN32_EVENT_KEY_DOWN) + if (!ECORE_WIN32_EVENT_MOUSE_IN) { - ECORE_WIN32_EVENT_KEY_DOWN = ecore_event_type_new(); - ECORE_WIN32_EVENT_KEY_UP = ecore_event_type_new(); - ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); - ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); - ECORE_WIN32_EVENT_MOUSE_MOVE = ecore_event_type_new(); ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new(); ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new(); - ECORE_WIN32_EVENT_MOUSE_WHEEL = ecore_event_type_new(); ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); @@ -150,6 +139,8 @@ ecore_win32_init() ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); } + ecore_event_init(); + _ecore_win32_init_count++; return _ecore_win32_init_count; @@ -162,7 +153,8 @@ ecore_win32_shutdown() _ecore_win32_init_count--; if (_ecore_win32_init_count > 0) return _ecore_win32_init_count; - if (!_ecore_win32_instance) return _ecore_win32_init_count; + + ecore_event_shutdown(); ecore_win32_dnd_shutdown(); if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance)) diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c index 10a38bd509..925f7132b7 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c @@ -15,8 +15,9 @@ #include #include +#include +#include -#include "Ecore.h" #include "Ecore_Win32.h" #include "ecore_win32_private.h" @@ -54,19 +55,19 @@ void _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke) { - Ecore_Win32_Event_Key_Down *e; + Ecore_Event_Key *e; EINA_ERROR_PINFO("key pressed\n"); - e = (Ecore_Win32_Event_Key_Down *)malloc(sizeof(Ecore_Win32_Event_Key_Down)); + e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key)); if (!e) return; if (is_keystroke) { if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), - &e->keyname, - &e->keysymbol, - &e->keycompose)) + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) { free(e); return; @@ -76,9 +77,9 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, else { if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), - &e->keyname, - &e->keysymbol, - &e->keycompose)) + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) { free(e); return; @@ -86,36 +87,36 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, } store_key: - e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); if (!e->window) { free(e); return; } - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; + _ecore_win32_event_last_time = e->timestamp; - ecore_event_add(ECORE_WIN32_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL); + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL); } void _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, int is_keystroke) { - Ecore_Win32_Event_Key_Up *e; + Ecore_Event_Key *e; EINA_ERROR_PINFO("key released\n"); - e = (Ecore_Win32_Event_Key_Up *)calloc(1, sizeof(Ecore_Win32_Event_Key_Up)); + e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); if (!e) return; if (is_keystroke) { if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), - &e->keyname, - &e->keysymbol, - &e->keycompose)) + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) { free(e); return; @@ -125,9 +126,9 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, else { if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), - &e->keyname, - &e->keysymbol, - &e->keycompose)) + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) { free(e); return; @@ -135,17 +136,17 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, } store_key: - e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); if (!e->window) { free(e); return; } - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; + _ecore_win32_event_last_time = e->timestamp; - ecore_event_add(ECORE_WIN32_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL); + ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL); } void @@ -156,49 +157,49 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, EINA_ERROR_PINFO("mouse button pressed\n"); - window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + window = (Ecore_Win32_Window *)GetWindowLong(msg->window, GWL_USERDATA); if (button > 3) { - Ecore_Win32_Event_Mouse_Wheel *e; + Ecore_Event_Mouse_Wheel *e; - e = (Ecore_Win32_Event_Mouse_Wheel *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Wheel)); + e = (Ecore_Event_Mouse_Wheel *)calloc(1, sizeof(Ecore_Event_Mouse_Wheel)); if (!e) return; - e->window = window; + e->window = (Ecore_Window)window; e->direction = 0; /* wheel delta is positive or negative, never 0 */ e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_WHEEL, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); } else { { - Ecore_Win32_Event_Mouse_Move *e; + Ecore_Event_Mouse_Move *e; - e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move)); + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = window; + e->window = (Ecore_Window)window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); } { - Ecore_Win32_Event_Mouse_Button_Down *e; + Ecore_Event_Mouse_Button *e; if (_ecore_win32_mouse_down_did_triple) { @@ -208,22 +209,22 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, _ecore_win32_mouse_down_last_last_time = 0.0; } - e = (Ecore_Win32_Event_Mouse_Button_Down *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Button_Down)); + e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); if (!e) return; - e->window = window; - e->button = button; + e->window = (Ecore_Window)window; + e->buttons = button; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - if (((e->time - _ecore_win32_mouse_down_last_time) <= _ecore_win32_double_click_time) && - (e->window == _ecore_win32_mouse_down_last_window)) + if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= _ecore_win32_double_click_time) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) e->double_click = 1; - if (((e->time - _ecore_win32_mouse_down_last_last_time) <= (2.0 * _ecore_win32_double_click_time)) && - (e->window == _ecore_win32_mouse_down_last_window) && - (e->window == _ecore_win32_mouse_down_last_last_window)) + if (((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (2.0 * _ecore_win32_double_click_time)) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window)) { e->triple_click = 1; _ecore_win32_mouse_down_did_triple = 1; @@ -234,25 +235,25 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, if (!e->double_click && !e->triple_click) _ecore_win32_mouse_up_count = 0; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; if (!_ecore_win32_mouse_down_did_triple) { _ecore_win32_mouse_down_last_last_window = _ecore_win32_mouse_down_last_window; - _ecore_win32_mouse_down_last_window = e->window; + _ecore_win32_mouse_down_last_window = (Ecore_Win32_Window *)e->window; _ecore_win32_mouse_down_last_last_time = _ecore_win32_mouse_down_last_time; - _ecore_win32_mouse_down_last_time = e->time; + _ecore_win32_mouse_down_last_time = e->timestamp; } - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); } } } void _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, - int button) + int button) { Ecore_Win32_Window *window; @@ -261,92 +262,92 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, window = (void *)GetWindowLong(msg->window, GWL_USERDATA); { - Ecore_Win32_Event_Mouse_Move *e; + Ecore_Event_Mouse_Move *e; - e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move)); + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = window; + e->window = (Ecore_Window)window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); } { - Ecore_Win32_Event_Mouse_Button_Up *e; + Ecore_Event_Mouse_Button *e; - e = (Ecore_Win32_Event_Mouse_Button_Up *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Button_Up)); + e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); if (!e) return; - e->window = window; - e->button = button; + e->window = (Ecore_Window)window; + e->buttons = button; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; _ecore_win32_mouse_up_count++; if ((_ecore_win32_mouse_up_count >= 2) && - ((e->time - _ecore_win32_mouse_down_last_time) <= _ecore_win32_double_click_time) && - (e->window == _ecore_win32_mouse_down_last_window)) + ((e->timestamp - _ecore_win32_mouse_down_last_time) <= _ecore_win32_double_click_time) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) e->double_click = 1; if ((_ecore_win32_mouse_up_count >= 3) && - ((e->time - _ecore_win32_mouse_down_last_last_time) <= (2.0 * _ecore_win32_double_click_time)) && - (e->window == _ecore_win32_mouse_down_last_window) && - (e->window == _ecore_win32_mouse_down_last_last_window)) + ((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (2.0 * _ecore_win32_double_click_time)) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window)) e->triple_click = 1; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); } } void _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) { - Ecore_Win32_Event_Mouse_Move *e; + Ecore_Event_Mouse_Move *e; EINA_ERROR_PINFO("mouse moved\n"); - e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move)); + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); } void _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) { { - Ecore_Win32_Event_Mouse_Move *e; + Ecore_Event_Mouse_Move *e; EINA_ERROR_PINFO("mouse in\n"); - e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move)); + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); e->x = msg->x; e->y = msg->y; - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); } { @@ -370,22 +371,22 @@ void _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) { { - Ecore_Win32_Event_Mouse_Move *e; + Ecore_Event_Mouse_Move *e; EINA_ERROR_PINFO("mouse out\n"); - e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move)); + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); e->x = msg->x; e->y = msg->y; - e->time = (double)msg->time / 1000.0; + e->timestamp = (double)msg->time / 1000.0; - _ecore_win32_event_last_time = e->time; - _ecore_win32_event_last_window = e->window; + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; - ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); } { @@ -608,12 +609,12 @@ static void _ecore_win32_event_free_key_down(void *data, void *ev) { - Ecore_Win32_Event_Key_Down *e; + Ecore_Event_Key *e; e = ev; - if (e->keyname) free(e->keyname); - if (e->keysymbol) free(e->keysymbol); - if (e->keycompose) free(e->keycompose); + if (e->keyname) free((char *)e->keyname); + if (e->key) free((char *)e->key); + if (e->string) free((char *)e->string); free(e); } @@ -621,12 +622,12 @@ static void _ecore_win32_event_free_key_up(void *data, void *ev) { - Ecore_Win32_Event_Key_Up *e; + Ecore_Event_Key *e; e = ev; - if (e->keyname) free(e->keyname); - if (e->keysymbol) free(e->keysymbol); - if (e->keycompose) free(e->keycompose); + if (e->keyname) free((char *)e->keyname); + if (e->key) free((char *)e->key); + if (e->string) free((char *)e->string); free(e); }