diff --git a/legacy/ecore/Makefile.am b/legacy/ecore/Makefile.am index c14c7981d0..5d81a31a6a 100644 --- a/legacy/ecore/Makefile.am +++ b/legacy/ecore/Makefile.am @@ -24,6 +24,8 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \ ecore-x.pc \ ecore-win32.pc \ ecore-sdl.pc \ + ecore-input.pc.in \ + ecore-input.pc \ ecore-quartz.pc \ ecore-wince.pc \ ecore.pc \ @@ -104,7 +106,7 @@ ptxt = ecore-txt.pc endif if BUILD_ECORE_X -px = ecore-x.pc +px = ecore-x.pc ecore-input.pc endif if BUILD_ECORE_WIN32 @@ -116,7 +118,7 @@ pwince = ecore-wince.pc endif if BUILD_ECORE_SDL -psdl = ecore-sdl.pc +psdl = ecore-sdl.pc ecore-input.pc endif if BUILD_ECORE_QUARTZ diff --git a/legacy/ecore/configure.ac b/legacy/ecore/configure.ac index af77653044..e84baf2589 100644 --- a/legacy/ecore/configure.ac +++ b/legacy/ecore/configure.ac @@ -135,6 +135,7 @@ requirements_ecore="" requirements_ecore_con="" requirements_ecore_config="" requirements_ecore_directfb="" +requirements_ecore_input="" requirements_ecore_evas="" requirements_ecore_fb="" requirements_ecore_file="" @@ -291,6 +292,11 @@ requirements_ecore_x="ecore eina-0 ${requirements_ecore_x}" requirements_ecore_win32="ecore eina-0 ${requirements_ecore_win32}" requirements_ecore_wince="ecore eina-0 ${requirements_ecore_wince}" +dnl ecore_input +ECORE_CHECK_MODULE([Input], [yes]) +requirements_ecore_evas="ecore-input ${requirements_ecore_evas}" +requirements_ecore_sdl="ecore-input ${requirements_ecore_sdl}" +requirements_ecore_x="ecore-input ${requirements_ecore_x}" # iconv library (ecore_txt) @@ -934,6 +940,7 @@ AC_SUBST(requirements_ecore) AC_SUBST(requirements_ecore_con) AC_SUBST(requirements_ecore_config) AC_SUBST(requirements_ecore_directfb) +AC_SUBST(requirements_ecore_input) AC_SUBST(requirements_ecore_evas) AC_SUBST(requirements_ecore_fb) AC_SUBST(requirements_ecore_file) @@ -962,6 +969,7 @@ ecore-ipc.pc ecore-job.pc ecore-txt.pc ecore-x.pc +ecore-input.pc ecore-win32.pc ecore-sdl.pc ecore-quartz.pc @@ -984,6 +992,7 @@ src/lib/ecore_evas/Makefile src/lib/ecore_con/Makefile src/lib/ecore_imf/Makefile src/lib/ecore_imf_evas/Makefile +src/lib/ecore_input/Makefile src/lib/ecore_ipc/Makefile src/lib/ecore_txt/Makefile src/lib/ecore_config/Makefile diff --git a/legacy/ecore/ecore-input.pc.in b/legacy/ecore/ecore-input.pc.in new file mode 100644 index 0000000000..fc4e1ed741 --- /dev/null +++ b/legacy/ecore/ecore-input.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: ecore-input +Description: E core library, Input module +Requires: ecore @requirements_ecore_input@ +Version: @VERSION@ +Libs: -L${libdir} -lecore_input +Cflags: -I${includedir} diff --git a/legacy/ecore/src/lib/Makefile.am b/legacy/ecore/src/lib/Makefile.am index 5eb2192006..f661a8f1f4 100644 --- a/legacy/ecore/src/lib/Makefile.am +++ b/legacy/ecore/src/lib/Makefile.am @@ -2,6 +2,7 @@ MAINTAINERCLEANFILES = Makefile.in SUBDIRS = \ ecore \ +ecore_input \ ecore_job \ ecore_txt \ ecore_fb \ @@ -16,5 +17,6 @@ ecore_ipc \ ecore_evas \ ecore_config \ ecore_file \ +ecore_input \ ecore_imf \ ecore_imf_evas diff --git a/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h b/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h index 5582bd1ca5..6a1fb0d2be 100644 --- a/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h +++ b/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h @@ -126,6 +126,8 @@ typedef void Ecore_WinCE_Window; typedef struct _Ecore_Evas Ecore_Evas; #endif +#include + /* module setup/shutdown calls */ EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine); @@ -316,7 +318,7 @@ EAPI void ecore_evas_sticky_set(Ecore_Evas *ee, int sticky); EAPI int ecore_evas_sticky_get(const Ecore_Evas *ee); EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, int ignore); EAPI int ecore_evas_ignore_events_get(const Ecore_Evas *ee); -EAPI void *ecore_evas_window_get(const Ecore_Evas *ee); +EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee); EAPI int ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); diff --git a/legacy/ecore/src/lib/ecore_evas/Makefile.am b/legacy/ecore/src/lib/ecore_evas/Makefile.am index 9581230db1..876b979f1c 100644 --- a/legacy/ecore/src/lib/ecore_evas/Makefile.am +++ b/legacy/ecore/src/lib/ecore_evas/Makefile.am @@ -35,9 +35,11 @@ endif if BUILD_ECORE_SDL ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@ ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la +ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB) else ECORE_SDL_INC = ECORE_SDL_LIB = +ECORE_SDL_LIBADD = endif if BUILD_ECORE_QUARTZ @@ -59,8 +61,10 @@ endif AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ -I$(top_builddir)/src/lib/ecore \ -I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ @EFL_ECORE_EVAS_BUILD@ \ $(ECORE_X_INC) \ $(ECORE_FB_INC) \ @@ -99,9 +103,11 @@ $(ECORE_FB_LIB) \ $(ECORE_DIRECTFB_LIB) \ $(ECORE_WIN32_LIB) \ $(ECORE_SDL_LIB) \ +$(ECORE_SDL_LIBADD) \ $(ECORE_QUARTZ_LIB) \ $(ECORE_WINCE_LIB) \ $(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ @EVAS_LIBS@ \ @XCB_LIBS@ \ @SDL_LIBS@ \ diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c index f6d08b2540..88dc59a3ad 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c @@ -9,9 +9,11 @@ #include #include "Ecore.h" +#include "Ecore_Evas.h" +#include "Ecore_Input.h" + #include "ecore_private.h" #include "ecore_evas_private.h" -#include "Ecore_Evas.h" static int _ecore_evas_init_count = 0; static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL; @@ -2325,18 +2327,17 @@ ecore_evas_ignore_events_get(const Ecore_Evas *ee) return ee->ignore_events ? 1 : 0; } -EAPI void * +EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_window_get"); - return NULL; + return 0; } - if (ee->engine.func->fn_window_get) return ee->engine.func->fn_window_get(ee); - return NULL; + return ee->prop.window; } /* fps debug calls - for debugging how much time your app actually spends */ 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 fb506358de..ad5842cac3 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c @@ -4,9 +4,11 @@ #endif #include "Ecore.h" +#include "Ecore_Evas.h" +#include "Ecore_Input.h" + #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; @@ -15,14 +17,6 @@ static int _ecore_evas_fps_debug = 0; static Ecore_Evas *ecore_evases = NULL; -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; - evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL); -} - static int _ecore_evas_buffer_init(void) { @@ -219,7 +213,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 @@ -421,8 +415,6 @@ static const Ecore_Evas_Engine_Func _ecore_buffer_engine_func = NULL, NULL, NULL, - NULL, - NULL, NULL }; #endif 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 c342215825..9e93ba6ea9 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_directfb.c @@ -9,13 +9,13 @@ #include #include "Ecore.h" -#include "ecore_private.h" -#include "ecore_evas_private.h" #include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_DIRECTFB #include "Ecore_DirectFB.h" #endif +#include "ecore_private.h" +#include "ecore_evas_private.h" #ifdef BUILD_ECORE_EVAS_DIRECTFB static int _ecore_evas_init_count = 0; @@ -78,70 +78,6 @@ _ecore_evas_directfb_idle_enter(void *data __UNUSED__) return 1; } -static char * -_ecore_evas_directfb_winid_str_get(Ecore_X_Window win) -{ - const char *vals = "qWeRtYuIoP5-$&<~"; - static char id[9]; - unsigned int val; - val = (unsigned int)win; - 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_directfb_match(DFBWindowID win) -{ - Ecore_Evas *ee; - - ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win)); - return ee; -} - -static void -_ecore_evas_directfb_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_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) { @@ -182,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_directfb_mouse_move_process(ee, e->x, e->y, e->time); + ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); return 1; } @@ -196,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_directfb_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; } @@ -212,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_directfb_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; } @@ -228,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_directfb_mouse_move_process(ee, e->x, e->y, e->time); + //ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); return 1; } @@ -243,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_directfb_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; @@ -560,8 +496,7 @@ static const Ecore_Evas_Engine_Func _ecore_directfb_engine_func = NULL, /* withdrawn */ NULL, /* sticky */ NULL, /* ignore events */ - NULL, /* alpha */ - _ecore_evas_directfb_window_get /* window_get */ + NULL /* alpha */ }; #endif 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 87bb4a7c00..15464e70b8 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c @@ -10,14 +10,15 @@ #include #include "Ecore.h" -#include "ecore_private.h" -#include "ecore_evas_private.h" #include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_FB #include "Ecore_Fb.h" #include "ecore_fb_private.h" #endif +#include "ecore_private.h" +#include "ecore_evas_private.h" + #ifdef BUILD_ECORE_EVAS_FB static int _ecore_evas_init_count = 0; @@ -595,9 +596,10 @@ static const Ecore_Evas_Engine_Func _ecore_fb_engine_func = NULL, NULL, NULL, - _ecore_evas_fullscreen_set, NULL, NULL, + _ecore_evas_fullscreen_set, + NULL, NULL, NULL }; 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 501ca625c8..88270ae00e 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_private.h +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_private.h @@ -8,6 +8,7 @@ # include #endif +#include "ecore_private.h" #include "Ecore_Data.h" #include @@ -93,8 +94,10 @@ #define IDLE_FLUSH_TIME 0.5 +#ifndef _ECORE_EVAS_H +typedef struct _Ecore_Evas Ecore_Evas; +#endif -typedef struct _Ecore_Evas Ecore_Evas; typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func; @@ -145,7 +148,6 @@ struct _Ecore_Evas_Engine_Func void (*fn_sticky_set) (Ecore_Evas *ee, int sticky); void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore); void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); - void *(*fn_window_get) (const Ecore_Evas *ee); }; struct _Ecore_Evas_Engine @@ -155,7 +157,6 @@ struct _Ecore_Evas_Engine #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_XCB) struct { Ecore_X_Window win_root; - Ecore_X_Window win; Eina_List *win_extra; Ecore_X_Pixmap pmap; Ecore_X_Pixmap mask; @@ -264,6 +265,7 @@ struct _Ecore_Evas } hot; } cursor; int layer; + Ecore_Window window; unsigned char avoid_damage; char focused : 1; char iconified : 1; 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 ee57b95d68..1941c765bf 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_quartz.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_quartz.c @@ -11,9 +11,10 @@ #endif #include "Ecore.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 546f9a74cd..c755b66d15 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c @@ -7,14 +7,15 @@ #endif #include "Ecore.h" -#include "ecore_private.h" -#include "ecore_evas_private.h" #include "Ecore_Evas.h" +#include "Ecore_Input.h" #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL #include "Ecore_Sdl.h" #include "Evas_Engine_SDL.h" #endif +#include "ecore_evas_private.h" + #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL /* static char *ecore_evas_default_display = "0"; */ @@ -25,140 +26,20 @@ static int _ecore_evas_init_count = 0; static int _ecore_evas_fps_debug = 0; #endif /* _WIN32 */ static Ecore_Evas *ecore_evases = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[10] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { + NULL, NULL, NULL, NULL }; static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; -static Ecore_Idler *ecore_evas_event = NULL; +static Ecore_Poller *ecore_evas_event = NULL; static const char *ecore_evas_sdl_default = "EFL SDL"; -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_sdl_match(void) { return ecore_evases; } -static int -_ecore_evas_sdl_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Sdl_Event_Key_Down *e; - Ecore_Evas *ee; - - e = event; - ee = _ecore_evas_sdl_match(); - - if (!ee) return 1; - /* pass on event */ - evas_event_feed_key_down(ee->evas, e->keyname, NULL, e->keycompose, NULL, e->time, NULL); - - return 0; /* dont pass it on */ -} - -static int -_ecore_evas_sdl_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Sdl_Event_Key_Up *e; - Ecore_Evas *ee; - - e = event; - ee = _ecore_evas_sdl_match(); - - if (!ee) return 1; - /* pass on event */ - evas_event_feed_key_up(ee->evas, e->keyname, NULL, e->keycompose, NULL, e->time, NULL); - - return 0; -} - -static int -_ecore_evas_sdl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Sdl_Event_Mouse_Move *e; - Ecore_Evas *ee; - - e = event; - ee = _ecore_evas_sdl_match(); - - if (!ee) return 1; /* pass on event */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - - return 0; -} - -static int -_ecore_evas_sdl_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Sdl_Event_Mouse_Button_Down *e; - Ecore_Evas *ee; - Evas_Button_Flags flags; - - e = event; - ee = _ecore_evas_sdl_match(); - flags = EVAS_BUTTON_NONE; - - if (!ee) return 1; - /* pass on event */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - 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); - - return 0; -} - -static int -_ecore_evas_sdl_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Sdl_Event_Mouse_Button_Up *e; - Ecore_Evas *ee; - Evas_Button_Flags flags; - - e = event; - ee = _ecore_evas_sdl_match(); - flags = EVAS_BUTTON_NONE; - - if (!ee) return 1; - /* pass on event */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - 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); - - return 0; -} - -static int -_ecore_evas_sdl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Sdl_Event_Mouse_Wheel *e; - Ecore_Evas *ee; - - e = event; - ee = _ecore_evas_sdl_match(); - - if (!ee) return 1; /* pass on event */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - evas_event_feed_mouse_wheel(ee->evas, e->direction, e->wheel, e->time, NULL); - - return 0; -} - static int _ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) { @@ -291,21 +172,18 @@ _ecore_evas_sdl_init(int w, int h) if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; #endif /* _WIN32 */ ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); - ecore_evas_event = ecore_timer_add(0.008, _ecore_evas_sdl_event, NULL); + ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL); + ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); #ifndef _WIN32 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); #endif /* _WIN32 */ - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_KEY_DOWN, _ecore_evas_sdl_event_key_down, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_KEY_UP, _ecore_evas_sdl_event_key_up, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_sdl_event_button_down, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_MOUSE_BUTTON_UP, _ecore_evas_sdl_event_button_up, NULL); - ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_SDL_EVENT_MOUSE_MOVE, _ecore_evas_sdl_event_mouse_move, NULL); - ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_SDL_EVENT_MOUSE_WHEEL, _ecore_evas_sdl_event_mouse_wheel, NULL); - ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL); - ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL); - ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL); - ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL); + ecore_evas_event_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); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL); return _ecore_evas_init_count; } @@ -318,12 +196,13 @@ _ecore_evas_sdl_shutdown(void) { int i; - while (ecore_evases) _ecore_evas_free(ecore_evases); + 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_idle_enterer_del(ecore_evas_idle_enterer); ecore_evas_idle_enterer = NULL; - ecore_timer_del(ecore_evas_event); + ecore_poller_del(ecore_evas_event); ecore_evas_event = NULL; #ifndef _WIN32 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); @@ -337,6 +216,7 @@ static void _ecore_evas_sdl_free(Ecore_Evas *ee) { ecore_evases = _ecore_list2_remove(ecore_evases, ee); + ecore_evas_unregister(ee, 0); _ecore_evas_sdl_shutdown(); ecore_sdl_shutdown(); } @@ -457,7 +337,6 @@ static const Ecore_Evas_Engine_Func _ecore_sdl_engine_func = NULL, NULL, NULL, - NULL, NULL }; @@ -472,8 +351,6 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu if (ecore_evases) return NULL; - if (!ecore_sdl_init(name)) return NULL; - ee = calloc(1, sizeof(Ecore_Evas)); if (!ee) return NULL; @@ -500,6 +377,7 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu ee->prop.fullscreen = fullscreen; ee->prop.withdrawn = 0; ee->prop.sticky = 0; + ee->prop.window = 0; /* init evas here */ ee->evas = evas_new(); @@ -519,18 +397,18 @@ _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); } - 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_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)) + { + evas_free(ee->evas); + if (ee->name) free(ee->name); + free(ee); + return NULL; + } + _ecore_evas_sdl_init(w, h); SDL_ShowCursor(SDL_DISABLE); diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_util.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_util.c index 67c24fcedc..7880585ff3 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_util.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_util.c @@ -9,10 +9,10 @@ #include #include "Ecore.h" -#include "ecore_private.h" -#include "ecore_evas_private.h" #include "Ecore_Evas.h" +#include "ecore_private.h" +#include "ecore_evas_private.h" static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate"; 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 d98b6548c9..d904c72340 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c @@ -9,7 +9,6 @@ #include /* for NULL */ #include "Ecore.h" -#include "ecore_private.h" #ifdef BUILD_ECORE_EVAS_WIN32 # define WIN32_LEAN_AND_MEAN # include @@ -18,9 +17,10 @@ # include "ecore_win32_private.h" #endif /* BUILD_ECORE_EVAS_WIN32 */ -#include "ecore_evas_private.h" #include "Ecore_Evas.h" +#include "ecore_private.h" +#include "ecore_evas_private.h" #ifdef BUILD_ECORE_EVAS_WIN32 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 a358fafb99..4fc4d24fe2 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c @@ -9,7 +9,6 @@ #include /* for NULL */ #include "Ecore.h" -#include "ecore_private.h" #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE # define WIN32_LEAN_AND_MEAN # include @@ -18,9 +17,10 @@ # include "ecore_wince_private.h" #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ -#include "ecore_evas_private.h" #include "Ecore_Evas.h" +#include "ecore_private.h" +#include "ecore_evas_private.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 96d4afed6f..3b12e54998 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c @@ -9,14 +9,14 @@ #include #include "Ecore.h" -#include "ecore_private.h" +#include "Ecore_Evas.h" +#include "Ecore_Input.h" #ifdef BUILD_ECORE_EVAS_X11 # include "Ecore_X.h" # include "Ecore_X_Atoms.h" #endif #include "ecore_evas_private.h" -#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_X11 static int _ecore_evas_init_count = 0; @@ -24,8 +24,7 @@ static int _ecore_evas_init_count = 0; static int _ecore_evas_fps_debug = 0; static Ecore_Evas *ecore_evases = NULL; -static Eina_Hash *ecore_evases_hash = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[18]; +static Ecore_Event_Handler *ecore_evas_event_handlers[12]; static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; #ifdef HAVE_ECORE_X_XCB @@ -167,11 +166,11 @@ _ecore_evas_x_render(Ecore_Evas *ee) if (updates) { EINA_LIST_FOREACH(updates, l, r) - ecore_x_window_area_clear(ee->engine.x.win, r->x, r->y, r->w, r->h); + ecore_x_window_area_clear(ee->prop.window, r->x, r->y, r->w, r->h); if ((ee->shaped) && (updates)) - ecore_x_window_shape_mask_set(ee->engine.x.win, ee->engine.x.mask); + ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask); if ((ee->alpha) && (updates)) - ecore_x_window_shape_input_mask_set(ee->engine.x.win, ee->engine.x.mask); + ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); evas_render_updates_free(updates); _ecore_evas_idle_timeout_update(ee); rend = 1; @@ -226,7 +225,7 @@ _ecore_evas_x_render(Ecore_Evas *ee) { /* if we have a damage pixmap - we can avoid exposures by * disabling them just for setting the mask */ - ecore_x_event_mask_set(ee->engine.x.win, + ecore_x_event_mask_set(ee->prop.window, ECORE_X_EVENT_MASK_KEY_DOWN | ECORE_X_EVENT_MASK_KEY_UP | ECORE_X_EVENT_MASK_MOUSE_DOWN | @@ -242,9 +241,9 @@ _ecore_evas_x_render(Ecore_Evas *ee) ECORE_X_EVENT_MASK_WINDOW_COLORMAP ); if ((ee->shaped) && (updates)) - ecore_x_window_shape_mask_set(ee->engine.x.win, ee->engine.x.mask); + ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask); /* and re-enable them again */ - ecore_x_event_mask_set(ee->engine.x.win, + ecore_x_event_mask_set(ee->prop.window, ECORE_X_EVENT_MASK_KEY_DOWN | ECORE_X_EVENT_MASK_KEY_UP | ECORE_X_EVENT_MASK_MOUSE_DOWN | @@ -263,13 +262,13 @@ _ecore_evas_x_render(Ecore_Evas *ee) /* debug rendering */ /* XSetForeground(ecore_x_display_get(), ee->engine.x.gc, rand()); - XFillRectangle(ecore_x_display_get(), ee->engine.x.win, ee->engine.x.gc, + XFillRectangle(ecore_x_display_get(), ee->prop.window, ee->engine.x.gc, 0, 0, ee->w, ee->h); XSync(ecore_x_display_get(), False); usleep(20000); XSync(ecore_x_display_get(), False); */ - ecore_x_pixmap_paste(ee->engine.x.pmap, ee->engine.x.win, ee->engine.x.gc, + ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window, ee->engine.x.gc, 0, 0, ee->w, ee->h, 0, 0); XDestroyRegion(ee->engine.x.damages); ee->engine.x.damages = 0; @@ -292,7 +291,7 @@ _ecore_evas_x_render(Ecore_Evas *ee) updates = evas_render_updates(ee->evas); if (updates) { - ecore_x_window_shape_mask_set(ee->engine.x.win, ee->engine.x.mask); + ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask); evas_render_updates_free(updates); _ecore_evas_idle_timeout_update(ee); rend = 1; @@ -305,7 +304,7 @@ _ecore_evas_x_render(Ecore_Evas *ee) { evas_render_updates_free(updates); if (ee->alpha) - ecore_x_window_shape_input_mask_set(ee->engine.x.win, ee->engine.x.mask); + ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); _ecore_evas_idle_timeout_update(ee); rend = 1; } @@ -317,41 +316,6 @@ _ecore_evas_x_render(Ecore_Evas *ee) return rend; } -static void -_ecore_evas_x_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 char * _ecore_evas_x_winid_str_get(Ecore_X_Window win) { @@ -372,15 +336,6 @@ _ecore_evas_x_winid_str_get(Ecore_X_Window win) return id; } -static Ecore_Evas * -_ecore_evas_x_match(Ecore_X_Window win) -{ - Ecore_Evas *ee; - - ee = eina_hash_find(ecore_evases_hash, _ecore_evas_x_winid_str_get(win)); - return ee; -} - static void _ecore_evas_x_resize_shape(Ecore_Evas *ee) { @@ -402,7 +357,7 @@ _ecore_evas_x_resize_shape(Ecore_Evas *ee) # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */ if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB gc = xcb_generate_id(ecore_x_connection_get()); value_list = 0; @@ -454,7 +409,7 @@ _ecore_evas_x_resize_shape(Ecore_Evas *ee) # endif /* ! BUILD_ECORE_EVAS_XRENDER_XCB */ if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); # ifdef BUILD_ECORE_EVAS_XRENDER_XCB gc = xcb_generate_id(ecore_x_connection_get()); value_list = 0; @@ -496,7 +451,7 @@ _ecore_evas_x_resize_shape(Ecore_Evas *ee) XGCValues gcv; if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); einfo->info.mask = ee->engine.x.mask; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); @@ -506,125 +461,6 @@ _ecore_evas_x_resize_shape(Ecore_Evas *ee) } } -static void -_ecore_evas_x_modifier_locks_update(Ecore_Evas *ee, int modifiers) -{ - if (modifiers & ECORE_X_MODIFIER_SHIFT) - evas_key_modifier_on(ee->evas, "Shift"); - else - evas_key_modifier_off(ee->evas, "Shift"); - if (modifiers & ECORE_X_MODIFIER_CTRL) - evas_key_modifier_on(ee->evas, "Control"); - else - evas_key_modifier_off(ee->evas, "Control"); - if (modifiers & ECORE_X_MODIFIER_ALT) - evas_key_modifier_on(ee->evas, "Alt"); - else - evas_key_modifier_off(ee->evas, "Alt"); - if (modifiers & ECORE_X_MODIFIER_WIN) - { - evas_key_modifier_on(ee->evas, "Super"); - evas_key_modifier_on(ee->evas, "Hyper"); - } - else - { - evas_key_modifier_off(ee->evas, "Super"); - evas_key_modifier_off(ee->evas, "Hyper"); - } - if (modifiers & ECORE_X_LOCK_SCROLL) - evas_key_lock_on(ee->evas, "Scroll_Lock"); - else - evas_key_lock_off(ee->evas, "Scroll_Lock"); - if (modifiers & ECORE_X_LOCK_NUM) - evas_key_lock_on(ee->evas, "Num_Lock"); - else - evas_key_lock_off(ee->evas, "Num_Lock"); - if (modifiers & ECORE_X_LOCK_CAPS) - evas_key_lock_on(ee->evas, "Caps_Lock"); - else - evas_key_lock_off(ee->evas, "Caps_Lock"); -} - -static int -_ecore_evas_x_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_X_Event_Key_Down *e; - - e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - _ecore_evas_x_modifier_locks_update(ee, e->modifiers); - evas_event_feed_key_down(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, e->time, NULL); - return 1; -} - -static int -_ecore_evas_x_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_X_Event_Key_Up *e; - - e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - _ecore_evas_x_modifier_locks_update(ee, e->modifiers); - evas_event_feed_key_up(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, e->time, NULL); - return 1; -} - -static int -_ecore_evas_x_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_X_Event_Mouse_Button_Down *e; - Evas_Button_Flags flags = EVAS_BUTTON_NONE; - - e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; - _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); - return 1; -} - -static int -_ecore_evas_x_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_X_Event_Mouse_Button_Up *e; - Evas_Button_Flags flags = EVAS_BUTTON_NONE; - - e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; - _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); - return 1; -} - -static int -_ecore_evas_x_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_X_Event_Mouse_Wheel *e; - - e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; - _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; -} - /* TODO: we need to make this work for all the states, not just sticky */ static int _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event) @@ -633,9 +469,9 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, Ecore_X_Event_Window_Property *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (e->atom == ECORE_X_ATOM_NET_WM_STATE) { unsigned int i, num; @@ -734,30 +570,15 @@ _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__ Ecore_X_Event_Window_Visibility_Change *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; // printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured); if (e->fully_obscured) ee->draw_ok = 0; else ee->draw_ok = 1; return 1; } -static int -_ecore_evas_x_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_X_Event_Mouse_Move *e; - - e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; - _ecore_evas_x_modifier_locks_update(ee, e->modifiers); - _ecore_evas_x_mouse_move_process(ee, e->x, e->y, e->time); - return 1; -} - static int _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) { @@ -765,49 +586,47 @@ _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_x_match(e->win); + ee = ecore_evas_window_match(e->win); if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; -/* - { - time_t t; - char *ct; + if (e->win != ee->prop.window) return 1; +/* { */ +/* time_t t; */ +/* char *ct; */ - const char *modes[] = { - "MODE_NORMAL", - "MODE_WHILE_GRABBED", - "MODE_GRAB", - "MODE_UNGRAB" - }; - const char *details[] = { - "DETAIL_ANCESTOR", - "DETAIL_VIRTUAL", - "DETAIL_INFERIOR", - "DETAIL_NON_LINEAR", - "DETAIL_NON_LINEAR_VIRTUAL", - "DETAIL_POINTER", - "DETAIL_POINTER_ROOT", - "DETAIL_DETAIL_NONE" - }; - t = time(NULL); - ct = ctime(&t); - ct[strlen(ct) - 1] = 0; - printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", - e->win, e->event_win, - ct, - modes[e->mode], - details[e->detail]); - } - */ -// disable. causes mroe problems than it fixes -// if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || -// (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) -// return 0; -/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ +/* const char *modes[] = { */ +/* "MODE_NORMAL", */ +/* "MODE_WHILE_GRABBED", */ +/* "MODE_GRAB", */ +/* "MODE_UNGRAB" */ +/* }; */ +/* const char *details[] = { */ +/* "DETAIL_ANCESTOR", */ +/* "DETAIL_VIRTUAL", */ +/* "DETAIL_INFERIOR", */ +/* "DETAIL_NON_LINEAR", */ +/* "DETAIL_NON_LINEAR_VIRTUAL", */ +/* "DETAIL_POINTER", */ +/* "DETAIL_POINTER_ROOT", */ +/* "DETAIL_DETAIL_NONE" */ +/* }; */ +/* t = time(NULL); */ +/* ct = ctime(&t); */ +/* ct[strlen(ct) - 1] = 0; */ +/* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */ +/* e->win, e->event_win, */ +/* ct, */ +/* modes[e->mode], */ +/* details[e->detail]); */ +/* } */ + // disable. causes mroe problems than it fixes + // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || + // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) + // 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_x_modifier_locks_update(ee, e->modifiers); + ecore_evas_event_modifier_lock_update(ee->evas, e->modifiers); evas_event_feed_mouse_in(ee->evas, e->time, NULL); - _ecore_evas_x_mouse_move_process(ee, e->x, e->y, e->time); + ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); return 1; } @@ -818,47 +637,46 @@ _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void * Ecore_X_Event_Mouse_Out *e; e = event; - ee = _ecore_evas_x_match(e->win); - if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; -/* - { - time_t t; - char *ct; + ee = ecore_evas_window_match(e->win); + if ((!ee) || (ee->ignore_events)) return 1; + /* pass on event */ + if (e->win != ee->prop.window) return 1; +/* { */ +/* time_t t; */ +/* char *ct; */ - const char *modes[] = { - "MODE_NORMAL", - "MODE_WHILE_GRABBED", - "MODE_GRAB", - "MODE_UNGRAB" - }; - const char *details[] = { - "DETAIL_ANCESTOR", - "DETAIL_VIRTUAL", - "DETAIL_INFERIOR", - "DETAIL_NON_LINEAR", - "DETAIL_NON_LINEAR_VIRTUAL", - "DETAIL_POINTER", - "DETAIL_POINTER_ROOT", - "DETAIL_DETAIL_NONE" - }; - t = time(NULL); - ct = ctime(&t); - ct[strlen(ct) - 1] = 0; - printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", - e->win, e->event_win, - ct, - modes[e->mode], - details[e->detail]); - } - */ -// disable. causes more problems than it fixes -// if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || -// (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) -// return 0; -/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ - _ecore_evas_x_modifier_locks_update(ee, e->modifiers); - _ecore_evas_x_mouse_move_process(ee, e->x, e->y, e->time); +/* const char *modes[] = { */ +/* "MODE_NORMAL", */ +/* "MODE_WHILE_GRABBED", */ +/* "MODE_GRAB", */ +/* "MODE_UNGRAB" */ +/* }; */ +/* const char *details[] = { */ +/* "DETAIL_ANCESTOR", */ +/* "DETAIL_VIRTUAL", */ +/* "DETAIL_INFERIOR", */ +/* "DETAIL_NON_LINEAR", */ +/* "DETAIL_NON_LINEAR_VIRTUAL", */ +/* "DETAIL_POINTER", */ +/* "DETAIL_POINTER_ROOT", */ +/* "DETAIL_DETAIL_NONE" */ +/* }; */ +/* t = time(NULL); */ +/* ct = ctime(&t); */ +/* ct[strlen(ct) - 1] = 0; */ +/* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */ +/* e->win, e->event_win, */ +/* ct, */ +/* modes[e->mode], */ +/* details[e->detail]); */ +/* } */ + // disable. causes more problems than it fixes + // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || + // (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); 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); @@ -874,9 +692,9 @@ _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_x_match(e->win); + ee = ecore_evas_window_match(e->win); if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; ee->prop.focused = 1; if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); return 1; @@ -889,11 +707,11 @@ _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_x_match(e->win); + ee = ecore_evas_window_match(e->win); if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (ee->prop.fullscreen) - ecore_x_window_focus(ee->engine.x.win); + ecore_x_window_focus(ee->prop.window); ee->prop.focused = 0; if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); return 1; @@ -906,9 +724,9 @@ _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, vo Ecore_X_Event_Window_Damage *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (ee->engine.x.using_bg_pixmap) return 1; // printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h); if (ee->prop.avoid_damage) @@ -978,9 +796,9 @@ _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, v Ecore_X_Event_Window_Destroy *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (ee->func.fn_destroy) ee->func.fn_destroy(ee); ecore_evas_free(ee); return 1; @@ -993,9 +811,9 @@ _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, Ecore_X_Event_Window_Configure *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (ee->engine.x.direct_resize) return 1; if ((e->from_wm) || (ee->prop.override)) @@ -1036,8 +854,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_x_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; } @@ -1053,9 +871,9 @@ _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_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); return 1; } @@ -1067,9 +885,9 @@ _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void Ecore_X_Event_Window_Show *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (ee->visible) return 0; /* dont pass it on */ // printf("SHOW EVENT %p\n", ee); ee->visible = 1; @@ -1084,9 +902,9 @@ _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void Ecore_X_Event_Window_Hide *e; e = event; - ee = _ecore_evas_x_match(e->win); + ee = ecore_evas_window_match(e->win); if (!ee) return 1; /* pass on event */ - if (e->win != ee->engine.x.win) return 1; + if (e->win != ee->prop.window) return 1; if (!ee->visible) return 0; /* dont pass it on */ // printf("HIDE EVENT %p\n", ee); ee->visible = 0; @@ -1100,10 +918,10 @@ static void _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) { # ifdef HAVE_ECORE_X_XCB - ecore_x_icccm_size_pos_hints_get_prefetch(ee->engine.x.win); + ecore_x_icccm_size_pos_hints_get_prefetch(ee->prop.window); ecore_x_icccm_size_pos_hints_get_fetch(); # endif /* HAVE_ECORE_X_XCB */ - ecore_x_icccm_size_pos_hints_set(ee->engine.x.win, + ecore_x_icccm_size_pos_hints_set(ee->prop.window, ee->prop.request_pos /*request_pos */, ECORE_X_GRAVITY_NW /* gravity */, ee->prop.min.w /* min_w */, @@ -1157,7 +975,7 @@ _ecore_evas_x_state_update(Ecore_Evas *ee) if (ee->engine.x.state.below) state[num++] = ECORE_X_WINDOW_STATE_BELOW; - ecore_x_netwm_window_state_set(ee->engine.x.win, state, num); + ecore_x_netwm_window_state_set(ee->prop.window, state, num); } static void @@ -1172,14 +990,14 @@ _ecore_evas_x_layer_update(Ecore_Evas *ee) if (ee->engine.x.state.above) { ee->engine.x.state.above = 0; - ecore_x_netwm_state_request_send(ee->engine.x.win, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_ABOVE, -1, 0); } if (!ee->engine.x.state.below) { ee->engine.x.state.below = 1; - ecore_x_netwm_state_request_send(ee->engine.x.win, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_BELOW, -1, 1); } @@ -1189,14 +1007,14 @@ _ecore_evas_x_layer_update(Ecore_Evas *ee) if (ee->engine.x.state.below) { ee->engine.x.state.below = 0; - ecore_x_netwm_state_request_send(ee->engine.x.win, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_BELOW, -1, 0); } if (!ee->engine.x.state.above) { ee->engine.x.state.above = 1; - ecore_x_netwm_state_request_send(ee->engine.x.win, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_ABOVE, -1, 1); } @@ -1206,14 +1024,14 @@ _ecore_evas_x_layer_update(Ecore_Evas *ee) if (ee->engine.x.state.below) { ee->engine.x.state.below = 0; - ecore_x_netwm_state_request_send(ee->engine.x.win, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_BELOW, -1, 0); } if (ee->engine.x.state.above) { ee->engine.x.state.above = 0; - ecore_x_netwm_state_request_send(ee->engine.x.win, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_ABOVE, -1, 0); } @@ -1290,24 +1108,19 @@ _ecore_evas_x_init(void) if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_x_idle_enter, NULL); - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN, _ecore_evas_x_event_key_down, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_X_EVENT_KEY_UP, _ecore_evas_x_event_key_up, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_x_event_mouse_button_down, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, _ecore_evas_x_event_mouse_button_up, NULL); - ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, _ecore_evas_x_event_mouse_move, NULL); - ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, _ecore_evas_x_event_mouse_in, NULL); - ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, _ecore_evas_x_event_mouse_out, NULL); - ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, _ecore_evas_x_event_window_focus_in, NULL); - ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_x_event_window_focus_out, NULL); - ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, _ecore_evas_x_event_window_damage, NULL); - ecore_evas_event_handlers[10] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _ecore_evas_x_event_window_destroy, NULL); - ecore_evas_event_handlers[11] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _ecore_evas_x_event_window_configure, NULL); - ecore_evas_event_handlers[12] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_x_event_window_delete_request, NULL); - ecore_evas_event_handlers[13] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, _ecore_evas_x_event_window_show, NULL); - ecore_evas_event_handlers[14] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, _ecore_evas_x_event_window_hide, NULL); - ecore_evas_event_handlers[15] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL, _ecore_evas_x_event_mouse_wheel, NULL); - ecore_evas_event_handlers[16] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _ecore_evas_x_event_property_change, NULL); - ecore_evas_event_handlers[17] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, _ecore_evas_x_event_visibility_change, NULL); + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, _ecore_evas_x_event_mouse_in, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, _ecore_evas_x_event_mouse_out, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, _ecore_evas_x_event_window_focus_in, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_x_event_window_focus_out, NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, _ecore_evas_x_event_window_damage, NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _ecore_evas_x_event_window_destroy, NULL); + ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _ecore_evas_x_event_window_configure, NULL); + ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_x_event_window_delete_request, NULL); + ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, _ecore_evas_x_event_window_show, NULL); + 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(); if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); return _ecore_evas_init_count; } @@ -1315,7 +1128,7 @@ _ecore_evas_x_init(void) static void _ecore_evas_x_free(Ecore_Evas *ee) { - ecore_x_window_del(ee->engine.x.win); + ecore_x_window_del(ee->prop.window); if (ee->engine.x.pmap) ecore_x_pixmap_del(ee->engine.x.pmap); if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); if (ee->engine.x.gc) ecore_x_gc_del(ee->engine.x.gc); @@ -1328,18 +1141,18 @@ _ecore_evas_x_free(Ecore_Evas *ee) ee->engine.x.mask = 0; ee->engine.x.gc = 0; #ifdef HAVE_ECORE_X_XCB -# warning [XCB] No Region code +#warning [XCB] No Region code #else ee->engine.x.damages = 0; #endif /* ! HAVE_ECORE_X_XCB */ - eina_hash_del(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_evas_unregister(ee, 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); - eina_hash_del(ecore_evases_hash, _ecore_evas_x_winid_str_get(*winp), ee); + ecore_evas_unregister(ee, *winp); free(winp); } ecore_evases = _ecore_list2_remove(ecore_evases, ee); @@ -1352,13 +1165,13 @@ static void _ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) { #ifdef HAVE_ECORE_X_XCB - ecore_x_icccm_protocol_get_prefetch(ee->engine.x.win); + ecore_x_icccm_protocol_get_prefetch(ee->prop.window); ecore_x_icccm_protocol_get_fetch(); #endif /* HAVE_ECORE_X_XCB */ if (func) - ecore_x_icccm_protocol_set(ee->engine.x.win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1); + ecore_x_icccm_protocol_set(ee->prop.window, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1); else - ecore_x_icccm_protocol_set(ee->engine.x.win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 0); + ecore_x_icccm_protocol_set(ee->prop.window, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 0); ee->func.fn_delete_request = func; #ifdef HAVE_ECORE_X_XCB ecore_xcb_reply_free(); @@ -1376,7 +1189,7 @@ _ecore_evas_x_move(Ecore_Evas *ee, int x, int y) { ee->x = x; ee->y = y; - ecore_x_window_move(ee->engine.x.win, x, y); + ecore_x_window_move(ee->prop.window, x, y); if (!ee->should_be_visible) { /* We need to request pos */ @@ -1389,7 +1202,7 @@ _ecore_evas_x_move(Ecore_Evas *ee, int x, int y) } else { - ecore_x_window_move(ee->engine.x.win, x, y); + ecore_x_window_move(ee->prop.window, x, y); if (!ee->should_be_visible) { /* We need to request pos */ @@ -1426,7 +1239,7 @@ _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h) { if ((ee->w != w) || (ee->h != h)) { - ecore_x_window_resize(ee->engine.x.win, w, h); + ecore_x_window_resize(ee->prop.window, w, h); ee->w = w; ee->h = h; if ((ee->rotation == 90) || (ee->rotation == 270)) @@ -1453,7 +1266,7 @@ _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h) } } else - ecore_x_window_resize(ee->engine.x.win, w, h); + ecore_x_window_resize(ee->prop.window, w, h); } static void @@ -1470,7 +1283,7 @@ _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) { if ((x != ee->x) || (y != ee->y)) change_pos = 1; } - ecore_x_window_move_resize(ee->engine.x.win, x, y, w, h); + ecore_x_window_move_resize(ee->prop.window, x, y, w, h); if (!ee->engine.x.managed) { ee->x = x; @@ -1510,7 +1323,7 @@ _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) } else { - ecore_x_window_move_resize(ee->engine.x.win, x, y, w, h); + ecore_x_window_move_resize(ee->prop.window, x, y, w, h); if (!ee->engine.x.managed) { ee->x = x; @@ -1535,7 +1348,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, evas_engine_info_set(ee->evas, einfo); if (!ee->prop.fullscreen) { - ecore_x_window_resize(ee->engine.x.win, ee->h, ee->w); + ecore_x_window_resize(ee->prop.window, ee->h, ee->w); ee->expecting_resize.w = ee->h; ee->expecting_resize.h = ee->w; } @@ -1543,8 +1356,8 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, { int w, h; - ecore_x_window_size_get(ee->engine.x.win, &w, &h); - ecore_x_window_resize(ee->engine.x.win, h, w); + ecore_x_window_size_get(ee->prop.window, &w, &h); + ecore_x_window_resize(ee->prop.window, h, w); if ((rotation == 0) || (rotation == 180)) { evas_output_size_set(ee->evas, ee->w, ee->h); @@ -1566,15 +1379,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_x_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_x_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); } @@ -1643,7 +1456,7 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */ if (!ee->engine.x.mask) - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB gc = xcb_generate_id(ecore_x_connection_get()); value_list = 0; @@ -1671,7 +1484,7 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) einfo->info.mask = ee->engine.x.mask; 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_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } else { @@ -1679,8 +1492,8 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) ee->engine.x.mask = 0; einfo->info.mask = 0; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - ecore_x_window_shape_mask_set(ee->engine.x.win, 0); - ecore_x_window_shape_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } } #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 || BUILD_ECORE_EVAS_SOFTWARE_XCB */ @@ -1714,7 +1527,7 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) # endif /* ! BUILD_ECORE_EVAS_XRENDER_XCB */ if (!ee->engine.x.mask) - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); # ifdef BUILD_ECORE_EVAS_XRENDER_XCB gc = xcb_generate_id(ecore_x_connection_get()); value_list = 0; @@ -1742,7 +1555,7 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) einfo->info.mask = ee->engine.x.mask; 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_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } else { @@ -1750,8 +1563,8 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) ee->engine.x.mask = 0; einfo->info.mask = 0; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - ecore_x_window_shape_mask_set(ee->engine.x.win, 0); - ecore_x_window_shape_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } } #endif /* BUILD_ECORE_EVAS_XRENDER_X11 || BUILD_ECORE_EVAS_XRENDER_XCB */ @@ -1771,7 +1584,7 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) GC gc; XGCValues gcv; - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); einfo->info.mask = ee->engine.x.mask; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); @@ -1782,7 +1595,7 @@ _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) ee->engine.x.mask = 0; einfo->info.mask = 0; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - ecore_x_window_shape_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_mask_set(ee->prop.window, 0); } } # endif /* XXX no shaped window support for software_16_x11 */ @@ -1819,33 +1632,33 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ee->shaped = 0; ee->alpha = alpha; - ecore_x_window_del(ee->engine.x.win); - eina_hash_del(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_x_window_del(ee->prop.window); + ecore_evas_unregister(ee, ee->prop.window); if (ee->alpha) { if (ee->prop.override) - ee->engine.x.win = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); else - ee->engine.x.win = ecore_x_window_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); if (!ee->engine.x.mask) - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); } else { if (ee->prop.override) - ee->engine.x.win = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); else - ee->engine.x.win = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); ee->engine.x.mask = 0; - ecore_x_window_shape_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } einfo->info.destination_alpha = alpha; # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB - cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->engine.x.win); - cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->engine.x.win); + cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window); + cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL); reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); @@ -1855,7 +1668,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) free(reply_geom); free(reply_attr); # else - XGetWindowAttributes(ecore_x_display_get(), ee->engine.x.win, &att); + XGetWindowAttributes(ecore_x_display_get(), ee->prop.window, &att); einfo->info.visual = att.visual; einfo->info.colormap = att.colormap; einfo->info.depth = att.depth; @@ -1864,21 +1677,19 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) // if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); // ee->engine.x.mask = 0; einfo->info.mask = ee->engine.x.mask; - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; 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->engine.x.win, 0); - if (!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_evas_register(ee, ee->prop.window); if (ee->prop.borderless) - ecore_x_mwm_borderless_set(ee->engine.x.win, ee->prop.borderless); - if (ee->visible) ecore_x_window_show(ee->engine.x.win); - if (ee->prop.focused) ecore_x_window_focus(ee->engine.x.win); + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); if (ee->prop.title) { - ecore_x_icccm_title_set(ee->engine.x.win, ee->prop.title); - ecore_x_netwm_name_set(ee->engine.x.win, ee->prop.title); + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 || BUILD_ECORE_EVAS_SOFTWARE_XCB */ } @@ -1893,59 +1704,57 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ee->shaped = 0; ee->alpha = alpha; - ecore_x_window_del(ee->engine.x.win); - eina_hash_del(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_x_window_del(ee->prop.window); + ecore_evas_unregister(ee, ee->prop.window); if (ee->alpha) { if (ee->prop.override) - ee->engine.x.win = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); else - ee->engine.x.win = ecore_x_window_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); if (!ee->engine.x.mask) - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); } else { if (ee->prop.override) - ee->engine.x.win = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); else - ee->engine.x.win = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); ee->engine.x.mask = 0; - ecore_x_window_shape_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } einfo->info.destination_alpha = alpha; # ifdef BUILD_ECORE_EVAS_XRENDER_XCB - cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->engine.x.win); + cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); einfo->info.visual = reply_attr->visual; free(reply_attr); # else - XGetWindowAttributes(ecore_x_display_get(), ee->engine.x.win, &att); + XGetWindowAttributes(ecore_x_display_get(), ee->prop.window, &att); einfo->info.visual = att.visual; # endif /* ! BUILD_ECORE_EVAS_XRENDER_XCB */ // if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); // ee->engine.x.mask = 0; einfo->info.mask = ee->engine.x.mask; - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; 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->engine.x.win, 0); - if (!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_evas_register(ee, ee->prop.window); if (ee->prop.borderless) - ecore_x_mwm_borderless_set(ee->engine.x.win, ee->prop.borderless); - if (ee->visible) ecore_x_window_show(ee->engine.x.win); - if (ee->prop.focused) ecore_x_window_focus(ee->engine.x.win); + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); if (ee->prop.title) { - ecore_x_icccm_title_set(ee->engine.x.win, ee->prop.title); - ecore_x_netwm_name_set(ee->engine.x.win, ee->prop.title); + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } #endif /* BUILD_ECORE_EVAS_XRENDER_X11 || BUILD_ECORE_EVAS_XRENDER_XCB */ } @@ -1959,26 +1768,26 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ee->shaped = 0; ee->alpha = alpha; - ecore_x_window_del(ee->engine.x.win); - eina_hash_del(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_x_window_del(ee->prop.window); + ecore_evas_unregister(ee, ee->prop.window); if (ee->alpha) { if (ee->prop.override) - ee->engine.x.win = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); else - ee->engine.x.win = ecore_x_window_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); if (!ee->engine.x.mask) - ee->engine.x.mask = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 1); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); } else { if (ee->prop.override) - ee->engine.x.win = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); else - ee->engine.x.win = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h); if (ee->engine.x.mask) ecore_x_pixmap_del(ee->engine.x.mask); ee->engine.x.mask = 0; - ecore_x_window_shape_input_mask_set(ee->engine.x.win, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); } # if 0 /* XXX no alpha window support for software_16_x11 */ @@ -1991,21 +1800,19 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) einfo->info.mask = ee->engine.x.mask; # endif /* XXX no shaped window support for software_16_x11 */ - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; 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->engine.x.win, 0); - if (!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_x_winid_str_get(ee->engine.x.win), ee); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_evas_register(ee, ee->prop.window); if (ee->prop.borderless) - ecore_x_mwm_borderless_set(ee->engine.x.win, ee->prop.borderless); - if (ee->visible) ecore_x_window_show(ee->engine.x.win); - if (ee->prop.focused) ecore_x_window_focus(ee->engine.x.win); + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); if (ee->prop.title) { - ecore_x_icccm_title_set(ee->engine.x.win, ee->prop.title); - ecore_x_netwm_name_set(ee->engine.x.win, ee->prop.title); + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ } @@ -2016,7 +1823,7 @@ static void * _ecore_evas_x_window_get(const Ecore_Evas *ee) { #ifdef BUILD_ECORE_EVAS_X11 - return (void *) (long)ee->engine.x.win; + return (void *) (long)ee->prop.window; #else return 0; #endif /* BUILD_ECORE_EVAS_X11 */ @@ -2029,15 +1836,15 @@ _ecore_evas_x_show(Ecore_Evas *ee) ee->should_be_visible = 1; if (ee->prop.avoid_damage) _ecore_evas_x_render(ee); - ecore_x_window_show(ee->engine.x.win); + ecore_x_window_show(ee->prop.window); if (ee->prop.fullscreen) - ecore_x_window_focus(ee->engine.x.win); + ecore_x_window_focus(ee->prop.window); } static void _ecore_evas_x_hide(Ecore_Evas *ee) { - ecore_x_window_hide(ee->engine.x.win); + ecore_x_window_hide(ee->prop.window); ee->should_be_visible = 0; } @@ -2045,25 +1852,25 @@ static void _ecore_evas_x_raise(Ecore_Evas *ee) { if (!ee->prop.fullscreen) - ecore_x_window_raise(ee->engine.x.win); + ecore_x_window_raise(ee->prop.window); else - ecore_x_window_raise(ee->engine.x.win); + ecore_x_window_raise(ee->prop.window); } static void _ecore_evas_x_lower(Ecore_Evas *ee) { if (!ee->prop.fullscreen) - ecore_x_window_lower(ee->engine.x.win); + ecore_x_window_lower(ee->prop.window); else - ecore_x_window_lower(ee->engine.x.win); + ecore_x_window_lower(ee->prop.window); } static void _ecore_evas_x_activate(Ecore_Evas *ee) { ecore_x_netwm_client_active_request(ee->engine.x.win_root, - ee->engine.x.win, 2, 0); + ee->prop.window, 2, 0); } static void @@ -2072,8 +1879,8 @@ _ecore_evas_x_title_set(Ecore_Evas *ee, const char *t) if (ee->prop.title) free(ee->prop.title); ee->prop.title = NULL; if (t) ee->prop.title = strdup(t); - ecore_x_icccm_title_set(ee->engine.x.win, ee->prop.title); - ecore_x_netwm_name_set(ee->engine.x.win, ee->prop.title); + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } static void @@ -2085,7 +1892,7 @@ _ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c) ee->prop.clas = NULL; ee->prop.name = strdup(n); ee->prop.clas = strdup(c); - ecore_x_icccm_name_class_set(ee->engine.x.win, ee->prop.name, ee->prop.clas); + ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas); } static void @@ -2155,7 +1962,7 @@ _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - ecore_x_window_cursor_show(ee->engine.x.win, 1); + ecore_x_window_cursor_show(ee->prop.window, 1); return; } @@ -2164,7 +1971,7 @@ _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - ecore_x_window_cursor_show(ee->engine.x.win, 0); + ecore_x_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); @@ -2204,7 +2011,7 @@ _ecore_evas_x_layer_set(Ecore_Evas *ee, int layer) static void _ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__) { - ecore_x_window_focus(ee->engine.x.win); + ecore_x_window_focus(ee->prop.window); } static void @@ -2215,7 +2022,7 @@ _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) ee->prop.iconified = on; if (on) { - ecore_x_icccm_hints_set(ee->engine.x.win, + ecore_x_icccm_hints_set(ee->prop.window, 1 /* accepts_focus */, ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */, 0 /* icon_pixmap */, @@ -2223,11 +2030,11 @@ _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) 0 /* icon_window */, 0 /* window_group */, 0 /* is_urgent */); - ecore_x_icccm_iconic_request_send(ee->engine.x.win, ee->engine.x.win_root); + ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); } else { - ecore_x_icccm_hints_set(ee->engine.x.win, + ecore_x_icccm_hints_set(ee->prop.window, 1 /* accepts_focus */, ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, 0 /* icon_pixmap */, @@ -2245,7 +2052,7 @@ _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on) if (((ee->prop.borderless) && (on)) || ((!ee->prop.borderless) && (!on))) return; ee->prop.borderless = on; - ecore_x_mwm_borderless_set(ee->engine.x.win, ee->prop.borderless); + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); } /* FIXME: This function changes the initial state of the ee @@ -2264,7 +2071,7 @@ _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) else hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; - ecore_x_icccm_hints_set(ee->engine.x.win, + ecore_x_icccm_hints_set(ee->prop.window, 1 /* accepts_focus */, hint /* initial_state */, 0 /* icon_pixmap */, @@ -2287,7 +2094,7 @@ _ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky) */ ee->engine.x.state.sticky = sticky; if (ee->should_be_visible) - ecore_x_netwm_state_request_send(ee->engine.x.win, ee->engine.x.win_root, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_STICKY, -1, sticky); else _ecore_evas_x_state_update(ee); @@ -2302,14 +2109,14 @@ _ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore) if (ignore) { ee->ignore_events = 1; - if (ee->engine.x.win) - ecore_x_window_ignore_set(ee->engine.x.win, 1); + if (ee->prop.window) + ecore_x_window_ignore_set(ee->prop.window, 1); } else { ee->ignore_events = 0; - if (ee->engine.x.win) - ecore_x_window_ignore_set(ee->engine.x.win, 0); + if (ee->prop.window) + ecore_x_window_ignore_set(ee->prop.window, 0); } } @@ -2325,7 +2132,7 @@ _ecore_evas_x_reinit_win(Ecore_Evas *ee) einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); if (einfo) { - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } #endif @@ -2338,7 +2145,7 @@ _ecore_evas_x_reinit_win(Ecore_Evas *ee) einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(ee->evas); if (einfo) { - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } #endif @@ -2351,7 +2158,7 @@ _ecore_evas_x_reinit_win(Ecore_Evas *ee) einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); if (einfo) { - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } #endif @@ -2364,10 +2171,10 @@ _ecore_evas_x_override_set(Ecore_Evas *ee, int on) { if (((ee->prop.override) && (on)) || ((!ee->prop.override) && (!on))) return; - ecore_x_window_hide(ee->engine.x.win); - ecore_x_window_override_set(ee->engine.x.win, on); - if (ee->visible) ecore_x_window_show(ee->engine.x.win); - if (ee->prop.focused) ecore_x_window_focus(ee->engine.x.win); + ecore_x_window_hide(ee->prop.window); + ecore_x_window_override_set(ee->prop.window, on); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); ee->prop.override = on; } @@ -2381,7 +2188,7 @@ _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on) * i.e. reposition, resize, and change borderless hint */ ee->engine.x.state.fullscreen = on; if (ee->should_be_visible) - ecore_x_netwm_state_request_send(ee->engine.x.win, ee->engine.x.win_root, + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on); else _ecore_evas_x_state_update(ee); @@ -2405,7 +2212,7 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) { if (ee->prop.avoid_damage) { - ee->engine.x.pmap = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, einfo->info.depth); + ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap); einfo->info.drawable = ee->engine.x.pmap; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -2416,14 +2223,14 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) { ee->engine.x.using_bg_pixmap = 1; - ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); - ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); } if (ee->engine.x.direct_resize) { /* Turn this off for now ee->engine.x.using_bg_pixmap = 1; - ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); */ } } @@ -2433,13 +2240,13 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) if (ee->engine.x.gc) ecore_x_gc_del(ee->engine.x.gc); if (ee->engine.x.using_bg_pixmap) { - ecore_x_window_pixmap_set(ee->engine.x.win, 0); + ecore_x_window_pixmap_set(ee->prop.window, 0); ee->engine.x.using_bg_pixmap = 0; - ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); } ee->engine.x.pmap = 0; ee->engine.x.gc = 0; - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } } @@ -2456,7 +2263,7 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) { if (ee->prop.avoid_damage) { - ee->engine.x.pmap = ecore_x_pixmap_new(ee->engine.x.win, ee->w, ee->h, 16); + ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16); ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap); einfo->info.drawable = ee->engine.x.pmap; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -2468,7 +2275,7 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) { /* Turn this off for now ee->engine.x.using_bg_pixmap = 1; - ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); */ } } @@ -2478,12 +2285,12 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) if (ee->engine.x.gc) ecore_x_gc_del(ee->engine.x.gc); if (ee->engine.x.using_bg_pixmap) { - ecore_x_window_pixmap_set(ee->engine.x.win, 0); + ecore_x_window_pixmap_set(ee->prop.window, 0); ee->engine.x.using_bg_pixmap = 0; } ee->engine.x.pmap = 0; ee->engine.x.gc = 0; - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } } @@ -2500,11 +2307,12 @@ _ecore_evas_x_shutdown(void) int i; while (ecore_evases) _ecore_evas_free(ecore_evases); - for (i = 0; i < 18; i++) + for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++) ecore_event_handler_del(ecore_evas_event_handlers[i]); 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(); } if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; return _ecore_evas_init_count; @@ -2556,8 +2364,7 @@ static const Ecore_Evas_Engine_Func _ecore_x_engine_func = _ecore_evas_x_withdrawn_set, _ecore_evas_x_sticky_set, _ecore_evas_x_ignore_events_set, - _ecore_evas_x_alpha_set, - _ecore_evas_x_window_get + _ecore_evas_x_alpha_set }; #endif /* BUILD_ECORE_EVAS_X11 */ @@ -2628,17 +2435,17 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, /* FIXME: round trip in ecore_x_window_argb_get */ if (ecore_x_window_argb_get(parent)) { - ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); argb = 1; } else - ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); } else - ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); if (getenv("DESKTOP_STARTUP_ID")) { - ecore_x_netwm_startup_id_set(ee->engine.x.win, + ecore_x_netwm_startup_id_set(ee->prop.window, getenv("DESKTOP_STARTUP_ID")); /* NB: on linux this may simply empty the env as opposed to completely * unset it to being empty - unsure as solartis libc crashes looking @@ -2740,7 +2547,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, einfo->info.connection = ecore_x_display_get(); einfo->info.screen = NULL; # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */ - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; if (argb) { /* FIXME: round trip */ @@ -2750,8 +2557,8 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, xcb_get_geometry_reply_t *reply_geom; xcb_get_window_attributes_reply_t *reply_attr; - cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->engine.x.win); - cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->engine.x.win); + cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window); + cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL); reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); @@ -2767,7 +2574,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, # else XWindowAttributes at; - if (XGetWindowAttributes(ecore_x_display_get(), ee->engine.x.win, + if (XGetWindowAttributes(ecore_x_display_get(), ee->prop.window, &at)) { einfo->info.visual = at.visual; @@ -2797,24 +2604,13 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, einfo->info.debug = redraw_debug; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } - 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_x_winid_str_get(ee->engine.x.win), ee); + ecore_evas_register(ee, ee->prop.window); return ee; #else return NULL; -#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_X11 && ! BUILD_ECORE_EVAS_SOFTWARE_XCB */ +#endif } /** @@ -2826,7 +2622,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_window_get(const Ecore_Evas *ee) { #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_XCB) - return (Ecore_X_Window) (long)_ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif @@ -2841,7 +2637,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_subwindow_get(const Ecore_Evas *ee) { #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_XCB) - return (Ecore_X_Window) (long)_ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif @@ -2863,15 +2659,15 @@ ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, int on) { /* turn this off for now ee->engine.x.using_bg_pixmap = 1; - ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); */ } else { /* turn this off too- bg pixmap is controlled by avoid damage directly ee->engine.x.using_bg_pixmap = 0; - ecore_x_window_pixmap_set(ee->engine.x.win, 0); - ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); + ecore_x_window_pixmap_set(ee->prop.window, 0); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); */ } } @@ -2911,9 +2707,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); - if (!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_x_winid_str_get(win), ee); + ecore_evas_register(ee, win); } #else #endif @@ -2977,32 +2771,21 @@ ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); if (einfo) { - ee->engine.x.win = _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, x, y, w, h, 0); + ee->prop.window = _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, x, y, w, h, 0); evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } if (getenv("DESKTOP_STARTUP_ID")) { - ecore_x_netwm_startup_id_set(ee->engine.x.win, + ecore_x_netwm_startup_id_set(ee->prop.window, getenv("DESKTOP_STARTUP_ID")); /* NB: on linux this may simply empty the env as opposed to completely * unset it to being empty - unsure as solartis libc crashes looking * for the '=' char */ // putenv((char*)"DESKTOP_STARTUP_ID="); } - 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_x_winid_str_get(ee->engine.x.win), ee); + ecore_evas_register(ee, ee->prop.window); # endif /* HAVE_ECORE_X_XCB */ return ee; @@ -3023,7 +2806,7 @@ EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) { #ifdef BUILD_ECORE_EVAS_OPENGL_X11 - return (Ecore_X_Window) _ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ @@ -3038,7 +2821,7 @@ EAPI Ecore_X_Window ecore_evas_gl_x11_subwindow_get(const Ecore_Evas *ee) { #ifdef BUILD_ECORE_EVAS_OPENGL_X11 - return (Ecore_X_Window) _ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ @@ -3150,10 +2933,10 @@ ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, evas_output_viewport_set(ee->evas, 0, 0, w, h); ee->engine.x.win_root = parent; - ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); if (getenv("DESKTOP_STARTUP_ID")) { - ecore_x_netwm_startup_id_set(ee->engine.x.win, + ecore_x_netwm_startup_id_set(ee->prop.window, getenv("DESKTOP_STARTUP_ID")); /* NB: on linux this may simply empty the env as opposed to completely * unset it to being empty - unsure as solartis libc crashes looking @@ -3246,24 +3029,13 @@ ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, } einfo->info.display = ecore_x_display_get(); einfo->info.visual = DefaultVisual(ecore_x_display_get(), screen); -# endif /* ! BUILD_ECORE_EVAS_XRENDER_XCB */ - einfo->info.drawable = ee->engine.x.win; +# endif /* HAVE_ECORE_X_XCB */ + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } - 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_x_winid_str_get(ee->engine.x.win), ee); + ecore_evas_register(ee, ee->prop.window); return ee; #else return NULL; @@ -3279,7 +3051,7 @@ EAPI Ecore_X_Window ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee) { #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB) - return (Ecore_X_Window) _ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */ @@ -3294,7 +3066,7 @@ EAPI Ecore_X_Window ecore_evas_xrender_x11_subwindow_get(const Ecore_Evas *ee) { #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB) - return (Ecore_X_Window) _ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */ @@ -3403,17 +3175,17 @@ ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, /* FIXME: round trip in ecore_x_window_argb_get */ if (ecore_x_window_argb_get(parent)) { - ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); argb = 1; } else - ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); } else - ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); if (getenv("DESKTOP_STARTUP_ID")) { - ecore_x_netwm_startup_id_set(ee->engine.x.win, + ecore_x_netwm_startup_id_set(ee->prop.window, getenv("DESKTOP_STARTUP_ID")); /* NB: on linux this may simply empty the env as opposed to completely * unset it to being empty - unsure as solartis libc crashes looking @@ -3462,24 +3234,13 @@ ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, redraw_debug = 0; } einfo->info.display = ecore_x_display_get(); - einfo->info.drawable = ee->engine.x.win; + einfo->info.drawable = ee->prop.window; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); } - 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_x_winid_str_get(ee->engine.x.win), ee); + ecore_evas_register(ee, ee->prop.window); return ee; #else return NULL; @@ -3495,7 +3256,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee) { #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 - return (Ecore_X_Window) _ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ @@ -3510,7 +3271,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_16_subwindow_get(const Ecore_Evas *ee) { #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 - return (Ecore_X_Window) _ecore_evas_x_window_get(ee); + return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ @@ -3532,15 +3293,15 @@ ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, int on) { /* turn this off for now ee->engine.x.using_bg_pixmap = 1; - ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); */ } else { /* turn this off too- bg pixmap is controlled by avoid damage directly ee->engine.x.using_bg_pixmap = 0; - ecore_x_window_pixmap_set(ee->engine.x.win, 0); - ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); + ecore_x_window_pixmap_set(ee->prop.window, 0); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); */ } } @@ -3580,9 +3341,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); - if(!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_x_winid_str_get(win), ee); + ecore_evas_register(ee, win); } #else #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ diff --git a/legacy/ecore/src/lib/ecore_input/Ecore_Input.h b/legacy/ecore/src/lib/ecore_input/Ecore_Input.h new file mode 100644 index 0000000000..0a30b3be59 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_input/Ecore_Input.h @@ -0,0 +1,216 @@ +#ifndef _ECORE_INPUT_H +# define _ECORE_INPUT_H + +#ifdef EAPI +#undef EAPI +#endif +#ifdef _MSC_VER +# ifdef BUILDING_DLL +# define EAPI __declspec(dllexport) +# else +# define EAPI __declspec(dllimport) +# endif +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +EAPI extern int ECORE_EVENT_KEY_DOWN; +EAPI extern int ECORE_EVENT_KEY_UP; +EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN; +EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP; +EAPI extern int ECORE_EVENT_MOUSE_MOVE; +EAPI extern int ECORE_EVENT_MOUSE_WHEEL; +EAPI extern int ECORE_EVENT_MOUSE_IN; +EAPI extern int ECORE_EVENT_MOUSE_OUT; + +#define ECORE_EVENT_MODIFIER_SHIFT 0x0001 +#define ECORE_EVENT_MODIFIER_CTRL 0x0002 +#define ECORE_EVENT_MODIFIER_ALT 0x0004 +#define ECORE_EVENT_MODIFIER_WIN 0x0008 +#define ECORE_EVENT_MODIFIER_SCROLL 0x0010 +#define ECORE_EVENT_MODIFIER_NUM 0x0020 +#define ECORE_EVENT_MODIFIER_CAPS 0x0040 +#define ECORE_EVENT_LOCK_SCROLL 0x0080 +#define ECORE_EVENT_LOCK_NUM 0x0100 +#define ECORE_EVENT_LOCK_CAPS 0x0200 + +typedef unsigned int Ecore_Window; + +typedef struct _Ecore_Event_Key Ecore_Event_Key; +struct _Ecore_Event_Key +{ + const char *keyname; + const char *key; + const char *string; + const char *compose; + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int same_screen; +}; + +typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button; +struct _Ecore_Event_Mouse_Button +{ + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + unsigned int buttons; + unsigned int double_click; + unsigned int triple_click; + int same_screen; + + int x; + int y; + struct + { + int x; + int y; + } root; +}; + +typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel; +struct _Ecore_Event_Mouse_Wheel +{ + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int same_screen; + int direction; + int z; + + int x; + int y; + struct + { + int x; + int y; + } root; +}; + +typedef struct _Ecore_Event_Mouse_Move Ecore_Event_Mouse_Move; +struct _Ecore_Event_Mouse_Move +{ + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int same_screen; + + int x; + int y; + struct + { + int x; + int y; + } root; +}; + +typedef struct _Ecore_Event_Mouse_IO Ecore_Event_Mouse_IO; +struct _Ecore_Event_Mouse_IO +{ + Ecore_Window window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int x; + int y; +}; + +enum _Ecore_Event_Modifier +{ + ECORE_NONE, + ECORE_SHIFT, + ECORE_CTRL, + ECORE_ALT, + ECORE_WIN, + ECORE_SCROLL, + ECORE_CAPS, + ECORE_LAST +}; + +enum _Ecore_Event_Press +{ + ECORE_DOWN, + ECORE_UP +}; + +enum _Ecore_Event_IO +{ + ECORE_IN, + ECORE_OUT +}; + +typedef enum _Ecore_Event_IO Ecore_Event_IO; +typedef enum _Ecore_Event_Press Ecore_Event_Press; +typedef enum _Ecore_Event_Modifier Ecore_Event_Modifier; + +typedef struct _Ecore_Event_Modifiers Ecore_Event_Modifiers; +struct _Ecore_Event_Modifiers +{ + unsigned int size; + unsigned int array[ECORE_LAST]; +}; + +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_evas_event_init(void); +EAPI int ecore_evas_event_shutdown(void); + +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_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 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/legacy/ecore/src/lib/ecore_input/Makefile.am b/legacy/ecore/src/lib/ecore_input/Makefile.am new file mode 100644 index 0000000000..93803065f4 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_input/Makefile.am @@ -0,0 +1,68 @@ +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_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_SDL_INC) \ +@EVAS_CFLAGS@ + +if BUILD_ECORE_INPUT + +lib_LTLIBRARIES = libecore_input.la +include_HEADERS = Ecore_Input.h + +libecore_input_la_SOURCES = \ +ecore_input.c + +libecore_input_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EVIL_LIBS@ + +libecore_input_la_LDFLAGS = @lt_enable_auto_import@ -version-info @version_info@ + +libecore_input_la_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore/libecore.la + +endif + +EXTRA_DIST = \ +ecore_input.c \ +Ecore_Input.h + diff --git a/legacy/ecore/src/lib/ecore_input/ecore_input.c b/legacy/ecore/src/lib/ecore_input/ecore_input.c new file mode 100644 index 0000000000..0fe0883350 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_input/ecore_input.c @@ -0,0 +1,448 @@ +#include + +#include "config.h" +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Input.h" + +EAPI int ECORE_EVENT_KEY_DOWN = 0; +EAPI int ECORE_EVENT_KEY_UP = 0; +EAPI int ECORE_EVENT_MOUSE_BUTTON_DOWN = 0; +EAPI int ECORE_EVENT_MOUSE_BUTTON_UP = 0; +EAPI int ECORE_EVENT_MOUSE_MOVE = 0; +EAPI int ECORE_EVENT_MOUSE_WHEEL = 0; +EAPI int ECORE_EVENT_MOUSE_IN = 0; +EAPI int ECORE_EVENT_MOUSE_OUT = 0; + +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 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; +} + +EAPI void +ecore_evas_event_modifier_lock_update(Evas *e, unsigned int modifiers) +{ + if (modifiers & ECORE_EVENT_MODIFIER_SHIFT) + evas_key_modifier_on(e, "Shift"); + else evas_key_modifier_off(e, "Shift"); + + if (modifiers & ECORE_EVENT_MODIFIER_CTRL) + evas_key_modifier_on(e, "Control"); + else evas_key_modifier_off(e, "Control"); + + if (modifiers & ECORE_EVENT_MODIFIER_ALT) + evas_key_modifier_on(e, "Alt"); + else evas_key_modifier_off(e, "Alt"); + + if (modifiers & ECORE_EVENT_MODIFIER_WIN) + { + evas_key_modifier_on(e, "Super"); + evas_key_modifier_on(e, "Hyper"); + } + else + { + evas_key_modifier_off(e, "Super"); + evas_key_modifier_off(e, "Hyper"); + } + + if (modifiers & ECORE_EVENT_LOCK_SCROLL) + evas_key_lock_on(e, "Scroll_Lock"); + else evas_key_lock_off(e, "Scroll_Lock"); + + if (modifiers & ECORE_EVENT_LOCK_NUM) + evas_key_lock_on(e, "Num_Lock"); + else evas_key_lock_off(e, "Num_Lock"); + + if (modifiers & ECORE_EVENT_LOCK_CAPS) + evas_key_lock_on(e, "Caps_Lock"); + else evas_key_lock_off(e, "Caps_Lock"); +} + +EAPI void +ecore_evas_register(Ecore_Evas *ee, Ecore_Window window) +{ + _ecore_evases_hash = evas_hash_add(_ecore_evases_hash, _ecore_evas_winid_str_get(window), ee); + + 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"); +} + +EAPI void +ecore_evas_unregister(Ecore_Evas *ee, Ecore_Window window) +{ + _ecore_evases_hash = evas_hash_del(_ecore_evases_hash, _ecore_evas_winid_str_get(window), ee); +} + +EAPI Ecore_Evas* +ecore_evas_window_match(Ecore_Window window) +{ + return evas_hash_find(_ecore_evases_hash, _ecore_evas_winid_str_get(window)); +} + +EAPI 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); + 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_event_key(Ecore_Event_Key *e, Ecore_Event_Press press) +{ + Ecore_Evas *ee; + + 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); + if (press == ECORE_DOWN) + evas_event_feed_key_down(ee->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); + return 1; +} + +static int +_ecore_evas_event_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press) +{ + Ecore_Evas *ee; + 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); + 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); + else + evas_event_feed_mouse_up(ee->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_Evas *ee; + + 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); + switch (io) + { + case ECORE_IN: + evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL); + break; + case ECORE_OUT: + evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL); + break; + default: + break; + } + + ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); + return 1; +} +#endif + +EAPI int +ecore_evas_event_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); +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_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); +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_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); +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_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); +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +{ +#ifdef BUILD_ECORE_EVAS + Ecore_Event_Mouse_Wheel *e; + Ecore_Evas *ee; + + 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); + + return 1; +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) +{ +#ifdef BUILD_ECORE_EVAS + Ecore_Event_Mouse_Move *e; + Ecore_Evas *ee; + + 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); + return 1; +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_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); +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_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); +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_init(void) +{ +#ifdef BUILD_ECORE_EVAS + if (!_ecore_evas_event_init_count) + { + ecore_event_init(); + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + ecore_evas_event_key_down, + NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP, + ecore_evas_event_key_up, + NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, + ecore_evas_event_mouse_button_down, + NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, + ecore_evas_event_mouse_button_up, + NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, + ecore_evas_event_mouse_move, + NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, + ecore_evas_event_mouse_wheel, + NULL); + ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, + ecore_evas_event_mouse_in, + NULL); + ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, + ecore_evas_event_mouse_out, + NULL); + } + return ++_ecore_evas_event_init_count; +#else + return 0; +#endif +} + +EAPI int +ecore_evas_event_shutdown(void) +{ +#ifdef BUILD_ECORE_EVAS + if (_ecore_evas_event_init_count == 1) + { + int i; + + 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_handlers[i] = NULL; + } + + ecore_event_shutdown(); + } + return --_ecore_evas_event_init_count; +#else + return 0; +#endif +} + +typedef struct _Ecore_Event_Modifier_Match Ecore_Event_Modifier_Match; +struct _Ecore_Event_Modifier_Match +{ + const char *key; + Ecore_Event_Modifier modifier; + unsigned int event_modifier; +}; + +static const Ecore_Event_Modifier_Match matchs[] = { + { "Shift_L", ECORE_SHIFT, ECORE_EVENT_MODIFIER_SHIFT }, + { "Shift_R", ECORE_SHIFT, ECORE_EVENT_MODIFIER_SHIFT }, + { "Alt_L", ECORE_ALT, ECORE_EVENT_MODIFIER_ALT }, + { "Alt_R", ECORE_ALT, ECORE_EVENT_MODIFIER_ALT }, + { "Control_L", ECORE_CTRL, ECORE_EVENT_MODIFIER_CTRL }, + { "Control_R", ECORE_CTRL, ECORE_EVENT_MODIFIER_CTRL }, + { "Caps_Lock", ECORE_CAPS, ECORE_EVENT_MODIFIER_CAPS }, + { "Super_L", ECORE_WIN, ECORE_EVENT_MODIFIER_WIN }, + { "Super_R", ECORE_WIN, ECORE_EVENT_MODIFIER_WIN }, + { "Scroll_Lock", ECORE_SCROLL, ECORE_EVENT_MODIFIER_SCROLL } +}; + +EAPI unsigned int +ecore_event_modifier_mask(Ecore_Event_Modifier modifier) +{ + int i; + + for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++) + if (matchs[i].modifier == modifier) + return matchs[i].event_modifier; + + return 0; +} + +EAPI Ecore_Event_Modifier +ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc) +{ + int i; + + for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++) + if (strcmp(matchs[i].key, key) == 0) + { + if (modifiers && matchs[i].modifier < modifiers->size) + modifiers->array[matchs[i].modifier] += inc; + return matchs[i].modifier; + } + + return ECORE_NONE; +} + +EAPI int +ecore_event_init(void) +{ + if (!_ecore_event_init_count) + { + ECORE_EVENT_KEY_DOWN = ecore_event_type_new(); + ECORE_EVENT_KEY_UP = ecore_event_type_new(); + ECORE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); + ECORE_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); + ECORE_EVENT_MOUSE_MOVE = ecore_event_type_new(); + ECORE_EVENT_MOUSE_WHEEL = ecore_event_type_new(); + ECORE_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_EVENT_MOUSE_OUT = ecore_event_type_new(); + } + return ++_ecore_event_init_count; +} + +EAPI int +ecore_event_shutdown(void) +{ + if (_ecore_event_init_count == 1) + { + ECORE_EVENT_KEY_DOWN = 0; + ECORE_EVENT_KEY_UP = 0; + ECORE_EVENT_MOUSE_BUTTON_DOWN = 0; + ECORE_EVENT_MOUSE_BUTTON_UP = 0; + ECORE_EVENT_MOUSE_MOVE = 0; + ECORE_EVENT_MOUSE_WHEEL = 0; + ECORE_EVENT_MOUSE_IN = 0; + ECORE_EVENT_MOUSE_OUT = 0; + } + return ++_ecore_event_init_count; +} diff --git a/legacy/ecore/src/lib/ecore_sdl/Makefile.am b/legacy/ecore/src/lib/ecore_sdl/Makefile.am index 2c2011ba3a..07436790d4 100644 --- a/legacy/ecore/src/lib/ecore_sdl/Makefile.am +++ b/legacy/ecore/src/lib/ecore_sdl/Makefile.am @@ -2,7 +2,11 @@ MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ -I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ @EFL_ECORE_SDL_BUILD@ \ @SDL_CFLAGS@ \ @EINA_CFLAGS@ @@ -18,8 +22,8 @@ ecore_sdl.c libecore_sdl_la_LIBADD = \ $(top_builddir)/src/lib/ecore/libecore.la \ -@SDL_LIBS@ \ -@EINA_LIBS@ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@SDL_LIBS@ @EVIL_LIBS@ @EINA_LIBS@ libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ diff --git a/legacy/ecore/src/lib/ecore_sdl/ecore_sdl.c b/legacy/ecore/src/lib/ecore_sdl/ecore_sdl.c index 3187c3d952..1547c40fc6 100644 --- a/legacy/ecore/src/lib/ecore_sdl/ecore_sdl.c +++ b/legacy/ecore/src/lib/ecore_sdl/ecore_sdl.c @@ -8,24 +8,48 @@ #include +#include "Eina.h" #include "Ecore_Sdl.h" #include "ecore_private.h" +#include "Ecore_Input.h" #include "Ecore.h" #include "Ecore_Data.h" #include "Ecore_Sdl_Keys.h" -EAPI int ECORE_SDL_EVENT_KEY_DOWN = 0; -EAPI int ECORE_SDL_EVENT_KEY_UP = 0; -EAPI int ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN = 0; -EAPI int ECORE_SDL_EVENT_MOUSE_BUTTON_UP = 0; -EAPI int ECORE_SDL_EVENT_MOUSE_MOVE = 0; -EAPI int ECORE_SDL_EVENT_MOUSE_WHEEL = 0; +#include + +typedef struct _Ecore_SDL_Pressed Ecore_SDL_Pressed; +struct _Ecore_SDL_Pressed +{ + EINA_RBTREE; + + SDLKey key; +}; + EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0; EAPI int ECORE_SDL_EVENT_LOST_FOCUS = 0; EAPI int ECORE_SDL_EVENT_RESIZE = 0; EAPI int ECORE_SDL_EVENT_EXPOSE = 0; static int _ecore_sdl_init_count = 0; +static Eina_Rbtree *repeat = NULL; + +static Eina_Rbtree_Direction +_ecore_sdl_pressed_key(const Ecore_SDL_Pressed *left, + const Ecore_SDL_Pressed *right, + __UNUSED__ void *data) +{ + return left->key < right->key ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT; +} + +static int +_ecore_sdl_pressed_node(const Ecore_SDL_Pressed *node, + const SDLKey *key, + __UNUSED__ int length, + __UNUSED__ void *data) +{ + return node->key - *key; +} /** * @defgroup Ecore_Sdl_Library_Group Framebuffer Library Functions @@ -43,20 +67,17 @@ static int _ecore_sdl_init_count = 0; EAPI int ecore_sdl_init(const char *name __UNUSED__) { - if(!_ecore_sdl_init_count) - { - ECORE_SDL_EVENT_KEY_DOWN = ecore_event_type_new(); - ECORE_SDL_EVENT_KEY_UP = ecore_event_type_new(); - ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); - ECORE_SDL_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); - ECORE_SDL_EVENT_MOUSE_MOVE = ecore_event_type_new(); - ECORE_SDL_EVENT_MOUSE_WHEEL = ecore_event_type_new(); - ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new(); - ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new(); - ECORE_SDL_EVENT_RESIZE = ecore_event_type_new(); - ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new(); - } - return ++_ecore_sdl_init_count; + if(!_ecore_sdl_init_count) + { + ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new(); + ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new(); + ECORE_SDL_EVENT_RESIZE = ecore_event_type_new(); + ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new(); + + SDL_EnableKeyRepeat(200, 100); + } + ecore_event_init(); + return ++_ecore_sdl_init_count; } /** @@ -68,8 +89,37 @@ ecore_sdl_init(const char *name __UNUSED__) EAPI int ecore_sdl_shutdown(void) { - _ecore_sdl_init_count--; - return _ecore_sdl_init_count; + _ecore_sdl_init_count--; + ecore_event_shutdown(); + return _ecore_sdl_init_count; +} + +static Ecore_Event_Key* +_ecore_sdl_event_key(SDL_Event *event, double time) +{ + Ecore_Event_Key *ev; + unsigned int i; + + ev = malloc(sizeof(Ecore_Event_Key)); + if (!ev) return NULL; + + ev->timestamp = time; + ev->window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->key = NULL; + ev->compose = NULL; + + for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_sdl_keys_s); ++i) + if (keystable[i].code == event->key.keysym.sym) + { + ev->keyname = keystable[i].name; + ev->string = keystable[i].compose; + + return ev; + } + + free(ev); + return NULL; } EAPI void @@ -85,14 +135,20 @@ ecore_sdl_feed_events(void) { case SDL_MOUSEMOTION: { - Ecore_Sdl_Event_Mouse_Move *ev; + Ecore_Event_Mouse_Move *ev; - ev = malloc(sizeof(Ecore_Sdl_Event_Mouse_Move)); + ev = malloc(sizeof(Ecore_Event_Mouse_Move)); + if (!ev) return ; + + ev->timestamp = time; + ev->window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ ev->x = event.motion.x; ev->y = event.motion.y; - ev->time = time; + ev->root.x = ev->x; + ev->root.y = ev->y; - ecore_event_add(ECORE_SDL_EVENT_MOUSE_MOVE, ev, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); break; } case SDL_MOUSEBUTTONDOWN: @@ -100,46 +156,51 @@ ecore_sdl_feed_events(void) if (event.button.button == SDL_BUTTON_WHEELUP || event.button.button == SDL_BUTTON_WHEELDOWN) { - Ecore_Sdl_Event_Mouse_Wheel *ev; + Ecore_Event_Mouse_Wheel *ev; - ev = malloc(sizeof (Ecore_Sdl_Event_Mouse_Wheel)); - ev->x = event.button.x; - ev->y = event.button.y; + ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); + if (!ev) return ; + + ev->timestamp = time; + ev->window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ ev->direction = 0; - ev->wheel = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1; - ev->time = time; + ev->z = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1; - ecore_event_add(ECORE_SDL_EVENT_MOUSE_WHEEL, ev, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); } else { - Ecore_Sdl_Event_Mouse_Button_Down *ev; + Ecore_Event_Mouse_Button *ev; - ev = malloc(sizeof (Ecore_Sdl_Event_Mouse_Button_Down)); - ev->x = event.button.x; - ev->y = event.button.y; - ev->button = event.button.button; + ev = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return ; + + ev->timestamp = time; + ev->window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->buttons = event.button.button; ev->double_click = 0; ev->triple_click = 0; - ev->time = time; - ecore_event_add(ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); } break; } case SDL_MOUSEBUTTONUP: { - Ecore_Sdl_Event_Mouse_Button_Up *ev; + Ecore_Event_Mouse_Button *ev; - ev = malloc(sizeof (Ecore_Sdl_Event_Mouse_Button_Up)); - ev->x = event.button.x; - ev->y = event.button.y; - ev->button = event.button.button; + ev = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return ; + ev->timestamp = time; + ev->window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->buttons = event.button.button; ev->double_click = 0; ev->triple_click = 0; - ev->time = time; - ecore_event_add(ECORE_SDL_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); break; } case SDL_VIDEORESIZE: @@ -162,44 +223,48 @@ ecore_sdl_feed_events(void) case SDL_KEYDOWN: { - Ecore_Sdl_Event_Key_Down *ev; - unsigned int i; + Ecore_SDL_Pressed *entry; + Ecore_Event_Key *ev; - ev = malloc(sizeof (Ecore_Sdl_Event_Key_Down)); - ev->time = time; + entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym), + EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL); + if (entry) + { + ev = _ecore_sdl_event_key(&event, time); + if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + } - for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_sdl_keys_s); ++i) - if (keystable[i].code == event.key.keysym.sym) - { - ev->keyname = keystable[i].name; - ev->keycompose = keystable[i].compose; + ev = _ecore_sdl_event_key(&event, time); + if (ev) ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); - ecore_event_add(ECORE_SDL_EVENT_KEY_DOWN, ev, NULL, NULL); - return ; - } + if (!entry) + { + entry = malloc(sizeof (Ecore_SDL_Pressed)); + if (!entry) break; - free(ev); + entry->key = event.key.keysym.sym; + + repeat = eina_rbtree_inline_insert(repeat, EINA_RBTREE_GET(entry), + EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL); + } break; } case SDL_KEYUP: { - Ecore_Sdl_Event_Key_Up *ev; - unsigned int i; + Ecore_Event_Key *ev; + Ecore_SDL_Pressed *entry; - ev = malloc(sizeof (Ecore_Sdl_Event_Key_Up)); - ev->time = time; + entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym), + EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL); + if (entry) + { + repeat = eina_rbtree_inline_remove(repeat, EINA_RBTREE_GET(entry), + EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL); + free(entry); + } - for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_sdl_keys_s); ++i) - if (keystable[i].code == event.key.keysym.sym) - { - ev->keyname = keystable[i].name; - ev->keycompose = keystable[i].compose; - - ecore_event_add(ECORE_SDL_EVENT_KEY_UP, ev, NULL, NULL); - return ; - } - - free(ev); + ev = _ecore_sdl_event_key(&event, time); + if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); break; } case SDL_ACTIVEEVENT: diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 0ffe78d961..ab30168b05 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -226,14 +226,8 @@ typedef enum _Ecore_X_Shape_Type ECORE_X_SHAPE_CLIP } Ecore_X_Shape_Type; -typedef struct _Ecore_X_Event_Key_Down Ecore_X_Event_Key_Down; -typedef struct _Ecore_X_Event_Key_Up Ecore_X_Event_Key_Up; -typedef struct _Ecore_X_Event_Mouse_Button_Down Ecore_X_Event_Mouse_Button_Down; -typedef struct _Ecore_X_Event_Mouse_Button_Up Ecore_X_Event_Mouse_Button_Up; -typedef struct _Ecore_X_Event_Mouse_Move Ecore_X_Event_Mouse_Move; typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In; typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out; -typedef struct _Ecore_X_Event_Mouse_Wheel Ecore_X_Event_Mouse_Wheel; typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In; typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out; typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap; @@ -292,80 +286,6 @@ typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_C typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence; -struct _Ecore_X_Event_Key_Down -{ - char *keyname; - char *keysymbol; - char *key_compose; - int modifiers; - int same_screen; - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Window root_win; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Key_Up -{ - char *keyname; - char *keysymbol; - char *key_compose; - int modifiers; - int same_screen; - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Window root_win; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Mouse_Button_Down -{ - int button; - int modifiers; - int x, y; - int same_screen; - struct { - int x, y; - } root; - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Window root_win; - Ecore_X_Time time; - unsigned int double_click : 1; - unsigned int triple_click : 1; -}; - -struct _Ecore_X_Event_Mouse_Button_Up -{ - int button; - int modifiers; - int x, y; - int same_screen; - struct { - int x, y; - } root; - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Window root_win; - Ecore_X_Time time; - unsigned int double_click : 1; - unsigned int triple_click : 1; -}; - -struct _Ecore_X_Event_Mouse_Move -{ - int modifiers; - int x, y; - int same_screen; - struct { - int x, y; - } root; - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Window root_win; - Ecore_X_Time time; -}; - struct _Ecore_X_Event_Mouse_In { int modifiers; @@ -398,24 +318,6 @@ struct _Ecore_X_Event_Mouse_Out Ecore_X_Time time; }; -struct _Ecore_X_Event_Mouse_Wheel -{ - int direction; /* 0 = default up/down wheel FIXME: more wheel types */ - int z; /* ...,-2,-1 = down, 1,2,... = up */ - int modifiers; - int x, y; - int same_screen; - - struct { - int x, y; - } root; - - Ecore_X_Window win; - Ecore_X_Window event_win; - Ecore_X_Window root_win; - Ecore_X_Time time; -}; - struct _Ecore_X_Event_Window_Focus_In { Ecore_X_Window win; @@ -819,14 +721,8 @@ struct _Ecore_X_Event_Desktop_Change int source; }; -EAPI extern int ECORE_X_EVENT_KEY_DOWN; -EAPI extern int ECORE_X_EVENT_KEY_UP; -EAPI extern int ECORE_X_EVENT_MOUSE_BUTTON_DOWN; -EAPI extern int ECORE_X_EVENT_MOUSE_BUTTON_UP; -EAPI extern int ECORE_X_EVENT_MOUSE_MOVE; EAPI extern int ECORE_X_EVENT_MOUSE_IN; EAPI extern int ECORE_X_EVENT_MOUSE_OUT; -EAPI extern int ECORE_X_EVENT_MOUSE_WHEEL; EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_IN; EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_OUT; EAPI extern int ECORE_X_EVENT_WINDOW_KEYMAP; diff --git a/legacy/ecore/src/lib/ecore_x/xcb/Makefile.am b/legacy/ecore/src/lib/ecore_x/xcb/Makefile.am index 700dc81af7..3887d610f3 100644 --- a/legacy/ecore/src/lib/ecore_x/xcb/Makefile.am +++ b/legacy/ecore/src/lib/ecore_x/xcb/Makefile.am @@ -20,9 +20,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_txt \ -I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_input \ -I$(top_builddir)/src/lib/ecore \ -I$(top_builddir)/src/lib/ecore_txt \ -I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_input \ @EINA_CFLAGS@ noinst_LTLIBRARIES = libecore_x_xcb.la @@ -71,6 +73,7 @@ libecore_x_xcb_la_LIBADD = \ @XCB_LIBS@ \ $(top_builddir)/src/lib/ecore/libecore.la \ $(top_builddir)/src/lib/ecore_txt/libecore_txt.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ @EINA_LIBS@ libecore_x_xcb_la_LDFLAGS = -version-info @version_info@ diff --git a/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb.c b/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb.c index dd94a1a344..d5aa77fa76 100644 --- a/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb.c @@ -60,14 +60,8 @@ Ecore_X_Window _ecore_xcb_private_window = 0; Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; -EAPI int ECORE_X_EVENT_KEY_DOWN = 0; -EAPI int ECORE_X_EVENT_KEY_UP = 0; -EAPI int ECORE_X_EVENT_MOUSE_BUTTON_DOWN = 0; -EAPI int ECORE_X_EVENT_MOUSE_BUTTON_UP = 0; -EAPI int ECORE_X_EVENT_MOUSE_MOVE = 0; EAPI int ECORE_X_EVENT_MOUSE_IN = 0; EAPI int ECORE_X_EVENT_MOUSE_OUT = 0; -EAPI int ECORE_X_EVENT_MOUSE_WHEEL = 0; EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0; @@ -470,14 +464,8 @@ ecore_x_init(const char *name) if (!ECORE_X_EVENT_KEY_DOWN) { - ECORE_X_EVENT_KEY_DOWN = ecore_event_type_new(); - ECORE_X_EVENT_KEY_UP = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_MOVE = ecore_event_type_new(); ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_WHEEL = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); diff --git a/legacy/ecore/src/lib/ecore_x/xlib/Makefile.am b/legacy/ecore/src/lib/ecore_x/xlib/Makefile.am index a72a88ce57..1010258436 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/Makefile.am +++ b/legacy/ecore/src/lib/ecore_x/xlib/Makefile.am @@ -20,9 +20,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_txt \ -I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_input \ -I$(top_builddir)/src/lib/ecore \ -I$(top_builddir)/src/lib/ecore_txt \ -I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_input \ @EINA_CFLAGS@ noinst_LTLIBRARIES = libecore_x_xlib.la @@ -71,6 +73,7 @@ libecore_x_xlib_la_LIBADD = \ @x_libs@ \ $(top_builddir)/src/lib/ecore/libecore.la \ $(top_builddir)/src/lib/ecore_txt/libecore_txt.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ @EINA_LIBS@ libecore_x_xlib_la_LDFLAGS = -version-info @version_info@ diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c index 09c9563eab..97276f6b6d 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x.c @@ -7,12 +7,14 @@ #endif #include +#include #include "ecore_private.h" #include "Ecore.h" #include "ecore_x_private.h" #include "Ecore_X.h" #include "Ecore_X_Atoms.h" +#include "Ecore_Input.h" static int _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); static int _ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler); @@ -51,14 +53,8 @@ Ecore_X_Window _ecore_x_private_win = 0; Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; -EAPI int ECORE_X_EVENT_KEY_DOWN = 0; -EAPI int ECORE_X_EVENT_KEY_UP = 0; -EAPI int ECORE_X_EVENT_MOUSE_BUTTON_DOWN = 0; -EAPI int ECORE_X_EVENT_MOUSE_BUTTON_UP = 0; -EAPI int ECORE_X_EVENT_MOUSE_MOVE = 0; EAPI int ECORE_X_EVENT_MOUSE_IN = 0; EAPI int ECORE_X_EVENT_MOUSE_OUT = 0; -EAPI int ECORE_X_EVENT_MOUSE_WHEEL = 0; EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0; @@ -165,6 +161,8 @@ ecore_x_init(const char *name) _ecore_x_init_count++; return _ecore_x_init_count; } + ecore_event_init(); + _ecore_x_disp = XOpenDisplay((char *)name); if (!_ecore_x_disp) return 0; _ecore_x_error_handler_init(); @@ -293,16 +291,10 @@ ecore_x_init(const char *name) while (0); #endif - if (!ECORE_X_EVENT_KEY_DOWN) + if (!ECORE_X_EVENT_MOUSE_IN) { - ECORE_X_EVENT_KEY_DOWN = ecore_event_type_new(); - ECORE_X_EVENT_KEY_UP = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_MOVE = ecore_event_type_new(); ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_WHEEL = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); @@ -492,6 +484,7 @@ _ecore_x_shutdown(int close_display) _ecore_x_selection_shutdown(); _ecore_x_dnd_shutdown(); ecore_x_netwm_shutdown(); + ecore_event_shutdown(); if (_ecore_x_init_count < 0) _ecore_x_init_count = 0; return _ecore_x_init_count; } diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c index 0176029c0b..fa460828d2 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c @@ -193,9 +193,9 @@ _ecore_x_atoms_init(void) { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE }, { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS }, - { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY }, - { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY }, - { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD }, + { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_PRIMARY }, + { "PRIMARY", &ECORE_X_ATOM_SELECTION_SECONDARY }, + { "SECONDARY", &ECORE_X_ATOM_SELECTION_CLIPBOARD }, { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY }, { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY }, { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD }, diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_events.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_events.c index bea4b98df3..70c35b5248 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_events.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_events.c @@ -16,6 +16,7 @@ #include "ecore_x_private.h" #include "Ecore_X.h" #include "Ecore_X_Atoms.h" +#include "Ecore_Input.h" /** OpenBSD does not define CODESET * FIXME ?? @@ -33,9 +34,6 @@ static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *e static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev); static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev); #endif -static void _ecore_x_event_free_key_down(void *data, void *ev); -static void _ecore_x_event_free_key_up(void *data, void *ev); -static void _ecore_x_event_free_mouse_move(void *data, void *ev); static Window _ecore_x_mouse_down_last_win = 0; static Window _ecore_x_mouse_down_last_last_win = 0; @@ -48,6 +46,20 @@ static int _ecore_x_mouse_down_did_triple = 0; static int _ecore_x_last_event_mouse_move = 0; static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL; +static void +_ecore_x_event_free_mouse_move(void *data __UNUSED__, void *ev) +{ + Ecore_Event_Mouse_Move *e; + + e = ev; + if (_ecore_x_last_event_mouse_move) + { + _ecore_x_last_event_mouse_move_event = NULL; + _ecore_x_last_event_mouse_move = 0; + } + free(e); +} + EAPI void ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask) { @@ -137,44 +149,6 @@ _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev) } #endif -static void -_ecore_x_event_free_key_down(void *data __UNUSED__, void *ev) -{ - Ecore_X_Event_Key_Down *e; - - e = ev; - if (e->keyname) free(e->keyname); - if (e->keysymbol) free(e->keysymbol); - if (e->key_compose) free(e->key_compose); - free(e); -} - -static void -_ecore_x_event_free_key_up(void *data __UNUSED__, void *ev) -{ - Ecore_X_Event_Key_Up *e; - - e = ev; - if (e->keyname) free(e->keyname); - if (e->keysymbol) free(e->keysymbol); - if (e->key_compose) free(e->key_compose); - free(e); -} - -static void -_ecore_x_event_free_mouse_move(void *data __UNUSED__, void *ev) -{ - Ecore_X_Event_Mouse_Move *e; - - e = ev; - if (_ecore_x_last_event_mouse_move) - { - _ecore_x_last_event_mouse_move_event = NULL; - _ecore_x_last_event_mouse_move = 0; - } - free(e); -} - static void _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev) { @@ -201,152 +175,253 @@ _ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev) free(e); } -void -_ecore_x_event_handle_key_press(XEvent *xevent) +static unsigned int +_ecore_x_event_modifiers(unsigned int state) { - Ecore_X_Event_Key_Down *e; - char *keyname, *buf; - int val, buflen = 256; + unsigned int modifiers = 0; + + if (state & ECORE_X_MODIFIER_SHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (state & ECORE_X_MODIFIER_CTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (state & ECORE_X_MODIFIER_ALT) modifiers |= ECORE_EVENT_MODIFIER_ALT; + if (state & ECORE_X_MODIFIER_WIN) modifiers |= ECORE_EVENT_MODIFIER_WIN; + if (state & ECORE_X_LOCK_SCROLL) modifiers |= ECORE_EVENT_LOCK_SCROLL; + if (state & ECORE_X_LOCK_NUM) modifiers |= ECORE_EVENT_LOCK_NUM; + if (state & ECORE_X_LOCK_CAPS) modifiers |= ECORE_EVENT_LOCK_CAPS; + + return modifiers; +} + +static void +_ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers, + int x, int y, + int x_root, int y_root, + unsigned int event_window, + unsigned int window, + unsigned int root_win, + int same_screen) +{ + Ecore_Event_Mouse_Move *e; + Ecore_Event *event; + + e = malloc(sizeof(Ecore_Event_Mouse_Move)); + if (!e) return ; + + e->window = window; + e->root_window = root_win; + e->timestamp = timestamp; + e->same_screen = same_screen; + e->event_window = event_window; + + e->modifiers = _ecore_x_event_modifiers(xmodifiers); + e->x = x; + e->y = y; + e->root.x = x_root; + e->root.y = y_root; + + event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, _ecore_x_event_free_mouse_move, NULL); + + _ecore_x_event_last_time = timestamp; + _ecore_x_event_last_win = window; + _ecore_x_event_last_root_x = x_root; + _ecore_x_event_last_root_y = y_root; + + _ecore_x_last_event_mouse_move_event = event; +} + +static void +_ecore_key_press(int event, + XKeyEvent *xevent) +{ + Ecore_Event_Key *e; + const char *compose = NULL; + char *tmp = NULL; + char *keyname; + char *key; + char keyname_buffer[256]; + char compose_buffer[256]; KeySym sym; XComposeStatus status; + int val; _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Key_Down)); - if (!e) return; - buf = malloc(buflen); - if (!buf) - { - free(e); - return; - } - keyname = XKeysymToString(XKeycodeToKeysym(xevent->xkey.display, - xevent->xkey.keycode, 0)); + keyname = XKeysymToString(XKeycodeToKeysym(xevent->display, + xevent->keycode, 0)); if (!keyname) { - snprintf(buf, buflen, "Keycode-%i", xevent->xkey.keycode); - keyname = buf; - } - e->keyname = strdup(keyname); - if (!e->keyname) - { - free(buf); - free(e); - return; + snprintf(keyname_buffer, sizeof(keyname_buffer), "Keycode-%i", xevent->keycode); + keyname = keyname_buffer; + if (!keyname) return ; } + + sym = 0; + key = NULL; + compose = NULL; if (_ecore_x_ic) { Status mbstatus; - #ifdef X_HAVE_UTF8_STRING - val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus); + val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus); #else - val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus); + val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus); #endif if (mbstatus == XBufferOverflow) { - buflen = val + 1; - buf = realloc(buf, buflen); + tmp = malloc(sizeof (char) * (val + 1)); + if (!tmp) return ; + + compose = tmp; + #ifdef X_HAVE_UTF8_STRING - val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus); + val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus); #else - val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus); + val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus); #endif + if (val > 0) + { + tmp[val] = 0; + +#ifndef X_HAVE_UTF8_STRING + compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", tmp); + free(tmp); + tmp = compose; +#endif + } + else compose = NULL; } - if (val > 0) - { - buf[val] = 0; + else + if (val > 0) + { + compose_buffer[val] = 0; #ifdef X_HAVE_UTF8_STRING - e->key_compose = strdup(buf); + compose = compose_buffer; #else - e->key_compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", buf); + compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer); + tmp = compose; #endif - } + } } else { - val = XLookupString((XKeyEvent *)xevent, buf, sizeof(buf), &sym, &status); + val = XLookupString(xevent, compose_buffer, sizeof(compose_buffer), &sym, &status); if (val > 0) { - buf[val] = 0; - e->key_compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", buf); + compose_buffer[val] = 0; + compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer); + tmp = compose; } - else e->key_compose = NULL; } - keyname = XKeysymToString(sym); - if (keyname) e->keysymbol = strdup(keyname); - else e->keysymbol = strdup(e->keyname); - if (!e->keysymbol) + + key = XKeysymToString(sym); + if (!key) key = keyname; + if (!key) goto on_error; + + e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + (compose ? strlen(compose) : 0) + 3); + if (!e) goto on_error; + + e->keyname = (char*) (e + 1); + e->key = e->keyname + strlen(keyname) + 1; + e->compose = (compose) ? e->key + strlen(key) + 1 : NULL; + e->string = e->compose; + + strcpy((char *) e->keyname, keyname); + strcpy((char *) e->key, key); + if (compose) strcpy((char *) e->compose, compose); + + e->modifiers = _ecore_x_event_modifiers(xevent->state); + + e->timestamp = xevent->time; + e->window = xevent->subwindow ? xevent->subwindow : xevent->window; + e->event_window = xevent->window; + e->same_screen = xevent->same_screen; + e->root_window = xevent->root; + + ecore_event_add(event, e, NULL, NULL); + + _ecore_x_event_last_time = e->timestamp; + + on_error: + if (tmp) free(tmp); +} + +static Ecore_Event_Mouse_Button* +_ecore_mouse_button(int event, + unsigned int timestamp, unsigned int xmodifiers, + unsigned int buttons, + int x, int y, + int x_root, int y_root, + unsigned int event_window, + unsigned int window, + unsigned int root_win, + int same_screen) +{ + Ecore_Event_Mouse_Button *e; + + e = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!e) return NULL; + + e->window = window; + e->root_window = root_win; + e->timestamp = timestamp; + e->same_screen = same_screen; + e->event_window = event_window; + + e->buttons = buttons; + e->modifiers = _ecore_x_event_modifiers(xmodifiers); + e->double_click = 0; + e->triple_click = 0; + e->x = x; + e->y = y; + e->root.x = x_root; + e->root.y = y_root; + + if (event_window == window) { - if (e->keyname) free(e->keyname); - if (e->key_compose) free(e->key_compose); - free(buf); - free(e); - return; + if (((int)(timestamp - _ecore_x_mouse_down_last_time) <= + (int)(1000 * _ecore_x_double_click_time)) && + (window == _ecore_x_mouse_down_last_win) && + (event_window == _ecore_x_mouse_down_last_event_win) + ) + e->double_click = 1; + if (((int)(timestamp - _ecore_x_mouse_down_last_last_time) <= + (int)(2 * 1000 * _ecore_x_double_click_time)) && + (window == _ecore_x_mouse_down_last_win) && + (window == _ecore_x_mouse_down_last_last_win) && + (event_window == _ecore_x_mouse_down_last_event_win) && + (event_window == _ecore_x_mouse_down_last_last_event_win) + ) + { + e->triple_click = 1; + _ecore_x_mouse_down_did_triple = 1; + } + else + _ecore_x_mouse_down_did_triple = 0; } - if (xevent->xkey.subwindow) e->win = xevent->xkey.subwindow; - else e->win = xevent->xkey.window; - e->event_win = xevent->xkey.window; - e->time = xevent->xkey.time; - e->modifiers = xevent->xkey.state; - e->same_screen = xevent->xkey.same_screen; - e->root_win = xevent->xkey.root; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_KEY_DOWN, e, _ecore_x_event_free_key_down, NULL); - free(buf); + + if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN + && !e->double_click + && !e->triple_click) + _ecore_x_mouse_up_count = 0; + + _ecore_x_event_last_time = e->timestamp; + _ecore_x_event_last_win = e->window; + _ecore_x_event_last_root_x = x_root; + _ecore_x_event_last_root_y = y_root; + + ecore_event_add(event, e, NULL, NULL); + + return e; +} + +void +_ecore_x_event_handle_key_press(XEvent *xevent) +{ + _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *) xevent); } void _ecore_x_event_handle_key_release(XEvent *xevent) { - Ecore_X_Event_Key_Up *e; - char *keyname; - int val; - char buf[256]; - KeySym sym; - XComposeStatus status; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Key_Up)); - if (!e) return; - keyname = XKeysymToString(XKeycodeToKeysym(xevent->xkey.display, - xevent->xkey.keycode, 0)); - if (!keyname) - { - snprintf(buf, sizeof(buf), "Keycode-%i", xevent->xkey.keycode); - keyname = buf; - } - e->keyname = strdup(keyname); - if (!e->keyname) - { - free(e); - return; - } - val = XLookupString((XKeyEvent *)xevent, buf, sizeof(buf), &sym, &status); - if (val > 0) - { - buf[val] = 0; - e->key_compose = ecore_txt_convert("ISO8859-1", "UTF-8", buf); - } - else e->key_compose = NULL; - keyname = XKeysymToString(sym); - if (keyname) e->keysymbol = strdup(keyname); - else e->keysymbol = strdup(e->keyname); - if (!e->keysymbol) - { - if (e->keyname) free(e->keyname); - if (e->key_compose) free(e->key_compose); - free(e); - return; - } - if (xevent->xkey.subwindow) e->win = xevent->xkey.subwindow; - else e->win = xevent->xkey.window; - e->event_win = xevent->xkey.window; - e->time = xevent->xkey.time; - e->modifiers = xevent->xkey.state; - e->same_screen = xevent->xkey.same_screen; - e->root_win = xevent->xkey.root; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_KEY_UP, e, _ecore_x_event_free_key_up, NULL); + _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *) xevent); } void @@ -357,53 +432,38 @@ _ecore_x_event_handle_button_press(XEvent *xevent) _ecore_x_last_event_mouse_move = 0; if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8)) { - Ecore_X_Event_Mouse_Wheel *e; + Ecore_Event_Mouse_Wheel *e; - e = malloc(sizeof(Ecore_X_Event_Mouse_Wheel)); + e = malloc(sizeof(Ecore_Event_Mouse_Wheel)); if (!e) return; - e->modifiers = xevent->xbutton.state; - e->direction = 0; - e->z = 0; - if (xevent->xbutton.button == 4) + e->timestamp = xevent->xbutton.time; + e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state); + switch (xevent->xbutton.button) { - e->direction = 0; - e->z = -1; - } - else if (xevent->xbutton.button == 5) - { - e->direction = 0; - e->z = 1; - } - else if (xevent->xbutton.button == 6) - { - e->direction = 1; - e->z = -1; - } - else if (xevent->xbutton.button == 7) - { - e->direction = 1; - e->z = 1; + case 4: e->direction = 0; e->z = -1; break; + case 5: e->direction = 0; e->z = 1; break; + case 6: e->direction = 1; e->z = -1; break; + case 7: e->direction = 1; e->z = 1; break; } + e->x = xevent->xbutton.x; e->y = xevent->xbutton.y; e->root.x = xevent->xbutton.x_root; e->root.y = xevent->xbutton.y_root; - if (xevent->xbutton.subwindow) - e->win = xevent->xbutton.subwindow; - else - e->win = xevent->xbutton.window; - - e->event_win = xevent->xbutton.window; + if (xevent->xbutton.subwindow) e->window = xevent->xbutton.subwindow; + else e->window = xevent->xbutton.window; + e->event_window = xevent->xbutton.window; e->same_screen = xevent->xbutton.same_screen; - e->root_win = xevent->xbutton.root; - e->time = xevent->xbutton.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_WHEEL, e, NULL, NULL); + e->root_window = xevent->xbutton.root; + + _ecore_x_event_last_time = e->timestamp; + _ecore_x_event_last_win = e->window; + _ecore_x_event_last_root_x = xevent->xbutton.x_root; + _ecore_x_event_last_root_y = xevent->xbutton.y_root; + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); + for (i = 0; i < _ecore_window_grabs_num; i++) { if ((_ecore_window_grabs[i] == xevent->xbutton.window) || @@ -412,8 +472,8 @@ _ecore_x_event_handle_button_press(XEvent *xevent) int replay = 0; if (_ecore_window_grab_replay_func) - replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data, - ECORE_X_EVENT_MOUSE_WHEEL, + replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data, + ECORE_EVENT_MOUSE_WHEEL, e); if (replay) XAllowEvents(xevent->xbutton.display, @@ -427,84 +487,41 @@ _ecore_x_event_handle_button_press(XEvent *xevent) } else { - { - Ecore_X_Event_Mouse_Move *e; + { + _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + xevent->xbutton.window, + (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window), + xevent->xbutton.root, + xevent->xbutton.same_screen); + } + { + Ecore_Event_Mouse_Button *e; + int event_window; + int window; - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move)); - if (!e) return; - e->modifiers = xevent->xbutton.state; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->root.x = xevent->xbutton.x_root; - e->root.y = xevent->xbutton.y_root; - if (xevent->xbutton.subwindow) e->win = xevent->xbutton.subwindow; - else e->win = xevent->xbutton.window; - e->same_screen = xevent->xbutton.same_screen; - e->root_win = xevent->xbutton.root; - e->event_win = xevent->xbutton.window; - e->time = xevent->xbutton.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_MOVE, e, NULL, NULL); - } - { - Ecore_X_Event_Mouse_Button_Down *e; + if (_ecore_x_mouse_down_did_triple) + { + _ecore_x_mouse_down_last_win = 0; + _ecore_x_mouse_down_last_last_win = 0; + _ecore_x_mouse_down_last_event_win = 0; + _ecore_x_mouse_down_last_last_event_win = 0; + _ecore_x_mouse_down_last_time = 0; + _ecore_x_mouse_down_last_last_time = 0; + } - if (_ecore_x_mouse_down_did_triple) - { - _ecore_x_mouse_down_last_win = 0; - _ecore_x_mouse_down_last_last_win = 0; - _ecore_x_mouse_down_last_event_win = 0; - _ecore_x_mouse_down_last_last_event_win = 0; - _ecore_x_mouse_down_last_time = 0; - _ecore_x_mouse_down_last_last_time = 0; - } + window = (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window); + event_window = xevent->xbutton.window; - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Button_Down)); - if (!e) return; - e->button = xevent->xbutton.button; - e->modifiers = xevent->xbutton.state; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->root.x = xevent->xbutton.x_root; - e->root.y = xevent->xbutton.y_root; - if (xevent->xbutton.subwindow) e->win = xevent->xbutton.subwindow; - else e->win = xevent->xbutton.window; - e->same_screen = xevent->xbutton.same_screen; - e->root_win = xevent->xbutton.root; - e->event_win = xevent->xbutton.window; - e->time = xevent->xbutton.time; - if (e->win == e->event_win) - { - if (((int)(e->time - _ecore_x_mouse_down_last_time) <= - (int)(1000 * _ecore_x_double_click_time)) && - (e->win == _ecore_x_mouse_down_last_win) && - (e->event_win == _ecore_x_mouse_down_last_event_win) - ) - e->double_click = 1; - if (((int)(e->time - _ecore_x_mouse_down_last_last_time) <= - (int)(2 * 1000 * _ecore_x_double_click_time)) && - (e->win == _ecore_x_mouse_down_last_win) && - (e->win == _ecore_x_mouse_down_last_last_win) && - (e->event_win == _ecore_x_mouse_down_last_event_win) && - (e->event_win == _ecore_x_mouse_down_last_last_event_win) - ) - { - e->triple_click = 1; - _ecore_x_mouse_down_did_triple = 1; - } - else - _ecore_x_mouse_down_did_triple = 0; - } - if (!e->double_click && !e->triple_click) - _ecore_x_mouse_up_count = 0; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); + e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, + xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.button, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + event_window, window, + xevent->xbutton.root, xevent->xbutton.same_screen); + if (e) for (i = 0; i < _ecore_window_grabs_num; i++) { if ((_ecore_window_grabs[i] == xevent->xbutton.window) || @@ -513,8 +530,8 @@ _ecore_x_event_handle_button_press(XEvent *xevent) int replay = 0; if (_ecore_window_grab_replay_func) - replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data, - ECORE_X_EVENT_MOUSE_BUTTON_DOWN, + replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data, + ECORE_EVENT_MOUSE_BUTTON_DOWN, e); if (replay) XAllowEvents(xevent->xbutton.display, @@ -525,22 +542,23 @@ _ecore_x_event_handle_button_press(XEvent *xevent) break; } } - if (e->win == e->event_win) - { - if (!_ecore_x_mouse_down_did_triple) - { - _ecore_x_mouse_down_last_last_win = _ecore_x_mouse_down_last_win; - if (xevent->xbutton.subwindow) - _ecore_x_mouse_down_last_win = xevent->xbutton.subwindow; - else - _ecore_x_mouse_down_last_win = xevent->xbutton.window; - _ecore_x_mouse_down_last_last_event_win = _ecore_x_mouse_down_last_event_win; - _ecore_x_mouse_down_last_event_win = xevent->xbutton.window; - _ecore_x_mouse_down_last_last_time = _ecore_x_mouse_down_last_time; - _ecore_x_mouse_down_last_time = xevent->xbutton.time; - } - } - } + + if (window == event_window) + { + if (!_ecore_x_mouse_down_did_triple) + { + _ecore_x_mouse_down_last_last_win = _ecore_x_mouse_down_last_win; + if (xevent->xbutton.subwindow) + _ecore_x_mouse_down_last_win = xevent->xbutton.subwindow; + else + _ecore_x_mouse_down_last_win = xevent->xbutton.window; + _ecore_x_mouse_down_last_last_event_win = _ecore_x_mouse_down_last_event_win; + _ecore_x_mouse_down_last_event_win = xevent->xbutton.window; + _ecore_x_mouse_down_last_last_time = _ecore_x_mouse_down_last_time; + _ecore_x_mouse_down_last_time = xevent->xbutton.time; + } + } + } } } @@ -551,110 +569,48 @@ _ecore_x_event_handle_button_release(XEvent *xevent) /* filter out wheel buttons */ if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7)) { - { - Ecore_X_Event_Mouse_Move *e; + _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + xevent->xbutton.window, + (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window), + xevent->xbutton.root, + xevent->xbutton.same_screen); - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move)); - if (!e) return; - e->modifiers = xevent->xbutton.state; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->root.x = xevent->xbutton.x_root; - e->root.y = xevent->xbutton.y_root; - if (xevent->xbutton.subwindow) e->win = xevent->xbutton.subwindow; - else e->win = xevent->xbutton.window; - e->same_screen = xevent->xbutton.same_screen; - e->root_win = xevent->xbutton.root; - e->event_win = xevent->xbutton.window; - e->time = xevent->xbutton.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_MOVE, e, NULL, NULL); - } - { - Ecore_X_Event_Mouse_Button_Up *e; - - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Button_Up)); - if (!e) return; - e->button = xevent->xbutton.button; - e->modifiers = xevent->xbutton.state; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->root.x = xevent->xbutton.x_root; - e->root.y = xevent->xbutton.y_root; - if (xevent->xbutton.subwindow) e->win = xevent->xbutton.subwindow; - else e->win = xevent->xbutton.window; - e->same_screen = xevent->xbutton.same_screen; - e->root_win = xevent->xbutton.root; - e->event_win = xevent->xbutton.window; - e->time = xevent->xbutton.time; - _ecore_x_mouse_up_count++; - if (e->win == e->event_win) - { - if ((_ecore_x_mouse_up_count >= 2) && - ((int)(e->time - _ecore_x_mouse_down_last_time) <= - (int)(1000 * _ecore_x_double_click_time)) && - (e->win == _ecore_x_mouse_down_last_win) && - (e->event_win == _ecore_x_mouse_down_last_event_win) - ) - e->double_click = 1; - if ((_ecore_x_mouse_up_count >= 3) && - ((int)(e->time - _ecore_x_mouse_down_last_last_time) <= - (int)(2 * 1000 * _ecore_x_double_click_time)) && - (e->win == _ecore_x_mouse_down_last_win) && - (e->win == _ecore_x_mouse_down_last_last_win) && - (e->event_win == _ecore_x_mouse_down_last_event_win) && - (e->event_win == _ecore_x_mouse_down_last_last_event_win) - ) - e->triple_click = 1; - } - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); - } + _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, + xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.button, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + xevent->xbutton.window, + (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window), + xevent->xbutton.root, + xevent->xbutton.same_screen); } } void _ecore_x_event_handle_motion_notify(XEvent *xevent) { - Ecore_X_Event_Mouse_Move *e; - Ecore_Event *event; - if (_ecore_x_last_event_mouse_move) { ecore_event_del(_ecore_x_last_event_mouse_move_event); _ecore_x_last_event_mouse_move = 0; _ecore_x_last_event_mouse_move_event = NULL; } - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move)); - if (!e) return; - e->modifiers = xevent->xmotion.state; - e->x = xevent->xmotion.x; - e->y = xevent->xmotion.y; - e->root.x = xevent->xmotion.x_root; - e->root.y = xevent->xmotion.y_root; - if (xevent->xmotion.subwindow) e->win = xevent->xmotion.subwindow; - else e->win = xevent->xmotion.window; - e->same_screen = xevent->xmotion.same_screen; - e->root_win = xevent->xmotion.root; - e->event_win = xevent->xmotion.window; - e->time = xevent->xmotion.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; + + _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state, + xevent->xmotion.x, xevent->xmotion.y, + xevent->xmotion.x_root, xevent->xmotion.y_root, + xevent->xmotion.window, + (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : xevent->xmotion.window), + xevent->xmotion.root, + xevent->xmotion.same_screen); + + _ecore_x_last_event_mouse_move = 1; /* Xdnd handling */ - _ecore_x_dnd_drag(xevent->xmotion.root, e->root.x, e->root.y); - - event = ecore_event_add(ECORE_X_EVENT_MOUSE_MOVE, e, _ecore_x_event_free_mouse_move, NULL); - _ecore_x_last_event_mouse_move = 1; - _ecore_x_last_event_mouse_move_event = event; + _ecore_x_dnd_drag(xevent->xmotion.root, xevent->xmotion.x_root, xevent->xmotion.y_root); } void @@ -662,33 +618,20 @@ _ecore_x_event_handle_enter_notify(XEvent *xevent) { _ecore_x_last_event_mouse_move = 0; { - Ecore_X_Event_Mouse_Move *e; - - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move)); - if (!e) return; - e->modifiers = xevent->xcrossing.state; - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->root.x = xevent->xcrossing.x_root; - e->root.y = xevent->xcrossing.y_root; - if (xevent->xcrossing.subwindow) e->win = xevent->xcrossing.subwindow; - else e->win = xevent->xcrossing.window; - e->same_screen = xevent->xcrossing.same_screen; - e->root_win = xevent->xcrossing.root; - e->event_win = xevent->xcrossing.window; - e->time = xevent->xcrossing.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_MOVE, e, NULL, NULL); + _ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state, + xevent->xcrossing.x, xevent->xcrossing.y, + xevent->xcrossing.x_root, xevent->xcrossing.y_root, + xevent->xcrossing.window, + (xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window), + xevent->xcrossing.root, + xevent->xcrossing.same_screen); } { Ecore_X_Event_Mouse_In *e; e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)); if (!e) return; - e->modifiers = xevent->xcrossing.state; + e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); e->x = xevent->xcrossing.x; e->y = xevent->xcrossing.y; e->root.x = xevent->xcrossing.x_root; @@ -728,33 +671,20 @@ _ecore_x_event_handle_leave_notify(XEvent *xevent) { _ecore_x_last_event_mouse_move = 0; { - Ecore_X_Event_Mouse_Move *e; - - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move)); - if (!e) return; - e->modifiers = xevent->xcrossing.state; - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->root.x = xevent->xcrossing.x_root; - e->root.y = xevent->xcrossing.y_root; - if (xevent->xcrossing.subwindow) e->win = xevent->xcrossing.subwindow; - else e->win = xevent->xcrossing.window; - e->same_screen = xevent->xcrossing.same_screen; - e->root_win = xevent->xcrossing.root; - e->event_win = xevent->xcrossing.window; - e->time = xevent->xcrossing.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_MOVE, e, NULL, NULL); + _ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state, + xevent->xcrossing.x, xevent->xcrossing.y, + xevent->xcrossing.x_root, xevent->xcrossing.y_root, + xevent->xcrossing.window, + (xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window), + xevent->xcrossing.root, + xevent->xcrossing.same_screen); } { Ecore_X_Event_Mouse_Out *e; e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)); if (!e) return; - e->modifiers = xevent->xcrossing.state; + e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); e->x = xevent->xcrossing.x; e->y = xevent->xcrossing.y; e->root.x = xevent->xcrossing.x_root; diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c index 8009577b19..1846197370 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c @@ -10,6 +10,8 @@ # include #endif +#include + #include "Ecore.h" #include "Ecore_Data.h" #include "ecore_x_private.h" diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_private.h b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_private.h index 72142e1277..e3d665e41b 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_private.h +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_private.h @@ -140,6 +140,16 @@ typedef struct _Ecore_X_DND_Target int will_accept; } Ecore_X_DND_Target; + +extern int ECORE_X_MODIFIER_SHIFT; +extern int ECORE_X_MODIFIER_CTRL; +extern int ECORE_X_MODIFIER_ALT; +extern int ECORE_X_MODIFIER_WIN; + +extern int ECORE_X_LOCK_SCROLL; +extern int ECORE_X_LOCK_NUM; +extern int ECORE_X_LOCK_CAPS; + extern Display *_ecore_x_disp; extern double _ecore_x_double_click_time; extern Time _ecore_x_event_last_time;