ecore/fb: Change fb engine input to use ecore_input_evas.
Nothing changes, only making the ecore fb engine to send keyboard and mouse events using ecore_input_evas, instead of its own ecore events. Patch for SiT. SVN revision: 64447
This commit is contained in:
parent
44538e442a
commit
53031cf572
|
@ -1366,6 +1366,28 @@ EAPI Eina_Bool ecore_evas_sticky_get(const Ecore_Evas *ee);
|
|||
EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render);
|
||||
EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee);
|
||||
|
||||
/**
|
||||
* @brief Registers an @c Ecore_Evas to receive events through ecore_input_evas.
|
||||
*
|
||||
* @param ee The @c Ecore_Evas handle.
|
||||
*
|
||||
* This function calls ecore_event_window_register() with the @p ee as its @c
|
||||
* id argument, @c window argument, and uses its @c Evas too. It is useful when
|
||||
* no @c window information is available on a given @c Ecore_Evas backend.
|
||||
*
|
||||
* @see ecore_evas_input_event_unregister()
|
||||
* @since 1.1
|
||||
*/
|
||||
EAPI void ecore_evas_input_event_register(Ecore_Evas *ee);
|
||||
/**
|
||||
* @brief Unregisters an @c Ecore_Evas receiving events through ecore_input_evas.
|
||||
*
|
||||
* @param ee The @c Ecore_Evas handle.
|
||||
*
|
||||
* @see ecore_evas_input_event_register()
|
||||
* @since 1.1
|
||||
*/
|
||||
EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee);
|
||||
|
||||
/**
|
||||
* @brief Force immediate rendering on a given @c Ecore_Evas window
|
||||
|
|
|
@ -2519,3 +2519,19 @@ ecore_evas_ecore_evas_list_get(void)
|
|||
|
||||
return l;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_evas_input_event_register(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
|
||||
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
|
||||
(Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
|
||||
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
|
||||
(Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_evas_input_event_unregister(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_event_window_unregister((Ecore_Window)ee);
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ static int _ecore_evas_init_count = 0;
|
|||
|
||||
static char *ecore_evas_default_display = "0";
|
||||
static Eina_List *ecore_evas_input_devices = NULL;
|
||||
static Ecore_Event_Handler *ecore_evas_event_handlers[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {NULL, NULL, NULL, NULL};
|
||||
|
||||
static void
|
||||
_ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
|
||||
_ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y)
|
||||
{
|
||||
int fbw, fbh;
|
||||
|
||||
|
@ -50,14 +50,6 @@ _ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y, unsigned int tim
|
|||
y - ee->prop.cursor.hot.x,
|
||||
(fbw - ee->w) + 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, (fbh - ee->h) + ee->h - y - 1, x, timestamp, NULL);
|
||||
else if (ee->rotation == 180)
|
||||
evas_event_feed_mouse_move(ee->evas, (fbw - ee->w) + ee->w - x - 1, (fbh - ee->h) + ee->h - y - 1, timestamp, NULL);
|
||||
else if (ee->rotation == 270)
|
||||
evas_event_feed_mouse_move(ee->evas, y, (fbw - ee->w) + ee->w - x - 1, timestamp, NULL);
|
||||
}
|
||||
|
||||
static Ecore_Evas *fb_ee = NULL;
|
||||
|
@ -102,90 +94,56 @@ _ecore_evas_fb_gain(void *data __UNUSED__)
|
|||
ecore_fb_input_device_listen(dev, 1);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Fb_Event_Key_Down *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_fb_match();
|
||||
if (!ee) return EINA_TRUE; /* pass on event */
|
||||
evas_event_feed_key_down(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
||||
return EINA_FALSE; /* dont pass it on */
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Fb_Event_Key_Up *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_fb_match();
|
||||
if (!ee) return EINA_TRUE; /* pass on event */
|
||||
evas_event_feed_key_up(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
||||
return EINA_FALSE; /* dont pass it on */
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Fb_Event_Mouse_Button_Down *e;
|
||||
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
|
||||
Ecore_Event_Mouse_Button *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_fb_match();
|
||||
if (!ee) return EINA_TRUE; /* pass on event */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
|
||||
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, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
||||
return EINA_FALSE; /* dont pass it on */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
|
||||
return EINA_TRUE; /* dont pass it on */
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Fb_Event_Mouse_Button_Up *e;
|
||||
Ecore_Event_Mouse_Button *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_fb_match();
|
||||
if (!ee) return EINA_TRUE; /* pass on event */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
|
||||
evas_event_feed_mouse_up(ee->evas, e->button, EVAS_BUTTON_NONE, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
||||
return EINA_FALSE; /* dont pass it on */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
|
||||
return EINA_TRUE; /* dont pass it on */
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Fb_Event_Mouse_Move *e;
|
||||
Ecore_Event_Mouse_Move *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_fb_match();
|
||||
if (!ee) return EINA_TRUE; /* pass on event */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
|
||||
return EINA_FALSE; /* dont pass it on */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
|
||||
return EINA_TRUE; /* dont pass it on */
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Fb_Event_Mouse_Wheel *e;
|
||||
unsigned long long event_time;
|
||||
Ecore_Event_Mouse_Wheel *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_fb_match();
|
||||
if (!ee) return EINA_TRUE; /* pass on event */
|
||||
event_time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, event_time);
|
||||
evas_event_feed_mouse_wheel(ee->evas, e->direction, e->wheel, event_time, NULL);
|
||||
return EINA_FALSE; /* dont pass it on */
|
||||
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
|
||||
return EINA_TRUE; /* dont pass it on */
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -224,12 +182,11 @@ _ecore_evas_fb_render(Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_fb_init(int w, int h)
|
||||
_ecore_evas_fb_init(Ecore_Evas *ee, int w, int h)
|
||||
{
|
||||
Ecore_Fb_Input_Device *device;
|
||||
Ecore_Fb_Input_Device_Cap caps;
|
||||
int mouse_handled = 0;
|
||||
int keyboard_handled = 0;
|
||||
|
||||
DIR *input_dir;
|
||||
struct dirent *input_entry;
|
||||
|
@ -237,6 +194,8 @@ _ecore_evas_fb_init(int w, int h)
|
|||
_ecore_evas_init_count++;
|
||||
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
|
||||
|
||||
ecore_event_evas_init();
|
||||
|
||||
/* register all input devices */
|
||||
input_dir = opendir("/dev/input/");
|
||||
if (!input_dir) return _ecore_evas_init_count;
|
||||
|
@ -249,7 +208,7 @@ _ecore_evas_fb_init(int w, int h)
|
|||
continue;
|
||||
|
||||
snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name);
|
||||
if (!(device = ecore_fb_input_device_open(device_path)))
|
||||
if (!(device = ecore_fb_input_device_open(ee, device_path)))
|
||||
continue;
|
||||
|
||||
caps = ecore_fb_input_device_cap_get(device);
|
||||
|
@ -266,10 +225,10 @@ _ecore_evas_fb_init(int w, int h)
|
|||
ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
|
||||
if (!mouse_handled)
|
||||
{
|
||||
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
|
||||
ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
|
||||
ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
|
||||
ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL);
|
||||
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
|
||||
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
|
||||
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
|
||||
ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL);
|
||||
mouse_handled = 1;
|
||||
}
|
||||
}
|
||||
|
@ -278,12 +237,6 @@ _ecore_evas_fb_init(int w, int h)
|
|||
{
|
||||
ecore_fb_input_device_listen(device,1);
|
||||
ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
|
||||
if (!keyboard_handled)
|
||||
{
|
||||
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_DOWN, _ecore_evas_event_key_down, NULL);
|
||||
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_UP, _ecore_evas_event_key_up, NULL);
|
||||
keyboard_handled = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(input_dir);
|
||||
|
@ -292,9 +245,9 @@ _ecore_evas_fb_init(int w, int h)
|
|||
{
|
||||
if (ecore_fb_ts_init())
|
||||
{
|
||||
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
|
||||
ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
|
||||
ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
|
||||
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
|
||||
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
|
||||
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
|
||||
mouse_handled = 1;
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +257,7 @@ _ecore_evas_fb_init(int w, int h)
|
|||
static void
|
||||
_ecore_evas_fb_free(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_evas_input_event_unregister(ee);
|
||||
if (fb_ee == ee) fb_ee = NULL;
|
||||
_ecore_evas_fb_shutdown();
|
||||
ecore_fb_shutdown();
|
||||
|
@ -406,7 +360,7 @@ _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__)
|
|||
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
|
||||
else
|
||||
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
||||
_ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
|
||||
_ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y);
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
}
|
||||
|
||||
|
@ -509,12 +463,13 @@ _ecore_evas_fb_shutdown(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (ecore_evas_event_handlers[i])
|
||||
ecore_event_handler_del(ecore_evas_event_handlers[i]);
|
||||
}
|
||||
ecore_fb_ts_shutdown();
|
||||
ecore_event_evas_shutdown();
|
||||
}
|
||||
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
|
||||
return _ecore_evas_init_count;
|
||||
|
@ -602,7 +557,7 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
|
|||
|
||||
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
||||
|
||||
_ecore_evas_fb_init(w, h);
|
||||
_ecore_evas_fb_init(ee, w, h);
|
||||
|
||||
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func;
|
||||
|
||||
|
@ -663,15 +618,8 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
|
|||
ecore_evas_free(ee);
|
||||
return NULL;
|
||||
}
|
||||
evas_key_modifier_add(ee->evas, "Shift");
|
||||
evas_key_modifier_add(ee->evas, "Control");
|
||||
evas_key_modifier_add(ee->evas, "Alt");
|
||||
evas_key_modifier_add(ee->evas, "Meta");
|
||||
evas_key_modifier_add(ee->evas, "Hyper");
|
||||
evas_key_modifier_add(ee->evas, "Super");
|
||||
evas_key_lock_add(ee->evas, "Caps_Lock");
|
||||
evas_key_lock_add(ee->evas, "Num_Lock");
|
||||
evas_key_lock_add(ee->evas, "Scroll_Lock");
|
||||
|
||||
ecore_evas_input_event_register(ee);
|
||||
|
||||
ee->engine.func->fn_render = _ecore_evas_fb_render;
|
||||
_ecore_evas_register(ee);
|
||||
|
|
|
@ -65,101 +65,12 @@ enum _Ecore_Fb_Input_Device_Cap
|
|||
*/
|
||||
typedef enum _Ecore_Fb_Input_Device_Cap Ecore_Fb_Input_Device_Cap;
|
||||
|
||||
EAPI extern int ECORE_FB_EVENT_KEY_DOWN; /**< FB Key Down event */
|
||||
EAPI extern int ECORE_FB_EVENT_KEY_UP; /**< FB Key Up event */
|
||||
EAPI extern int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN; /**< FB Mouse Down event */
|
||||
EAPI extern int ECORE_FB_EVENT_MOUSE_BUTTON_UP; /**< FB Mouse Up event */
|
||||
EAPI extern int ECORE_FB_EVENT_MOUSE_MOVE; /**< FB Mouse Move event */
|
||||
EAPI extern int ECORE_FB_EVENT_MOUSE_WHEEL; /**< FB Mouse Wheel event */
|
||||
|
||||
typedef struct _Ecore_Fb_Event_Key_Down Ecore_Fb_Event_Key_Down; /**< FB Key Down event */
|
||||
typedef struct _Ecore_Fb_Event_Key_Up Ecore_Fb_Event_Key_Up; /**< FB Key Up event */
|
||||
typedef struct _Ecore_Fb_Event_Mouse_Button_Down Ecore_Fb_Event_Mouse_Button_Down; /**< FB Mouse Down event */
|
||||
typedef struct _Ecore_Fb_Event_Mouse_Button_Up Ecore_Fb_Event_Mouse_Button_Up; /**< FB Mouse Up event */
|
||||
typedef struct _Ecore_Fb_Event_Mouse_Move Ecore_Fb_Event_Mouse_Move; /**< FB Mouse Move event */
|
||||
typedef struct _Ecore_Fb_Event_Mouse_Wheel Ecore_Fb_Event_Mouse_Wheel; /**< FB Mouse Wheel event */
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Fb_Event_Key_Down
|
||||
* Framebuffer Key Down event.
|
||||
*/
|
||||
struct _Ecore_Fb_Event_Key_Down
|
||||
{
|
||||
Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
|
||||
char *keyname; /**< The name of the key that was pressed */
|
||||
char *keysymbol; /**< The logical symbol of the key that was pressed */
|
||||
char *key_compose; /**< The UTF-8 string conversion if any */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Fb_Event_Key_Up
|
||||
* Framebuffer Key Up event.
|
||||
*/
|
||||
struct _Ecore_Fb_Event_Key_Up
|
||||
{
|
||||
Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
|
||||
char *keyname; /**< The name of the key that was released */
|
||||
char *keysymbol; /**< The logical symbol of the key that was pressed */
|
||||
char *key_compose; /**< The UTF-8 string conversion if any */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Fb_Event_Mouse_Button_Down
|
||||
* Framebuffer Mouse Down event.
|
||||
*/
|
||||
struct _Ecore_Fb_Event_Mouse_Button_Down
|
||||
{
|
||||
Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
|
||||
int button; /**< Mouse button that was pressed (1 - 32) */
|
||||
int x; /**< Mouse co-ordinates when mouse button was pressed */
|
||||
int y; /**< Mouse co-ordinates when mouse button was pressed */
|
||||
int double_click : 1; /**< Set if click was a double click */
|
||||
int triple_click : 1; /**< Set if click was a triple click */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Fb_Event_Mouse_Button_Up
|
||||
* Framebuffer Mouse Up event.
|
||||
*/
|
||||
struct _Ecore_Fb_Event_Mouse_Button_Up
|
||||
{
|
||||
Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
|
||||
int button; /**< Mouse button that was released (1 - 32) */
|
||||
int x; /**< Mouse co-ordinates when mouse button was raised */
|
||||
int y; /**< Mouse co-ordinates when mouse button was raised */
|
||||
int double_click : 1; /**< Set if click was a double click */
|
||||
int triple_click : 1; /**< Set if click was a triple click */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Fb_Event_Mouse_Move
|
||||
* Framebuffer Mouse Move event.
|
||||
*/
|
||||
struct _Ecore_Fb_Event_Mouse_Move
|
||||
{
|
||||
Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
|
||||
int x; /**< Mouse co-ordinates where the mouse cursor moved to */
|
||||
int y; /**< Mouse co-ordinates where the mouse cursor moved to */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Fb_Event_Mouse_Wheel
|
||||
* Framebuffer Mouse Wheel event.
|
||||
*/
|
||||
struct _Ecore_Fb_Event_Mouse_Wheel
|
||||
{
|
||||
Ecore_Fb_Input_Device *dev;
|
||||
int x,y;
|
||||
int direction; /* 0 = vertical, 1 = horizontal */
|
||||
int wheel; /* value 1 (left/up), -1 (right/down) */
|
||||
};
|
||||
|
||||
/* ecore_fb_vt.c */
|
||||
EAPI void ecore_fb_callback_gain_set(void (*func) (void *data), void *data);
|
||||
EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data);
|
||||
|
||||
/* ecore_fb_li.c */
|
||||
EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(const char *dev);
|
||||
EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(void *window, const char *dev);
|
||||
EAPI void ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev);
|
||||
EAPI void ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen);
|
||||
EAPI const char *ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev);
|
||||
|
|
|
@ -3,6 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in
|
|||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/lib/ecore \
|
||||
-I$(top_builddir)/src/lib/ecore \
|
||||
-I$(top_srcdir)/src/lib/ecore_input \
|
||||
@TSLIB_CFLAGS@ \
|
||||
@EINA_CFLAGS@
|
||||
|
||||
|
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
static void _ecore_fb_size_get(int *w, int *h);
|
||||
|
||||
EAPI int ECORE_FB_EVENT_KEY_DOWN = 0;
|
||||
EAPI int ECORE_FB_EVENT_KEY_UP = 0;
|
||||
EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = 0;
|
||||
EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_UP = 0;
|
||||
EAPI int ECORE_FB_EVENT_MOUSE_MOVE = 0;
|
||||
EAPI int ECORE_FB_EVENT_MOUSE_WHEEL = 0;
|
||||
|
||||
static int _ecore_fb_init_count = 0;
|
||||
static int _ecore_fb_console_w = 0;
|
||||
static int _ecore_fb_console_h = 0;
|
||||
|
@ -46,12 +39,6 @@ ecore_fb_init(const char *name __UNUSED__)
|
|||
if (!ecore_fb_vt_init())
|
||||
return --_ecore_fb_init_count;
|
||||
|
||||
ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
|
||||
ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
|
||||
ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
||||
ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
||||
ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
||||
ECORE_FB_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
||||
_ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
|
||||
|
||||
return _ecore_fb_init_count;
|
||||
|
|
|
@ -35,30 +35,6 @@ test_bit(int bit, unsigned long *array)
|
|||
else long_has_neither_32_nor_64_bits();
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_fb_li_event_free_key_down(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Fb_Event_Key_Up *e;
|
||||
|
||||
e = ev;
|
||||
free(e->keyname);
|
||||
if (e->keysymbol) free(e->keysymbol);
|
||||
if (e->key_compose) free(e->key_compose);
|
||||
free(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_fb_li_event_free_key_up(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Fb_Event_Key_Up *e;
|
||||
|
||||
e = ev;
|
||||
free(e->keyname);
|
||||
if (e->keysymbol) free(e->keysymbol);
|
||||
if (e->key_compose) free(e->key_compose);
|
||||
free(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *iev)
|
||||
{
|
||||
|
@ -67,38 +43,28 @@ _ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
/* check for basic keyboard keys */
|
||||
if ((iev->code >= KEY_ESC) && (iev->code <= KEY_COMPOSE))
|
||||
{
|
||||
int offset = 0;
|
||||
char *keyname = strdup(_ecore_fb_li_kbd_syms[iev->code * 6]);
|
||||
/* check the key table */
|
||||
if (iev->value)
|
||||
{
|
||||
int offset = 0;
|
||||
Ecore_Fb_Event_Key_Down *ev;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Fb_Event_Key_Down));
|
||||
if (dev->keyboard.shift) offset = 1;
|
||||
else if (dev->keyboard.lock) offset = 2;
|
||||
ev->keyname = strdup(_ecore_fb_li_kbd_syms[iev->code * 6]);
|
||||
|
||||
ev->keysymbol = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + offset]);
|
||||
ev->key_compose = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]);
|
||||
ev->dev = dev;
|
||||
ecore_event_add(ECORE_FB_EVENT_KEY_DOWN, ev, _ecore_fb_li_event_free_key_down, NULL);
|
||||
/* its a repeated key, dont increment */
|
||||
if (iev->value == 2)
|
||||
return;
|
||||
if (!strcmp(ev->keyname, "Control_L"))
|
||||
if (!strcmp(keyname, "Control_L"))
|
||||
dev->keyboard.ctrl++;
|
||||
else if (!strcmp(ev->keyname, "Control_R"))
|
||||
else if (!strcmp(keyname, "Control_R"))
|
||||
dev->keyboard.ctrl++;
|
||||
else if (!strcmp(ev->keyname, "Alt_L"))
|
||||
else if (!strcmp(keyname, "Alt_L"))
|
||||
dev->keyboard.alt++;
|
||||
else if (!strcmp(ev->keyname, "Alt_R"))
|
||||
else if (!strcmp(keyname, "Alt_R"))
|
||||
dev->keyboard.alt++;
|
||||
else if (!strcmp(ev->keyname, "Shift_L"))
|
||||
else if (!strcmp(keyname, "Shift_L"))
|
||||
dev->keyboard.shift++;
|
||||
else if (!strcmp(ev->keyname, "Shift_R"))
|
||||
else if (!strcmp(keyname, "Shift_R"))
|
||||
dev->keyboard.shift++;
|
||||
else if (!strcmp(ev->keyname, "Caps_Lock"))
|
||||
dev->keyboard.lock++;
|
||||
else if (!strcmp(keyname, "Caps_Lock"))
|
||||
dev->keyboard.lock = !dev->keyboard.lock;
|
||||
if (dev->keyboard.ctrl > 2) dev->keyboard.ctrl = 2;
|
||||
if (dev->keyboard.alt > 2) dev->keyboard.alt = 2;
|
||||
if (dev->keyboard.shift > 2) dev->keyboard.shift = 2;
|
||||
|
@ -106,85 +72,128 @@ _ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
}
|
||||
else
|
||||
{
|
||||
int offset = 0;
|
||||
Ecore_Fb_Event_Key_Up *ev;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Fb_Event_Key_Up));
|
||||
if (dev->keyboard.shift) offset = 1;
|
||||
else if (dev->keyboard.lock) offset = 2;
|
||||
ev->keyname = strdup(_ecore_fb_li_kbd_syms[iev->code * 6]);
|
||||
|
||||
ev->keysymbol = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + offset]);
|
||||
ev->key_compose = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]);
|
||||
ev->dev = dev;
|
||||
ecore_event_add(ECORE_FB_EVENT_KEY_UP, ev, _ecore_fb_li_event_free_key_up, NULL);
|
||||
if (!strcmp(ev->keyname, "Control_L"))
|
||||
if (!strcmp(keyname, "Control_L"))
|
||||
dev->keyboard.ctrl--;
|
||||
else if (!strcmp(ev->keyname, "Control_R"))
|
||||
else if (!strcmp(keyname, "Control_R"))
|
||||
dev->keyboard.ctrl--;
|
||||
else if (!strcmp(ev->keyname, "Alt_L"))
|
||||
else if (!strcmp(keyname, "Alt_L"))
|
||||
dev->keyboard.alt--;
|
||||
else if (!strcmp(ev->keyname, "Alt_R"))
|
||||
else if (!strcmp(keyname, "Alt_R"))
|
||||
dev->keyboard.alt--;
|
||||
else if (!strcmp(ev->keyname, "Shift_L"))
|
||||
else if (!strcmp(keyname, "Shift_L"))
|
||||
dev->keyboard.shift--;
|
||||
else if (!strcmp(ev->keyname, "Shift_R"))
|
||||
else if (!strcmp(keyname, "Shift_R"))
|
||||
dev->keyboard.shift--;
|
||||
else if (!strcmp(ev->keyname, "Caps_Lock"))
|
||||
dev->keyboard.lock--;
|
||||
if (dev->keyboard.ctrl < 0) dev->keyboard.ctrl = 0;
|
||||
if (dev->keyboard.alt < 0) dev->keyboard.alt = 0;
|
||||
if (dev->keyboard.shift < 0) dev->keyboard.shift = 0;
|
||||
if (dev->keyboard.lock < 0) dev->keyboard.lock = 0;
|
||||
}
|
||||
|
||||
/* sending ecore_input_evas events */
|
||||
Ecore_Event_Key *e;
|
||||
|
||||
if (dev->keyboard.shift) offset = 1;
|
||||
else if (dev->keyboard.lock) offset = 2;
|
||||
|
||||
char *key = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + offset]);
|
||||
char *compose = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]);
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) +
|
||||
strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
|
||||
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 = 0;
|
||||
if (dev->keyboard.shift)
|
||||
e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
|
||||
if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
|
||||
|
||||
e->timestamp = ecore_time_get();
|
||||
e->window = (Ecore_Window)dev->window;
|
||||
e->event_window = (Ecore_Window)dev->window;
|
||||
e->root_window = (Ecore_Window)dev->window;
|
||||
e->same_screen = 0;
|
||||
|
||||
if (iev->value)
|
||||
ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
|
||||
else
|
||||
ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
|
||||
}
|
||||
/* check for mouse button events */
|
||||
else if ((iev->code >= BTN_MOUSE) && (iev->code < BTN_JOYSTICK))
|
||||
{
|
||||
int button;
|
||||
Ecore_Event_Mouse_Button *e;
|
||||
double current = ecore_time_get();
|
||||
|
||||
button = ((iev->code & 0x00F) + 1);
|
||||
if (iev->value)
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Button_Down *ev;
|
||||
double current;
|
||||
dev->mouse.did_double = EINA_FALSE;
|
||||
dev->mouse.did_triple = EINA_FALSE;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down));
|
||||
ev->dev = dev;
|
||||
ev->button = button;
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
|
||||
current = ecore_time_get();
|
||||
if ((current - dev->mouse.prev) <= dev->mouse.threshold)
|
||||
ev->double_click = 1;
|
||||
if ((current - dev->mouse.last) <= (2 * dev->mouse.threshold))
|
||||
if (((current - dev->mouse.prev) <= dev->mouse.threshold) &&
|
||||
(button == dev->mouse.prev_button))
|
||||
{
|
||||
ev->triple_click = 1;
|
||||
/* reset */
|
||||
dev->mouse.prev = 0;
|
||||
dev->mouse.last = 0;
|
||||
current = 0;
|
||||
dev->mouse.did_double = EINA_TRUE;
|
||||
if (((current - dev->mouse.last) <= (2 * dev->mouse.threshold)) &&
|
||||
(button == dev->mouse.last_button))
|
||||
{
|
||||
dev->mouse.did_triple = EINA_TRUE;
|
||||
/* reset */
|
||||
dev->mouse.prev = 0;
|
||||
dev->mouse.last = 0;
|
||||
current = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* update values */
|
||||
dev->mouse.last = dev->mouse.prev;
|
||||
dev->mouse.prev = current;
|
||||
}
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, ev, NULL ,NULL);
|
||||
dev->mouse.last = dev->mouse.prev;
|
||||
dev->mouse.prev = current;
|
||||
dev->mouse.last_button = dev->mouse.prev_button;
|
||||
dev->mouse.prev_button = button;
|
||||
}
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
if (!e)
|
||||
return;
|
||||
|
||||
e->timestamp = current;
|
||||
e->window = (Ecore_Window)dev->window;
|
||||
e->event_window = (Ecore_Window)dev->window;
|
||||
e->root_window = (Ecore_Window)dev->window;
|
||||
e->same_screen = 0;
|
||||
|
||||
e->modifiers = 0;
|
||||
if (dev->keyboard.shift)
|
||||
e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
|
||||
if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
|
||||
|
||||
e->x = dev->mouse.x;
|
||||
e->y = dev->mouse.y;
|
||||
e->root.x = e->x;
|
||||
e->root.y = e->y;
|
||||
e->buttons = button;
|
||||
|
||||
if (dev->mouse.did_double)
|
||||
e->double_click = 1;
|
||||
if (dev->mouse.did_triple)
|
||||
e->triple_click = 1;
|
||||
|
||||
if (iev->value)
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
|
||||
else
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Button_Up *ev;
|
||||
|
||||
ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Button_Up));
|
||||
ev->dev = dev;
|
||||
ev->button = button;
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, ev, NULL ,NULL);
|
||||
}
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +207,7 @@ _ecore_fb_li_device_event_rel(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
case REL_X:
|
||||
case REL_Y:
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Move *ev;
|
||||
Ecore_Event_Mouse_Move *e;
|
||||
if(iev->code == REL_X)
|
||||
{
|
||||
dev->mouse.x += iev->value;
|
||||
|
@ -215,26 +224,64 @@ _ecore_fb_li_device_event_rel(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
else if(dev->mouse.y < 0)
|
||||
dev->mouse.y = 0;
|
||||
}
|
||||
ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Move));
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
ev->dev = dev;
|
||||
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE,ev,NULL,NULL);
|
||||
e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
|
||||
if (!e)
|
||||
return;
|
||||
|
||||
e->window = (Ecore_Window)dev->window;
|
||||
e->event_window = (Ecore_Window)dev->window;
|
||||
e->root_window = (Ecore_Window)dev->window;
|
||||
e->same_screen = 0;
|
||||
|
||||
e->modifiers = 0;
|
||||
if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
|
||||
if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
|
||||
|
||||
e->x = dev->mouse.x;
|
||||
e->y = dev->mouse.y;
|
||||
e->root.x = e->x;
|
||||
e->root.y = e->y;
|
||||
|
||||
e->timestamp = ecore_time_get();
|
||||
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case REL_WHEEL:
|
||||
case REL_HWHEEL:
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Wheel *ev;
|
||||
ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Wheel));
|
||||
Ecore_Event_Mouse_Wheel *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
|
||||
if (!e)
|
||||
return;
|
||||
|
||||
e->x = dev->mouse.x;
|
||||
e->y = dev->mouse.y;
|
||||
if (iev->code == REL_HWHEEL) e->direction = 1;
|
||||
e->z = iev->value;
|
||||
e->root.x = dev->mouse.x;
|
||||
e->root.y = dev->mouse.y;
|
||||
|
||||
e->window = (Ecore_Window)dev->window;
|
||||
e->event_window = (Ecore_Window)dev->window;
|
||||
e->root_window = (Ecore_Window)dev->window;
|
||||
e->same_screen = 0;
|
||||
|
||||
e->modifiers = 0;
|
||||
if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
|
||||
if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
||||
if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
|
||||
|
||||
e->timestamp = ecore_time_get();
|
||||
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
|
||||
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
if (iev->code == REL_HWHEEL) ev->direction = 1;
|
||||
ev->wheel = iev->value;
|
||||
ev->dev = dev;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -260,7 +307,7 @@ _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
if (tmp < 0) dev->mouse.x = 0;
|
||||
else if (tmp > dev->mouse.w) dev->mouse.x = dev->mouse.w;
|
||||
else dev->mouse.x = tmp;
|
||||
dev->mouse.event = ECORE_FB_EVENT_MOUSE_MOVE;
|
||||
dev->mouse.event = ECORE_EVENT_MOUSE_MOVE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -273,7 +320,7 @@ _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
if (tmp < 0) dev->mouse.y = 0;
|
||||
else if (tmp > dev->mouse.h) dev->mouse.y = dev->mouse.h;
|
||||
else dev->mouse.y = tmp;
|
||||
dev->mouse.event = ECORE_FB_EVENT_MOUSE_MOVE;
|
||||
dev->mouse.event = ECORE_EVENT_MOUSE_MOVE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -281,13 +328,13 @@ _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
pressure = iev->value;
|
||||
if ((pressure) && (!prev_pressure))
|
||||
{
|
||||
/* DOWN: mouse is down, but was not now */
|
||||
dev->mouse.event = ECORE_FB_EVENT_MOUSE_BUTTON_DOWN;
|
||||
/* DOWN: mouse is down, but was not before */
|
||||
dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_DOWN;
|
||||
}
|
||||
else if ((!pressure) && (prev_pressure))
|
||||
{
|
||||
/* UP: mouse was down, but is not now */
|
||||
dev->mouse.event = ECORE_FB_EVENT_MOUSE_BUTTON_UP;
|
||||
dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_UP;
|
||||
}
|
||||
prev_pressure = pressure;
|
||||
break;
|
||||
|
@ -299,32 +346,39 @@ _ecore_fb_li_device_event_syn(Ecore_Fb_Input_Device *dev, struct input_event *ie
|
|||
{
|
||||
if (!dev->listen) return;
|
||||
|
||||
if (dev->mouse.event == ECORE_FB_EVENT_MOUSE_MOVE)
|
||||
if (dev->mouse.event == ECORE_EVENT_MOUSE_MOVE)
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Move *ev;
|
||||
ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Move));
|
||||
Ecore_Event_Mouse_Move *ev;
|
||||
ev = calloc(1,sizeof(Ecore_Event_Mouse_Move));
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
ev->dev = dev;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, ev, NULL, NULL);
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
ev->timestamp = ecore_time_get();
|
||||
}
|
||||
else if (dev->mouse.event == ECORE_FB_EVENT_MOUSE_BUTTON_DOWN)
|
||||
else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Button_Down *ev;
|
||||
ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down));
|
||||
Ecore_Event_Mouse_Button *ev;
|
||||
ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
ev->button = 1;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
ev->buttons = 1;
|
||||
ev->timestamp = ecore_time_get();
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
|
||||
}
|
||||
else if (dev->mouse.event == ECORE_FB_EVENT_MOUSE_BUTTON_UP)
|
||||
else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_UP)
|
||||
{
|
||||
Ecore_Fb_Event_Mouse_Button_Up *ev;
|
||||
ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up));
|
||||
Ecore_Event_Mouse_Button *ev;
|
||||
ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
ev->x = dev->mouse.x;
|
||||
ev->y = dev->mouse.y;
|
||||
ev->button = 1;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
ev->buttons = 1;
|
||||
ev->timestamp = ecore_time_get();
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +393,6 @@ _ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh __UNUSED__)
|
|||
dev = (Ecore_Fb_Input_Device*)data;
|
||||
/* read up to 64 events at once */
|
||||
len = read(dev->fd, &ev, sizeof(ev));
|
||||
// printf("[ecore_fb_li_device:fd_callback] received %d data\n", len);
|
||||
for(i = 0; i < (int)(len / sizeof(ev[0])); i++)
|
||||
{
|
||||
switch(ev[i].type)
|
||||
|
@ -408,7 +461,7 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen)
|
|||
* object for it, or returns @c NULL on failure.
|
||||
*/
|
||||
EAPI Ecore_Fb_Input_Device *
|
||||
ecore_fb_input_device_open(const char *dev)
|
||||
ecore_fb_input_device_open(void *ee, const char *dev)
|
||||
{
|
||||
Ecore_Fb_Input_Device *device;
|
||||
unsigned long event_type_bitmask[EV_CNT / 32 + 1];
|
||||
|
@ -471,6 +524,8 @@ ecore_fb_input_device_open(const char *dev)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
device->window = ee;
|
||||
_ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device);
|
||||
return device;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore_Input.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -49,10 +50,14 @@ struct _Ecore_Fb_Input_Device
|
|||
double last;
|
||||
double prev;
|
||||
double threshold;
|
||||
Eina_Bool did_double;
|
||||
Eina_Bool did_triple;
|
||||
/* absolute axis */
|
||||
int min_w, min_h;
|
||||
double rel_w, rel_h;
|
||||
int event;
|
||||
int prev_button;
|
||||
int last_button;
|
||||
} mouse;
|
||||
struct
|
||||
{
|
||||
|
@ -61,6 +66,7 @@ struct _Ecore_Fb_Input_Device
|
|||
int alt;
|
||||
int lock;
|
||||
} keyboard;
|
||||
void *window;
|
||||
};
|
||||
|
||||
/* ecore_fb_ts.c */
|
||||
|
|
|
@ -251,24 +251,26 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN
|
|||
if ((pressure) || (prev_pressure))
|
||||
{
|
||||
/* MOVE: mouse is down and was */
|
||||
Ecore_Fb_Event_Mouse_Move *e;
|
||||
Ecore_Event_Mouse_Move *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move));
|
||||
e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
|
||||
if (!e) goto retry;
|
||||
e->x = x;
|
||||
e->y = y;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
e->root.x = x;
|
||||
e->root.y = y;
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
}
|
||||
if ((pressure) && (!prev_pressure))
|
||||
{
|
||||
/* DOWN: mouse is down, but was not now */
|
||||
Ecore_Fb_Event_Mouse_Button_Down *e;
|
||||
Ecore_Event_Mouse_Button *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down));
|
||||
e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
if (!e) goto retry;
|
||||
e->x = x;
|
||||
e->y = y;
|
||||
e->button = 1;
|
||||
e->buttons = 1;
|
||||
if ((t - last_time) <= _ecore_fb_double_click_time)
|
||||
{
|
||||
e->double_click = 1;
|
||||
|
@ -288,23 +290,23 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN
|
|||
{
|
||||
did_triple = 0;
|
||||
}
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
|
||||
}
|
||||
else if ((!pressure) && (prev_pressure))
|
||||
{
|
||||
/* UP: mouse was down, but is not now */
|
||||
Ecore_Fb_Event_Mouse_Button_Up *e;
|
||||
Ecore_Event_Mouse_Button *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up));
|
||||
e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
if (!e) goto retry;
|
||||
e->x = prev_x;
|
||||
e->y = prev_y;
|
||||
e->button = 1;
|
||||
e->buttons = 1;
|
||||
if (did_double)
|
||||
e->double_click = 1;
|
||||
if (did_triple)
|
||||
e->triple_click = 1;
|
||||
ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
|
||||
}
|
||||
if (did_triple)
|
||||
{
|
||||
|
|
|
@ -300,9 +300,9 @@ _ecore_fb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, v
|
|||
|
||||
filter_data = loop_data;
|
||||
if (!filter_data) return EINA_TRUE;
|
||||
if (type == ECORE_FB_EVENT_MOUSE_MOVE)
|
||||
if (type == ECORE_EVENT_MOUSE_MOVE)
|
||||
{
|
||||
if ((filter_data->last_event_type) == ECORE_FB_EVENT_MOUSE_MOVE)
|
||||
if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
|
||||
{
|
||||
filter_data->last_event_type = type;
|
||||
return EINA_FALSE;
|
||||
|
|
Loading…
Reference in New Issue