forked from enlightenment/efl
Let me introduce you to Ecore_Input. The idea is to share as much as possible event
between all ecore graphic engine to ease porting of application and reduce the amount of specific code per engine. This patch does just that. All your application should continu to work has previously, if it's not the case please report any new behaviour regarding mouse and keyboard. SVN revision: 39505
This commit is contained in:
parent
f05eb71b29
commit
57e8d73fba
|
@ -24,6 +24,8 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
|
||||||
ecore-x.pc \
|
ecore-x.pc \
|
||||||
ecore-win32.pc \
|
ecore-win32.pc \
|
||||||
ecore-sdl.pc \
|
ecore-sdl.pc \
|
||||||
|
ecore-input.pc.in \
|
||||||
|
ecore-input.pc \
|
||||||
ecore-quartz.pc \
|
ecore-quartz.pc \
|
||||||
ecore-wince.pc \
|
ecore-wince.pc \
|
||||||
ecore.pc \
|
ecore.pc \
|
||||||
|
@ -104,7 +106,7 @@ ptxt = ecore-txt.pc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_ECORE_X
|
if BUILD_ECORE_X
|
||||||
px = ecore-x.pc
|
px = ecore-x.pc ecore-input.pc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_ECORE_WIN32
|
if BUILD_ECORE_WIN32
|
||||||
|
@ -116,7 +118,7 @@ pwince = ecore-wince.pc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_ECORE_SDL
|
if BUILD_ECORE_SDL
|
||||||
psdl = ecore-sdl.pc
|
psdl = ecore-sdl.pc ecore-input.pc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_ECORE_QUARTZ
|
if BUILD_ECORE_QUARTZ
|
||||||
|
|
|
@ -135,6 +135,7 @@ requirements_ecore=""
|
||||||
requirements_ecore_con=""
|
requirements_ecore_con=""
|
||||||
requirements_ecore_config=""
|
requirements_ecore_config=""
|
||||||
requirements_ecore_directfb=""
|
requirements_ecore_directfb=""
|
||||||
|
requirements_ecore_input=""
|
||||||
requirements_ecore_evas=""
|
requirements_ecore_evas=""
|
||||||
requirements_ecore_fb=""
|
requirements_ecore_fb=""
|
||||||
requirements_ecore_file=""
|
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_win32="ecore eina-0 ${requirements_ecore_win32}"
|
||||||
requirements_ecore_wince="ecore eina-0 ${requirements_ecore_wince}"
|
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)
|
# iconv library (ecore_txt)
|
||||||
|
|
||||||
|
@ -934,6 +940,7 @@ AC_SUBST(requirements_ecore)
|
||||||
AC_SUBST(requirements_ecore_con)
|
AC_SUBST(requirements_ecore_con)
|
||||||
AC_SUBST(requirements_ecore_config)
|
AC_SUBST(requirements_ecore_config)
|
||||||
AC_SUBST(requirements_ecore_directfb)
|
AC_SUBST(requirements_ecore_directfb)
|
||||||
|
AC_SUBST(requirements_ecore_input)
|
||||||
AC_SUBST(requirements_ecore_evas)
|
AC_SUBST(requirements_ecore_evas)
|
||||||
AC_SUBST(requirements_ecore_fb)
|
AC_SUBST(requirements_ecore_fb)
|
||||||
AC_SUBST(requirements_ecore_file)
|
AC_SUBST(requirements_ecore_file)
|
||||||
|
@ -962,6 +969,7 @@ ecore-ipc.pc
|
||||||
ecore-job.pc
|
ecore-job.pc
|
||||||
ecore-txt.pc
|
ecore-txt.pc
|
||||||
ecore-x.pc
|
ecore-x.pc
|
||||||
|
ecore-input.pc
|
||||||
ecore-win32.pc
|
ecore-win32.pc
|
||||||
ecore-sdl.pc
|
ecore-sdl.pc
|
||||||
ecore-quartz.pc
|
ecore-quartz.pc
|
||||||
|
@ -984,6 +992,7 @@ src/lib/ecore_evas/Makefile
|
||||||
src/lib/ecore_con/Makefile
|
src/lib/ecore_con/Makefile
|
||||||
src/lib/ecore_imf/Makefile
|
src/lib/ecore_imf/Makefile
|
||||||
src/lib/ecore_imf_evas/Makefile
|
src/lib/ecore_imf_evas/Makefile
|
||||||
|
src/lib/ecore_input/Makefile
|
||||||
src/lib/ecore_ipc/Makefile
|
src/lib/ecore_ipc/Makefile
|
||||||
src/lib/ecore_txt/Makefile
|
src/lib/ecore_txt/Makefile
|
||||||
src/lib/ecore_config/Makefile
|
src/lib/ecore_config/Makefile
|
||||||
|
|
|
@ -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}
|
|
@ -2,6 +2,7 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
ecore \
|
ecore \
|
||||||
|
ecore_input \
|
||||||
ecore_job \
|
ecore_job \
|
||||||
ecore_txt \
|
ecore_txt \
|
||||||
ecore_fb \
|
ecore_fb \
|
||||||
|
@ -16,5 +17,6 @@ ecore_ipc \
|
||||||
ecore_evas \
|
ecore_evas \
|
||||||
ecore_config \
|
ecore_config \
|
||||||
ecore_file \
|
ecore_file \
|
||||||
|
ecore_input \
|
||||||
ecore_imf \
|
ecore_imf \
|
||||||
ecore_imf_evas
|
ecore_imf_evas
|
||||||
|
|
|
@ -126,6 +126,8 @@ typedef void Ecore_WinCE_Window;
|
||||||
typedef struct _Ecore_Evas Ecore_Evas;
|
typedef struct _Ecore_Evas Ecore_Evas;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Ecore_Input.h>
|
||||||
|
|
||||||
/* module setup/shutdown calls */
|
/* module setup/shutdown calls */
|
||||||
|
|
||||||
EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);
|
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 int ecore_evas_sticky_get(const Ecore_Evas *ee);
|
||||||
EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, int ignore);
|
EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, int ignore);
|
||||||
EAPI int ecore_evas_ignore_events_get(const Ecore_Evas *ee);
|
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);
|
EAPI int ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags);
|
||||||
|
|
|
@ -35,9 +35,11 @@ endif
|
||||||
if BUILD_ECORE_SDL
|
if BUILD_ECORE_SDL
|
||||||
ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@
|
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_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la
|
||||||
|
ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB)
|
||||||
else
|
else
|
||||||
ECORE_SDL_INC =
|
ECORE_SDL_INC =
|
||||||
ECORE_SDL_LIB =
|
ECORE_SDL_LIB =
|
||||||
|
ECORE_SDL_LIBADD =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_ECORE_QUARTZ
|
if BUILD_ECORE_QUARTZ
|
||||||
|
@ -59,8 +61,10 @@ endif
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/src/lib/ecore \
|
-I$(top_srcdir)/src/lib/ecore \
|
||||||
-I$(top_srcdir)/src/lib/ecore_evas \
|
-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 \
|
||||||
-I$(top_builddir)/src/lib/ecore_evas \
|
-I$(top_builddir)/src/lib/ecore_evas \
|
||||||
|
-I$(top_builddir)/src/lib/ecore_input \
|
||||||
@EFL_ECORE_EVAS_BUILD@ \
|
@EFL_ECORE_EVAS_BUILD@ \
|
||||||
$(ECORE_X_INC) \
|
$(ECORE_X_INC) \
|
||||||
$(ECORE_FB_INC) \
|
$(ECORE_FB_INC) \
|
||||||
|
@ -99,9 +103,11 @@ $(ECORE_FB_LIB) \
|
||||||
$(ECORE_DIRECTFB_LIB) \
|
$(ECORE_DIRECTFB_LIB) \
|
||||||
$(ECORE_WIN32_LIB) \
|
$(ECORE_WIN32_LIB) \
|
||||||
$(ECORE_SDL_LIB) \
|
$(ECORE_SDL_LIB) \
|
||||||
|
$(ECORE_SDL_LIBADD) \
|
||||||
$(ECORE_QUARTZ_LIB) \
|
$(ECORE_QUARTZ_LIB) \
|
||||||
$(ECORE_WINCE_LIB) \
|
$(ECORE_WINCE_LIB) \
|
||||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||||
|
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
|
||||||
@EVAS_LIBS@ \
|
@EVAS_LIBS@ \
|
||||||
@XCB_LIBS@ \
|
@XCB_LIBS@ \
|
||||||
@SDL_LIBS@ \
|
@SDL_LIBS@ \
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_Evas.h"
|
||||||
|
#include "Ecore_Input.h"
|
||||||
|
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
#include "ecore_evas_private.h"
|
#include "ecore_evas_private.h"
|
||||||
#include "Ecore_Evas.h"
|
|
||||||
|
|
||||||
static int _ecore_evas_init_count = 0;
|
static int _ecore_evas_init_count = 0;
|
||||||
static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL;
|
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;
|
return ee->ignore_events ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void *
|
EAPI Ecore_Window
|
||||||
ecore_evas_window_get(const Ecore_Evas *ee)
|
ecore_evas_window_get(const Ecore_Evas *ee)
|
||||||
{
|
{
|
||||||
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
|
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
|
||||||
{
|
{
|
||||||
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
|
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
|
||||||
"ecore_evas_window_get");
|
"ecore_evas_window_get");
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ee->engine.func->fn_window_get) return ee->engine.func->fn_window_get(ee);
|
return ee->prop.window;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fps debug calls - for debugging how much time your app actually spends */
|
/* fps debug calls - for debugging how much time your app actually spends */
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_Evas.h"
|
||||||
|
#include "Ecore_Input.h"
|
||||||
|
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
#include "ecore_evas_private.h"
|
#include "ecore_evas_private.h"
|
||||||
#include "Ecore_Evas.h"
|
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
|
||||||
static int _ecore_evas_init_count = 0;
|
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 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
|
static int
|
||||||
_ecore_evas_buffer_init(void)
|
_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;
|
x = ev->cur.canvas.x;
|
||||||
y = ev->cur.canvas.y;
|
y = ev->cur.canvas.y;
|
||||||
_ecore_evas_buffer_coord_translate(ee, &x, &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
|
static void
|
||||||
|
@ -421,8 +415,6 @@ static const Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
|
||||||
#include "ecore_evas_private.h"
|
|
||||||
#include "Ecore_Evas.h"
|
#include "Ecore_Evas.h"
|
||||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||||
#include "Ecore_DirectFB.h"
|
#include "Ecore_DirectFB.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ecore_private.h"
|
||||||
|
#include "ecore_evas_private.h"
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||||
static int _ecore_evas_init_count = 0;
|
static int _ecore_evas_init_count = 0;
|
||||||
|
@ -78,70 +78,6 @@ _ecore_evas_directfb_idle_enter(void *data __UNUSED__)
|
||||||
return 1;
|
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
|
static int
|
||||||
_ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_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);
|
ee = _ecore_evas_directfb_match(e->win);
|
||||||
|
|
||||||
if (!ee) return 1; /* pass on event */
|
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;
|
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);
|
ee = _ecore_evas_directfb_match(e->win);
|
||||||
|
|
||||||
if (!ee) return 1; /* pass on event */
|
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);
|
evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL);
|
||||||
return 1;
|
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);
|
ee = _ecore_evas_directfb_match(e->win);
|
||||||
|
|
||||||
if (!ee) return 1; /* pass on event */
|
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);
|
evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL);
|
||||||
return 1;
|
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 */
|
if (!ee) return 1; /* pass on event */
|
||||||
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
|
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;
|
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 */
|
if (!ee) return 1; /* pass on event */
|
||||||
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
|
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->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
|
||||||
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
|
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -560,8 +496,7 @@ static const Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
|
||||||
NULL, /* withdrawn */
|
NULL, /* withdrawn */
|
||||||
NULL, /* sticky */
|
NULL, /* sticky */
|
||||||
NULL, /* ignore events */
|
NULL, /* ignore events */
|
||||||
NULL, /* alpha */
|
NULL /* alpha */
|
||||||
_ecore_evas_directfb_window_get /* window_get */
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,15 @@
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
|
||||||
#include "ecore_evas_private.h"
|
|
||||||
#include "Ecore_Evas.h"
|
#include "Ecore_Evas.h"
|
||||||
#ifdef BUILD_ECORE_EVAS_FB
|
#ifdef BUILD_ECORE_EVAS_FB
|
||||||
#include "Ecore_Fb.h"
|
#include "Ecore_Fb.h"
|
||||||
#include "ecore_fb_private.h"
|
#include "ecore_fb_private.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ecore_private.h"
|
||||||
|
#include "ecore_evas_private.h"
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_FB
|
#ifdef BUILD_ECORE_EVAS_FB
|
||||||
static int _ecore_evas_init_count = 0;
|
static int _ecore_evas_init_count = 0;
|
||||||
|
|
||||||
|
@ -595,9 +596,10 @@ static const Ecore_Evas_Engine_Func _ecore_fb_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
_ecore_evas_fullscreen_set,
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
_ecore_evas_fullscreen_set,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ecore_private.h"
|
||||||
#include "Ecore_Data.h"
|
#include "Ecore_Data.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -93,8 +94,10 @@
|
||||||
|
|
||||||
|
|
||||||
#define IDLE_FLUSH_TIME 0.5
|
#define IDLE_FLUSH_TIME 0.5
|
||||||
|
#ifndef _ECORE_EVAS_H
|
||||||
typedef struct _Ecore_Evas Ecore_Evas;
|
typedef struct _Ecore_Evas Ecore_Evas;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine;
|
typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine;
|
||||||
typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func;
|
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_sticky_set) (Ecore_Evas *ee, int sticky);
|
||||||
void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore);
|
void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore);
|
||||||
void (*fn_alpha_set) (Ecore_Evas *ee, int alpha);
|
void (*fn_alpha_set) (Ecore_Evas *ee, int alpha);
|
||||||
void *(*fn_window_get) (const Ecore_Evas *ee);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ecore_Evas_Engine
|
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)
|
#if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_XCB)
|
||||||
struct {
|
struct {
|
||||||
Ecore_X_Window win_root;
|
Ecore_X_Window win_root;
|
||||||
Ecore_X_Window win;
|
|
||||||
Eina_List *win_extra;
|
Eina_List *win_extra;
|
||||||
Ecore_X_Pixmap pmap;
|
Ecore_X_Pixmap pmap;
|
||||||
Ecore_X_Pixmap mask;
|
Ecore_X_Pixmap mask;
|
||||||
|
@ -264,6 +265,7 @@ struct _Ecore_Evas
|
||||||
} hot;
|
} hot;
|
||||||
} cursor;
|
} cursor;
|
||||||
int layer;
|
int layer;
|
||||||
|
Ecore_Window window;
|
||||||
unsigned char avoid_damage;
|
unsigned char avoid_damage;
|
||||||
char focused : 1;
|
char focused : 1;
|
||||||
char iconified : 1;
|
char iconified : 1;
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_Evas.h"
|
||||||
|
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
#include "ecore_evas_private.h"
|
#include "ecore_evas_private.h"
|
||||||
#include "Ecore_Evas.h"
|
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_QUARTZ
|
#ifdef BUILD_ECORE_EVAS_QUARTZ
|
||||||
#include "Ecore_Quartz.h"
|
#include "Ecore_Quartz.h"
|
||||||
|
|
|
@ -7,14 +7,15 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
|
||||||
#include "ecore_evas_private.h"
|
|
||||||
#include "Ecore_Evas.h"
|
#include "Ecore_Evas.h"
|
||||||
|
#include "Ecore_Input.h"
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
|
||||||
#include "Ecore_Sdl.h"
|
#include "Ecore_Sdl.h"
|
||||||
#include "Evas_Engine_SDL.h"
|
#include "Evas_Engine_SDL.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ecore_evas_private.h"
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
|
||||||
|
|
||||||
/* static char *ecore_evas_default_display = "0"; */
|
/* 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;
|
static int _ecore_evas_fps_debug = 0;
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
static Ecore_Evas *ecore_evases = NULL;
|
static Ecore_Evas *ecore_evases = NULL;
|
||||||
static Ecore_Event_Handler *ecore_evas_event_handlers[10] = {
|
static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
static Ecore_Idle_Enterer *ecore_evas_idle_enterer = 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 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 *
|
static Ecore_Evas *
|
||||||
_ecore_evas_sdl_match(void)
|
_ecore_evas_sdl_match(void)
|
||||||
{
|
{
|
||||||
return ecore_evases;
|
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
|
static int
|
||||||
_ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_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;
|
if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL);
|
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
|
#ifndef _WIN32
|
||||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
|
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
|
||||||
#endif /* _WIN32 */
|
#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_init();
|
||||||
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[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, 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[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, 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[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, 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[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, 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);
|
|
||||||
|
|
||||||
return _ecore_evas_init_count;
|
return _ecore_evas_init_count;
|
||||||
}
|
}
|
||||||
|
@ -321,9 +199,10 @@ _ecore_evas_sdl_shutdown(void)
|
||||||
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++)
|
for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
|
||||||
ecore_event_handler_del(ecore_evas_event_handlers[i]);
|
ecore_event_handler_del(ecore_evas_event_handlers[i]);
|
||||||
|
ecore_evas_event_shutdown();
|
||||||
ecore_idle_enterer_del(ecore_evas_idle_enterer);
|
ecore_idle_enterer_del(ecore_evas_idle_enterer);
|
||||||
ecore_evas_idle_enterer = NULL;
|
ecore_evas_idle_enterer = NULL;
|
||||||
ecore_timer_del(ecore_evas_event);
|
ecore_poller_del(ecore_evas_event);
|
||||||
ecore_evas_event = NULL;
|
ecore_evas_event = NULL;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
|
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
|
||||||
|
@ -337,6 +216,7 @@ static void
|
||||||
_ecore_evas_sdl_free(Ecore_Evas *ee)
|
_ecore_evas_sdl_free(Ecore_Evas *ee)
|
||||||
{
|
{
|
||||||
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
|
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
|
||||||
|
ecore_evas_unregister(ee, 0);
|
||||||
_ecore_evas_sdl_shutdown();
|
_ecore_evas_sdl_shutdown();
|
||||||
ecore_sdl_shutdown();
|
ecore_sdl_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -457,7 +337,6 @@ static const Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
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_evases) return NULL;
|
||||||
|
|
||||||
if (!ecore_sdl_init(name)) return NULL;
|
|
||||||
|
|
||||||
ee = calloc(1, sizeof(Ecore_Evas));
|
ee = calloc(1, sizeof(Ecore_Evas));
|
||||||
if (!ee) return NULL;
|
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.fullscreen = fullscreen;
|
||||||
ee->prop.withdrawn = 0;
|
ee->prop.withdrawn = 0;
|
||||||
ee->prop.sticky = 0;
|
ee->prop.sticky = 0;
|
||||||
|
ee->prop.window = 0;
|
||||||
|
|
||||||
/* init evas here */
|
/* init evas here */
|
||||||
ee->evas = evas_new();
|
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;
|
einfo->info.alpha = alpha;
|
||||||
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
|
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
|
||||||
}
|
}
|
||||||
evas_key_modifier_add(ee->evas, "Shift");
|
ecore_evas_register(ee, 0);
|
||||||
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");
|
|
||||||
|
|
||||||
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
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);
|
_ecore_evas_sdl_init(w, h);
|
||||||
|
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
|
||||||
#include "ecore_evas_private.h"
|
|
||||||
#include "Ecore_Evas.h"
|
#include "Ecore_Evas.h"
|
||||||
|
|
||||||
|
#include "ecore_private.h"
|
||||||
|
#include "ecore_evas_private.h"
|
||||||
|
|
||||||
static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate";
|
static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate";
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <stdlib.h> /* for NULL */
|
#include <stdlib.h> /* for NULL */
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
|
||||||
#ifdef BUILD_ECORE_EVAS_WIN32
|
#ifdef BUILD_ECORE_EVAS_WIN32
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
|
@ -18,9 +17,10 @@
|
||||||
# include "ecore_win32_private.h"
|
# include "ecore_win32_private.h"
|
||||||
#endif /* BUILD_ECORE_EVAS_WIN32 */
|
#endif /* BUILD_ECORE_EVAS_WIN32 */
|
||||||
|
|
||||||
#include "ecore_evas_private.h"
|
|
||||||
#include "Ecore_Evas.h"
|
#include "Ecore_Evas.h"
|
||||||
|
|
||||||
|
#include "ecore_private.h"
|
||||||
|
#include "ecore_evas_private.h"
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_WIN32
|
#ifdef BUILD_ECORE_EVAS_WIN32
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <stdlib.h> /* for NULL */
|
#include <stdlib.h> /* for NULL */
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
|
@ -18,9 +17,10 @@
|
||||||
# include "ecore_wince_private.h"
|
# include "ecore_wince_private.h"
|
||||||
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
|
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
|
||||||
|
|
||||||
#include "ecore_evas_private.h"
|
|
||||||
#include "Ecore_Evas.h"
|
#include "Ecore_Evas.h"
|
||||||
|
|
||||||
|
#include "ecore_private.h"
|
||||||
|
#include "ecore_evas_private.h"
|
||||||
|
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,448 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
|
@ -2,7 +2,11 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/src/lib/ecore \
|
-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 \
|
||||||
|
-I$(top_builddir)/src/lib/ecore_evas \
|
||||||
|
-I$(top_builddir)/src/lib/ecore_input \
|
||||||
@EFL_ECORE_SDL_BUILD@ \
|
@EFL_ECORE_SDL_BUILD@ \
|
||||||
@SDL_CFLAGS@ \
|
@SDL_CFLAGS@ \
|
||||||
@EINA_CFLAGS@
|
@EINA_CFLAGS@
|
||||||
|
@ -18,8 +22,8 @@ ecore_sdl.c
|
||||||
|
|
||||||
libecore_sdl_la_LIBADD = \
|
libecore_sdl_la_LIBADD = \
|
||||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||||
@SDL_LIBS@ \
|
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
|
||||||
@EINA_LIBS@
|
@SDL_LIBS@ @EVIL_LIBS@ @EINA_LIBS@
|
||||||
|
|
||||||
libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@
|
libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@
|
||||||
|
|
||||||
|
|
|
@ -8,24 +8,48 @@
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
|
#include "Eina.h"
|
||||||
#include "Ecore_Sdl.h"
|
#include "Ecore_Sdl.h"
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
|
#include "Ecore_Input.h"
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "Ecore_Data.h"
|
#include "Ecore_Data.h"
|
||||||
#include "Ecore_Sdl_Keys.h"
|
#include "Ecore_Sdl_Keys.h"
|
||||||
|
|
||||||
EAPI int ECORE_SDL_EVENT_KEY_DOWN = 0;
|
#include <eina_rbtree.h>
|
||||||
EAPI int ECORE_SDL_EVENT_KEY_UP = 0;
|
|
||||||
EAPI int ECORE_SDL_EVENT_MOUSE_BUTTON_DOWN = 0;
|
typedef struct _Ecore_SDL_Pressed Ecore_SDL_Pressed;
|
||||||
EAPI int ECORE_SDL_EVENT_MOUSE_BUTTON_UP = 0;
|
struct _Ecore_SDL_Pressed
|
||||||
EAPI int ECORE_SDL_EVENT_MOUSE_MOVE = 0;
|
{
|
||||||
EAPI int ECORE_SDL_EVENT_MOUSE_WHEEL = 0;
|
EINA_RBTREE;
|
||||||
|
|
||||||
|
SDLKey key;
|
||||||
|
};
|
||||||
|
|
||||||
EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0;
|
EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0;
|
||||||
EAPI int ECORE_SDL_EVENT_LOST_FOCUS = 0;
|
EAPI int ECORE_SDL_EVENT_LOST_FOCUS = 0;
|
||||||
EAPI int ECORE_SDL_EVENT_RESIZE = 0;
|
EAPI int ECORE_SDL_EVENT_RESIZE = 0;
|
||||||
EAPI int ECORE_SDL_EVENT_EXPOSE = 0;
|
EAPI int ECORE_SDL_EVENT_EXPOSE = 0;
|
||||||
|
|
||||||
static int _ecore_sdl_init_count = 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
|
* @defgroup Ecore_Sdl_Library_Group Framebuffer Library Functions
|
||||||
|
@ -45,17 +69,14 @@ ecore_sdl_init(const char *name __UNUSED__)
|
||||||
{
|
{
|
||||||
if(!_ecore_sdl_init_count)
|
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_GOT_FOCUS = ecore_event_type_new();
|
||||||
ECORE_SDL_EVENT_LOST_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_RESIZE = ecore_event_type_new();
|
||||||
ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new();
|
ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new();
|
||||||
|
|
||||||
|
SDL_EnableKeyRepeat(200, 100);
|
||||||
}
|
}
|
||||||
|
ecore_event_init();
|
||||||
return ++_ecore_sdl_init_count;
|
return ++_ecore_sdl_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +90,38 @@ EAPI int
|
||||||
ecore_sdl_shutdown(void)
|
ecore_sdl_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_sdl_init_count--;
|
_ecore_sdl_init_count--;
|
||||||
|
ecore_event_shutdown();
|
||||||
return _ecore_sdl_init_count;
|
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
|
EAPI void
|
||||||
ecore_sdl_feed_events(void)
|
ecore_sdl_feed_events(void)
|
||||||
{
|
{
|
||||||
|
@ -85,14 +135,20 @@ ecore_sdl_feed_events(void)
|
||||||
{
|
{
|
||||||
case SDL_MOUSEMOTION:
|
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->x = event.motion.x;
|
||||||
ev->y = event.motion.y;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
@ -100,46 +156,51 @@ ecore_sdl_feed_events(void)
|
||||||
if (event.button.button == SDL_BUTTON_WHEELUP ||
|
if (event.button.button == SDL_BUTTON_WHEELUP ||
|
||||||
event.button.button == SDL_BUTTON_WHEELDOWN)
|
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 = malloc(sizeof(Ecore_Event_Mouse_Wheel));
|
||||||
ev->x = event.button.x;
|
if (!ev) return ;
|
||||||
ev->y = event.button.y;
|
|
||||||
|
ev->timestamp = time;
|
||||||
|
ev->window = 0;
|
||||||
|
ev->modifiers = 0; /* FIXME: keep modifier around. */
|
||||||
ev->direction = 0;
|
ev->direction = 0;
|
||||||
ev->wheel = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1;
|
ev->z = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1;
|
||||||
ev->time = time;
|
|
||||||
|
|
||||||
ecore_event_add(ECORE_SDL_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
|
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ecore_Sdl_Event_Mouse_Button_Down *ev;
|
Ecore_Event_Mouse_Button *ev;
|
||||||
|
|
||||||
ev = malloc(sizeof (Ecore_Sdl_Event_Mouse_Button_Down));
|
ev = malloc(sizeof(Ecore_Event_Mouse_Button));
|
||||||
ev->x = event.button.x;
|
if (!ev) return ;
|
||||||
ev->y = event.button.y;
|
|
||||||
ev->button = event.button.button;
|
ev->timestamp = time;
|
||||||
|
ev->window = 0;
|
||||||
|
ev->modifiers = 0; /* FIXME: keep modifier around. */
|
||||||
|
ev->buttons = event.button.button;
|
||||||
ev->double_click = 0;
|
ev->double_click = 0;
|
||||||
ev->triple_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;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEBUTTONUP:
|
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 = malloc(sizeof(Ecore_Event_Mouse_Button));
|
||||||
ev->x = event.button.x;
|
if (!ev) return ;
|
||||||
ev->y = event.button.y;
|
ev->timestamp = time;
|
||||||
ev->button = event.button.button;
|
ev->window = 0;
|
||||||
|
ev->modifiers = 0; /* FIXME: keep modifier around. */
|
||||||
|
ev->buttons = event.button.button;
|
||||||
ev->double_click = 0;
|
ev->double_click = 0;
|
||||||
ev->triple_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;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_VIDEORESIZE:
|
case SDL_VIDEORESIZE:
|
||||||
|
@ -162,44 +223,48 @@ ecore_sdl_feed_events(void)
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
{
|
{
|
||||||
Ecore_Sdl_Event_Key_Down *ev;
|
Ecore_SDL_Pressed *entry;
|
||||||
unsigned int i;
|
Ecore_Event_Key *ev;
|
||||||
|
|
||||||
ev = malloc(sizeof (Ecore_Sdl_Event_Key_Down));
|
entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym),
|
||||||
ev->time = time;
|
EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL);
|
||||||
|
if (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 = _ecore_sdl_event_key(&event, time);
|
||||||
ev->keycompose = keystable[i].compose;
|
if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
|
||||||
|
|
||||||
ecore_event_add(ECORE_SDL_EVENT_KEY_DOWN, ev, NULL, NULL);
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ev);
|
ev = _ecore_sdl_event_key(&event, time);
|
||||||
|
if (ev) ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
|
||||||
|
|
||||||
|
if (!entry)
|
||||||
|
{
|
||||||
|
entry = malloc(sizeof (Ecore_SDL_Pressed));
|
||||||
|
if (!entry) break;
|
||||||
|
|
||||||
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
{
|
{
|
||||||
Ecore_Sdl_Event_Key_Up *ev;
|
Ecore_Event_Key *ev;
|
||||||
unsigned int i;
|
Ecore_SDL_Pressed *entry;
|
||||||
|
|
||||||
ev = malloc(sizeof (Ecore_Sdl_Event_Key_Up));
|
entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym),
|
||||||
ev->time = time;
|
EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL);
|
||||||
|
if (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;
|
repeat = eina_rbtree_inline_remove(repeat, EINA_RBTREE_GET(entry),
|
||||||
ev->keycompose = keystable[i].compose;
|
EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL);
|
||||||
|
free(entry);
|
||||||
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;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_ACTIVEEVENT:
|
case SDL_ACTIVEEVENT:
|
||||||
|
|
|
@ -226,14 +226,8 @@ typedef enum _Ecore_X_Shape_Type
|
||||||
ECORE_X_SHAPE_CLIP
|
ECORE_X_SHAPE_CLIP
|
||||||
} Ecore_X_Shape_Type;
|
} 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_In Ecore_X_Event_Mouse_In;
|
||||||
typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
|
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_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_Focus_Out Ecore_X_Event_Window_Focus_Out;
|
||||||
typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap;
|
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;
|
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
|
struct _Ecore_X_Event_Mouse_In
|
||||||
{
|
{
|
||||||
int modifiers;
|
int modifiers;
|
||||||
|
@ -398,24 +318,6 @@ struct _Ecore_X_Event_Mouse_Out
|
||||||
Ecore_X_Time time;
|
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
|
struct _Ecore_X_Event_Window_Focus_In
|
||||||
{
|
{
|
||||||
Ecore_X_Window win;
|
Ecore_X_Window win;
|
||||||
|
@ -819,14 +721,8 @@ struct _Ecore_X_Event_Desktop_Change
|
||||||
int source;
|
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_IN;
|
||||||
EAPI extern int ECORE_X_EVENT_MOUSE_OUT;
|
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_IN;
|
||||||
EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_OUT;
|
EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_OUT;
|
||||||
EAPI extern int ECORE_X_EVENT_WINDOW_KEYMAP;
|
EAPI extern int ECORE_X_EVENT_WINDOW_KEYMAP;
|
||||||
|
|
|
@ -20,9 +20,11 @@ AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/src/lib/ecore \
|
-I$(top_srcdir)/src/lib/ecore \
|
||||||
-I$(top_srcdir)/src/lib/ecore_txt \
|
-I$(top_srcdir)/src/lib/ecore_txt \
|
||||||
-I$(top_srcdir)/src/lib/ecore_x \
|
-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 \
|
||||||
-I$(top_builddir)/src/lib/ecore_txt \
|
-I$(top_builddir)/src/lib/ecore_txt \
|
||||||
-I$(top_builddir)/src/lib/ecore_x \
|
-I$(top_builddir)/src/lib/ecore_x \
|
||||||
|
-I$(top_builddir)/src/lib/ecore_input \
|
||||||
@EINA_CFLAGS@
|
@EINA_CFLAGS@
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libecore_x_xcb.la
|
noinst_LTLIBRARIES = libecore_x_xcb.la
|
||||||
|
@ -71,6 +73,7 @@ libecore_x_xcb_la_LIBADD = \
|
||||||
@XCB_LIBS@ \
|
@XCB_LIBS@ \
|
||||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||||
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la \
|
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la \
|
||||||
|
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
|
||||||
@EINA_LIBS@
|
@EINA_LIBS@
|
||||||
|
|
||||||
libecore_x_xcb_la_LDFLAGS = -version-info @version_info@
|
libecore_x_xcb_la_LDFLAGS = -version-info @version_info@
|
||||||
|
|
|
@ -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];
|
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_IN = 0;
|
||||||
EAPI int ECORE_X_EVENT_MOUSE_OUT = 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_IN = 0;
|
||||||
EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
|
EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
|
||||||
EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 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)
|
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_IN = ecore_event_type_new();
|
||||||
ECORE_X_EVENT_MOUSE_OUT = 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_IN = ecore_event_type_new();
|
||||||
ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
||||||
ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new();
|
ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new();
|
||||||
|
|
|
@ -20,9 +20,11 @@ AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/src/lib/ecore \
|
-I$(top_srcdir)/src/lib/ecore \
|
||||||
-I$(top_srcdir)/src/lib/ecore_txt \
|
-I$(top_srcdir)/src/lib/ecore_txt \
|
||||||
-I$(top_srcdir)/src/lib/ecore_x \
|
-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 \
|
||||||
-I$(top_builddir)/src/lib/ecore_txt \
|
-I$(top_builddir)/src/lib/ecore_txt \
|
||||||
-I$(top_builddir)/src/lib/ecore_x \
|
-I$(top_builddir)/src/lib/ecore_x \
|
||||||
|
-I$(top_builddir)/src/lib/ecore_input \
|
||||||
@EINA_CFLAGS@
|
@EINA_CFLAGS@
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libecore_x_xlib.la
|
noinst_LTLIBRARIES = libecore_x_xlib.la
|
||||||
|
@ -71,6 +73,7 @@ libecore_x_xlib_la_LIBADD = \
|
||||||
@x_libs@ \
|
@x_libs@ \
|
||||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||||
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la \
|
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la \
|
||||||
|
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
|
||||||
@EINA_LIBS@
|
@EINA_LIBS@
|
||||||
|
|
||||||
libecore_x_xlib_la_LDFLAGS = -version-info @version_info@
|
libecore_x_xlib_la_LDFLAGS = -version-info @version_info@
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_x_private.h"
|
#include "ecore_x_private.h"
|
||||||
#include "Ecore_X.h"
|
#include "Ecore_X.h"
|
||||||
#include "Ecore_X_Atoms.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(void *data, Ecore_Fd_Handler *fd_handler);
|
||||||
static int _ecore_x_fd_handler_buf(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];
|
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_IN = 0;
|
||||||
EAPI int ECORE_X_EVENT_MOUSE_OUT = 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_IN = 0;
|
||||||
EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
|
EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
|
||||||
EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0;
|
EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0;
|
||||||
|
@ -165,6 +161,8 @@ ecore_x_init(const char *name)
|
||||||
_ecore_x_init_count++;
|
_ecore_x_init_count++;
|
||||||
return _ecore_x_init_count;
|
return _ecore_x_init_count;
|
||||||
}
|
}
|
||||||
|
ecore_event_init();
|
||||||
|
|
||||||
_ecore_x_disp = XOpenDisplay((char *)name);
|
_ecore_x_disp = XOpenDisplay((char *)name);
|
||||||
if (!_ecore_x_disp) return 0;
|
if (!_ecore_x_disp) return 0;
|
||||||
_ecore_x_error_handler_init();
|
_ecore_x_error_handler_init();
|
||||||
|
@ -293,16 +291,10 @@ ecore_x_init(const char *name)
|
||||||
while (0);
|
while (0);
|
||||||
#endif
|
#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_IN = ecore_event_type_new();
|
||||||
ECORE_X_EVENT_MOUSE_OUT = 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_IN = ecore_event_type_new();
|
||||||
ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
||||||
ECORE_X_EVENT_WINDOW_KEYMAP = 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_selection_shutdown();
|
||||||
_ecore_x_dnd_shutdown();
|
_ecore_x_dnd_shutdown();
|
||||||
ecore_x_netwm_shutdown();
|
ecore_x_netwm_shutdown();
|
||||||
|
ecore_event_shutdown();
|
||||||
if (_ecore_x_init_count < 0) _ecore_x_init_count = 0;
|
if (_ecore_x_init_count < 0) _ecore_x_init_count = 0;
|
||||||
return _ecore_x_init_count;
|
return _ecore_x_init_count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,9 +193,9 @@ _ecore_x_atoms_init(void)
|
||||||
{ "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE },
|
{ "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE },
|
||||||
|
|
||||||
{ "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS },
|
{ "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS },
|
||||||
{ "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY },
|
{ "CLIPBOARD", &ECORE_X_ATOM_SELECTION_PRIMARY },
|
||||||
{ "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY },
|
{ "PRIMARY", &ECORE_X_ATOM_SELECTION_SECONDARY },
|
||||||
{ "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD },
|
{ "SECONDARY", &ECORE_X_ATOM_SELECTION_CLIPBOARD },
|
||||||
{ "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY },
|
{ "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY },
|
||||||
{ "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY },
|
{ "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY },
|
||||||
{ "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD },
|
{ "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD },
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "ecore_x_private.h"
|
#include "ecore_x_private.h"
|
||||||
#include "Ecore_X.h"
|
#include "Ecore_X.h"
|
||||||
#include "Ecore_X_Atoms.h"
|
#include "Ecore_X_Atoms.h"
|
||||||
|
#include "Ecore_Input.h"
|
||||||
|
|
||||||
/** OpenBSD does not define CODESET
|
/** OpenBSD does not define CODESET
|
||||||
* FIXME ??
|
* 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_visible_icon_name_change(void *data, void *ev);
|
||||||
static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
|
static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
|
||||||
#endif
|
#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_win = 0;
|
||||||
static Window _ecore_x_mouse_down_last_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 int _ecore_x_last_event_mouse_move = 0;
|
||||||
static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
|
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
|
EAPI void
|
||||||
ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask)
|
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
|
#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
|
static void
|
||||||
_ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev)
|
_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);
|
free(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static unsigned int
|
||||||
_ecore_x_event_handle_key_press(XEvent *xevent)
|
_ecore_x_event_modifiers(unsigned int state)
|
||||||
{
|
{
|
||||||
Ecore_X_Event_Key_Down *e;
|
unsigned int modifiers = 0;
|
||||||
char *keyname, *buf;
|
|
||||||
int val, buflen = 256;
|
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;
|
KeySym sym;
|
||||||
XComposeStatus status;
|
XComposeStatus status;
|
||||||
|
int val;
|
||||||
|
|
||||||
_ecore_x_last_event_mouse_move = 0;
|
_ecore_x_last_event_mouse_move = 0;
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Key_Down));
|
keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
|
||||||
if (!e) return;
|
xevent->keycode, 0));
|
||||||
buf = malloc(buflen);
|
|
||||||
if (!buf)
|
|
||||||
{
|
|
||||||
free(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
keyname = XKeysymToString(XKeycodeToKeysym(xevent->xkey.display,
|
|
||||||
xevent->xkey.keycode, 0));
|
|
||||||
if (!keyname)
|
if (!keyname)
|
||||||
{
|
{
|
||||||
snprintf(buf, buflen, "Keycode-%i", xevent->xkey.keycode);
|
snprintf(keyname_buffer, sizeof(keyname_buffer), "Keycode-%i", xevent->keycode);
|
||||||
keyname = buf;
|
keyname = keyname_buffer;
|
||||||
}
|
if (!keyname) return ;
|
||||||
e->keyname = strdup(keyname);
|
|
||||||
if (!e->keyname)
|
|
||||||
{
|
|
||||||
free(buf);
|
|
||||||
free(e);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sym = 0;
|
||||||
|
key = NULL;
|
||||||
|
compose = NULL;
|
||||||
if (_ecore_x_ic)
|
if (_ecore_x_ic)
|
||||||
{
|
{
|
||||||
Status mbstatus;
|
Status mbstatus;
|
||||||
|
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
#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
|
#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
|
#endif
|
||||||
if (mbstatus == XBufferOverflow)
|
if (mbstatus == XBufferOverflow)
|
||||||
{
|
{
|
||||||
buflen = val + 1;
|
tmp = malloc(sizeof (char) * (val + 1));
|
||||||
buf = realloc(buf, buflen);
|
if (!tmp) return ;
|
||||||
|
|
||||||
|
compose = tmp;
|
||||||
|
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
#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
|
#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
|
#endif
|
||||||
}
|
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
{
|
{
|
||||||
buf[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;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (val > 0)
|
||||||
|
{
|
||||||
|
compose_buffer[val] = 0;
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
#ifdef X_HAVE_UTF8_STRING
|
||||||
e->key_compose = strdup(buf);
|
compose = compose_buffer;
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = XLookupString((XKeyEvent *)xevent, buf, sizeof(buf), &sym, &status);
|
val = XLookupString(xevent, compose_buffer, sizeof(compose_buffer), &sym, &status);
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
{
|
{
|
||||||
buf[val] = 0;
|
compose_buffer[val] = 0;
|
||||||
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;
|
||||||
}
|
}
|
||||||
else e->key_compose = NULL;
|
|
||||||
}
|
}
|
||||||
keyname = XKeysymToString(sym);
|
|
||||||
if (keyname) e->keysymbol = strdup(keyname);
|
key = XKeysymToString(sym);
|
||||||
else e->keysymbol = strdup(e->keyname);
|
if (!key) key = keyname;
|
||||||
if (!e->keysymbol)
|
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 (((int)(timestamp - _ecore_x_mouse_down_last_time) <=
|
||||||
if (e->key_compose) free(e->key_compose);
|
(int)(1000 * _ecore_x_double_click_time)) &&
|
||||||
free(buf);
|
(window == _ecore_x_mouse_down_last_win) &&
|
||||||
free(e);
|
(event_window == _ecore_x_mouse_down_last_event_win)
|
||||||
return;
|
)
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
if (xevent->xkey.subwindow) e->win = xevent->xkey.subwindow;
|
else
|
||||||
else e->win = xevent->xkey.window;
|
_ecore_x_mouse_down_did_triple = 0;
|
||||||
e->event_win = xevent->xkey.window;
|
}
|
||||||
e->time = xevent->xkey.time;
|
|
||||||
e->modifiers = xevent->xkey.state;
|
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
|
||||||
e->same_screen = xevent->xkey.same_screen;
|
&& !e->double_click
|
||||||
e->root_win = xevent->xkey.root;
|
&& !e->triple_click)
|
||||||
_ecore_x_event_last_time = e->time;
|
_ecore_x_mouse_up_count = 0;
|
||||||
ecore_event_add(ECORE_X_EVENT_KEY_DOWN, e, _ecore_x_event_free_key_down, NULL);
|
|
||||||
free(buf);
|
_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
|
void
|
||||||
_ecore_x_event_handle_key_release(XEvent *xevent)
|
_ecore_x_event_handle_key_release(XEvent *xevent)
|
||||||
{
|
{
|
||||||
Ecore_X_Event_Key_Up *e;
|
_ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *) xevent);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -357,53 +432,38 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
||||||
_ecore_x_last_event_mouse_move = 0;
|
_ecore_x_last_event_mouse_move = 0;
|
||||||
if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8))
|
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;
|
if (!e) return;
|
||||||
|
|
||||||
e->modifiers = xevent->xbutton.state;
|
e->timestamp = xevent->xbutton.time;
|
||||||
e->direction = 0;
|
e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state);
|
||||||
e->z = 0;
|
switch (xevent->xbutton.button)
|
||||||
if (xevent->xbutton.button == 4)
|
|
||||||
{
|
{
|
||||||
e->direction = 0;
|
case 4: e->direction = 0; e->z = -1; break;
|
||||||
e->z = -1;
|
case 5: e->direction = 0; e->z = 1; break;
|
||||||
}
|
case 6: e->direction = 1; e->z = -1; break;
|
||||||
else if (xevent->xbutton.button == 5)
|
case 7: e->direction = 1; e->z = 1; break;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e->x = xevent->xbutton.x;
|
e->x = xevent->xbutton.x;
|
||||||
e->y = xevent->xbutton.y;
|
e->y = xevent->xbutton.y;
|
||||||
e->root.x = xevent->xbutton.x_root;
|
e->root.x = xevent->xbutton.x_root;
|
||||||
e->root.y = xevent->xbutton.y_root;
|
e->root.y = xevent->xbutton.y_root;
|
||||||
|
|
||||||
if (xevent->xbutton.subwindow)
|
if (xevent->xbutton.subwindow) e->window = xevent->xbutton.subwindow;
|
||||||
e->win = xevent->xbutton.subwindow;
|
else e->window = xevent->xbutton.window;
|
||||||
else
|
e->event_window = xevent->xbutton.window;
|
||||||
e->win = xevent->xbutton.window;
|
|
||||||
|
|
||||||
e->event_win = xevent->xbutton.window;
|
|
||||||
e->same_screen = xevent->xbutton.same_screen;
|
e->same_screen = xevent->xbutton.same_screen;
|
||||||
e->root_win = xevent->xbutton.root;
|
e->root_window = xevent->xbutton.root;
|
||||||
e->time = xevent->xbutton.time;
|
|
||||||
_ecore_x_event_last_time = e->time;
|
_ecore_x_event_last_time = e->timestamp;
|
||||||
_ecore_x_event_last_win = e->win;
|
_ecore_x_event_last_win = e->window;
|
||||||
_ecore_x_event_last_root_x = e->root.x;
|
_ecore_x_event_last_root_x = xevent->xbutton.x_root;
|
||||||
_ecore_x_event_last_root_y = e->root.y;
|
_ecore_x_event_last_root_y = xevent->xbutton.y_root;
|
||||||
ecore_event_add(ECORE_X_EVENT_MOUSE_WHEEL, e, NULL, NULL);
|
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
|
||||||
|
|
||||||
for (i = 0; i < _ecore_window_grabs_num; i++)
|
for (i = 0; i < _ecore_window_grabs_num; i++)
|
||||||
{
|
{
|
||||||
if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
|
if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
|
||||||
|
@ -413,7 +473,7 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
||||||
|
|
||||||
if (_ecore_window_grab_replay_func)
|
if (_ecore_window_grab_replay_func)
|
||||||
replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
|
replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
|
||||||
ECORE_X_EVENT_MOUSE_WHEEL,
|
ECORE_EVENT_MOUSE_WHEEL,
|
||||||
e);
|
e);
|
||||||
if (replay)
|
if (replay)
|
||||||
XAllowEvents(xevent->xbutton.display,
|
XAllowEvents(xevent->xbutton.display,
|
||||||
|
@ -428,29 +488,18 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Ecore_X_Event_Mouse_Move *e;
|
_ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
|
||||||
|
xevent->xbutton.x, xevent->xbutton.y,
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
|
xevent->xbutton.x_root, xevent->xbutton.y_root,
|
||||||
if (!e) return;
|
xevent->xbutton.window,
|
||||||
e->modifiers = xevent->xbutton.state;
|
(xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
|
||||||
e->x = xevent->xbutton.x;
|
xevent->xbutton.root,
|
||||||
e->y = xevent->xbutton.y;
|
xevent->xbutton.same_screen);
|
||||||
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;
|
Ecore_Event_Mouse_Button *e;
|
||||||
|
int event_window;
|
||||||
|
int window;
|
||||||
|
|
||||||
if (_ecore_x_mouse_down_did_triple)
|
if (_ecore_x_mouse_down_did_triple)
|
||||||
{
|
{
|
||||||
|
@ -462,49 +511,17 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
||||||
_ecore_x_mouse_down_last_last_time = 0;
|
_ecore_x_mouse_down_last_last_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Button_Down));
|
window = (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window);
|
||||||
if (!e) return;
|
event_window = xevent->xbutton.window;
|
||||||
e->button = xevent->xbutton.button;
|
|
||||||
e->modifiers = xevent->xbutton.state;
|
e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||||
e->x = xevent->xbutton.x;
|
xevent->xbutton.time, xevent->xbutton.state,
|
||||||
e->y = xevent->xbutton.y;
|
xevent->xbutton.button,
|
||||||
e->root.x = xevent->xbutton.x_root;
|
xevent->xbutton.x, xevent->xbutton.y,
|
||||||
e->root.y = xevent->xbutton.y_root;
|
xevent->xbutton.x_root, xevent->xbutton.y_root,
|
||||||
if (xevent->xbutton.subwindow) e->win = xevent->xbutton.subwindow;
|
event_window, window,
|
||||||
else e->win = xevent->xbutton.window;
|
xevent->xbutton.root, xevent->xbutton.same_screen);
|
||||||
e->same_screen = xevent->xbutton.same_screen;
|
if (e)
|
||||||
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);
|
|
||||||
for (i = 0; i < _ecore_window_grabs_num; i++)
|
for (i = 0; i < _ecore_window_grabs_num; i++)
|
||||||
{
|
{
|
||||||
if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
|
if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
|
||||||
|
@ -514,7 +531,7 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
||||||
|
|
||||||
if (_ecore_window_grab_replay_func)
|
if (_ecore_window_grab_replay_func)
|
||||||
replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
|
replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
|
||||||
ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
|
ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||||
e);
|
e);
|
||||||
if (replay)
|
if (replay)
|
||||||
XAllowEvents(xevent->xbutton.display,
|
XAllowEvents(xevent->xbutton.display,
|
||||||
|
@ -525,7 +542,8 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e->win == e->event_win)
|
|
||||||
|
if (window == event_window)
|
||||||
{
|
{
|
||||||
if (!_ecore_x_mouse_down_did_triple)
|
if (!_ecore_x_mouse_down_did_triple)
|
||||||
{
|
{
|
||||||
|
@ -551,110 +569,48 @@ _ecore_x_event_handle_button_release(XEvent *xevent)
|
||||||
/* filter out wheel buttons */
|
/* filter out wheel buttons */
|
||||||
if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7))
|
if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7))
|
||||||
{
|
{
|
||||||
{
|
_ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
|
||||||
Ecore_X_Event_Mouse_Move *e;
|
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));
|
_ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
|
||||||
if (!e) return;
|
xevent->xbutton.time, xevent->xbutton.state,
|
||||||
e->modifiers = xevent->xbutton.state;
|
xevent->xbutton.button,
|
||||||
e->x = xevent->xbutton.x;
|
xevent->xbutton.x, xevent->xbutton.y,
|
||||||
e->y = xevent->xbutton.y;
|
xevent->xbutton.x_root, xevent->xbutton.y_root,
|
||||||
e->root.x = xevent->xbutton.x_root;
|
xevent->xbutton.window,
|
||||||
e->root.y = xevent->xbutton.y_root;
|
(xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
|
||||||
if (xevent->xbutton.subwindow) e->win = xevent->xbutton.subwindow;
|
xevent->xbutton.root,
|
||||||
else e->win = xevent->xbutton.window;
|
xevent->xbutton.same_screen);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_ecore_x_event_handle_motion_notify(XEvent *xevent)
|
_ecore_x_event_handle_motion_notify(XEvent *xevent)
|
||||||
{
|
{
|
||||||
Ecore_X_Event_Mouse_Move *e;
|
|
||||||
Ecore_Event *event;
|
|
||||||
|
|
||||||
if (_ecore_x_last_event_mouse_move)
|
if (_ecore_x_last_event_mouse_move)
|
||||||
{
|
{
|
||||||
ecore_event_del(_ecore_x_last_event_mouse_move_event);
|
ecore_event_del(_ecore_x_last_event_mouse_move_event);
|
||||||
_ecore_x_last_event_mouse_move = 0;
|
_ecore_x_last_event_mouse_move = 0;
|
||||||
_ecore_x_last_event_mouse_move_event = NULL;
|
_ecore_x_last_event_mouse_move_event = NULL;
|
||||||
}
|
}
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
|
|
||||||
if (!e) return;
|
_ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state,
|
||||||
e->modifiers = xevent->xmotion.state;
|
xevent->xmotion.x, xevent->xmotion.y,
|
||||||
e->x = xevent->xmotion.x;
|
xevent->xmotion.x_root, xevent->xmotion.y_root,
|
||||||
e->y = xevent->xmotion.y;
|
xevent->xmotion.window,
|
||||||
e->root.x = xevent->xmotion.x_root;
|
(xevent->xmotion.subwindow ? xevent->xmotion.subwindow : xevent->xmotion.window),
|
||||||
e->root.y = xevent->xmotion.y_root;
|
xevent->xmotion.root,
|
||||||
if (xevent->xmotion.subwindow) e->win = xevent->xmotion.subwindow;
|
xevent->xmotion.same_screen);
|
||||||
else e->win = xevent->xmotion.window;
|
|
||||||
e->same_screen = xevent->xmotion.same_screen;
|
_ecore_x_last_event_mouse_move = 1;
|
||||||
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;
|
|
||||||
|
|
||||||
/* Xdnd handling */
|
/* Xdnd handling */
|
||||||
_ecore_x_dnd_drag(xevent->xmotion.root, e->root.x, e->root.y);
|
_ecore_x_dnd_drag(xevent->xmotion.root, xevent->xmotion.x_root, xevent->xmotion.y_root);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -662,33 +618,20 @@ _ecore_x_event_handle_enter_notify(XEvent *xevent)
|
||||||
{
|
{
|
||||||
_ecore_x_last_event_mouse_move = 0;
|
_ecore_x_last_event_mouse_move = 0;
|
||||||
{
|
{
|
||||||
Ecore_X_Event_Mouse_Move *e;
|
_ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state,
|
||||||
|
xevent->xcrossing.x, xevent->xcrossing.y,
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
|
xevent->xcrossing.x_root, xevent->xcrossing.y_root,
|
||||||
if (!e) return;
|
xevent->xcrossing.window,
|
||||||
e->modifiers = xevent->xcrossing.state;
|
(xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window),
|
||||||
e->x = xevent->xcrossing.x;
|
xevent->xcrossing.root,
|
||||||
e->y = xevent->xcrossing.y;
|
xevent->xcrossing.same_screen);
|
||||||
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_X_Event_Mouse_In *e;
|
Ecore_X_Event_Mouse_In *e;
|
||||||
|
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
|
e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
|
||||||
if (!e) return;
|
if (!e) return;
|
||||||
e->modifiers = xevent->xcrossing.state;
|
e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
|
||||||
e->x = xevent->xcrossing.x;
|
e->x = xevent->xcrossing.x;
|
||||||
e->y = xevent->xcrossing.y;
|
e->y = xevent->xcrossing.y;
|
||||||
e->root.x = xevent->xcrossing.x_root;
|
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_last_event_mouse_move = 0;
|
||||||
{
|
{
|
||||||
Ecore_X_Event_Mouse_Move *e;
|
_ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state,
|
||||||
|
xevent->xcrossing.x, xevent->xcrossing.y,
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
|
xevent->xcrossing.x_root, xevent->xcrossing.y_root,
|
||||||
if (!e) return;
|
xevent->xcrossing.window,
|
||||||
e->modifiers = xevent->xcrossing.state;
|
(xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window),
|
||||||
e->x = xevent->xcrossing.x;
|
xevent->xcrossing.root,
|
||||||
e->y = xevent->xcrossing.y;
|
xevent->xcrossing.same_screen);
|
||||||
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_X_Event_Mouse_Out *e;
|
Ecore_X_Event_Mouse_Out *e;
|
||||||
|
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
|
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
|
||||||
if (!e) return;
|
if (!e) return;
|
||||||
e->modifiers = xevent->xcrossing.state;
|
e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
|
||||||
e->x = xevent->xcrossing.x;
|
e->x = xevent->xcrossing.x;
|
||||||
e->y = xevent->xcrossing.y;
|
e->y = xevent->xcrossing.y;
|
||||||
e->root.x = xevent->xcrossing.x_root;
|
e->root.x = xevent->xcrossing.x_root;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "Ecore_Data.h"
|
#include "Ecore_Data.h"
|
||||||
#include "ecore_x_private.h"
|
#include "ecore_x_private.h"
|
||||||
|
|
|
@ -140,6 +140,16 @@ typedef struct _Ecore_X_DND_Target
|
||||||
int will_accept;
|
int will_accept;
|
||||||
} Ecore_X_DND_Target;
|
} 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 Display *_ecore_x_disp;
|
||||||
extern double _ecore_x_double_click_time;
|
extern double _ecore_x_double_click_time;
|
||||||
extern Time _ecore_x_event_last_time;
|
extern Time _ecore_x_event_last_time;
|
||||||
|
|
Loading…
Reference in New Issue