ecore_x: Pass in/out through ecore_input_evas
This whole input system is a massive mess. It looks like spaghetti. Long live the giant flying monster. This commit changes how some events are propagated in X. Before: ecore_x -> evas_event -> evas After: ecore_x -> ecore_input_evas -> ecore_evas -> evas_event -> evas There are still inconsistencies between events and between X and WL, but ecore_evas should be used for all events since it rotates the inputs.
This commit is contained in:
parent
1c739cada9
commit
05dfab8442
|
@ -1261,6 +1261,38 @@ _ecore_evas_x_event_client_message(void *data EINA_UNUSED, int type EINA_UNUSED,
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_feed_cancel_out(const Ecore_X_Event_Mouse_Out *e, Eina_Bool cancel)
|
||||||
|
{
|
||||||
|
/* equivalent to:
|
||||||
|
* if (cancel) evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
|
||||||
|
* evas_event_feed_mouse_out(ee->evas, e->time, NULL);
|
||||||
|
* but this goes through ecore_event_evas and direct eo event callback
|
||||||
|
*/
|
||||||
|
if (cancel)
|
||||||
|
{
|
||||||
|
Ecore_Event_Mouse_Button cancel = {
|
||||||
|
.event_window = (Ecore_Window) e->event_win,
|
||||||
|
.modifiers = e->modifiers,
|
||||||
|
.timestamp = e->time,
|
||||||
|
.window = (Ecore_Window) e->win,
|
||||||
|
.x = e->x,
|
||||||
|
.y = e->y,
|
||||||
|
};
|
||||||
|
ecore_event_evas_mouse_button_cancel(NULL, ECORE_EVENT_MOUSE_BUTTON_CANCEL, &cancel);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ecore_Event_Mouse_IO io = {
|
||||||
|
.event_window = (Ecore_Window) e->event_win,
|
||||||
|
.modifiers = e->modifiers,
|
||||||
|
.timestamp = e->time,
|
||||||
|
.window = (Ecore_Window) e->win,
|
||||||
|
.x = e->x,
|
||||||
|
.y = e->y
|
||||||
|
};
|
||||||
|
ecore_event_evas_mouse_out(NULL, ECORE_EVENT_MOUSE_OUT, &io);
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_fake_out(void *data)
|
_fake_out(void *data)
|
||||||
{
|
{
|
||||||
|
@ -1272,9 +1304,8 @@ _fake_out(void *data)
|
||||||
|
|
||||||
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
|
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
|
||||||
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
|
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
|
||||||
if (e->mode == ECORE_X_EVENT_MODE_GRAB)
|
_feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB));
|
||||||
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
|
|
||||||
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
|
|
||||||
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);
|
||||||
ee->in = EINA_FALSE;
|
ee->in = EINA_FALSE;
|
||||||
|
@ -1348,10 +1379,17 @@ _ecore_evas_x_event_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void
|
||||||
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
|
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
|
||||||
if (!ee->in)
|
if (!ee->in)
|
||||||
{
|
{
|
||||||
|
Ecore_Event_Mouse_IO io = {
|
||||||
|
.event_window = (Ecore_Window) e->event_win,
|
||||||
|
.modifiers = e->modifiers,
|
||||||
|
.timestamp = e->time,
|
||||||
|
.window = (Ecore_Window) e->win,
|
||||||
|
.x = e->x,
|
||||||
|
.y = e->y
|
||||||
|
};
|
||||||
|
|
||||||
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
|
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
|
||||||
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
|
ecore_event_evas_mouse_in(NULL, ECORE_EVENT_MOUSE_IN, &io);
|
||||||
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
|
|
||||||
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
|
|
||||||
ee->in = EINA_TRUE;
|
ee->in = EINA_TRUE;
|
||||||
}
|
}
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
@ -1434,9 +1472,7 @@ _ecore_evas_x_event_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, void
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
|
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
|
||||||
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
|
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
|
||||||
if (e->mode == ECORE_X_EVENT_MODE_GRAB)
|
_feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB));
|
||||||
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
|
|
||||||
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
|
|
||||||
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);
|
||||||
ee->in = EINA_FALSE;
|
ee->in = EINA_FALSE;
|
||||||
|
@ -1732,8 +1768,7 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, vo
|
||||||
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
||||||
if (ee->in)
|
if (ee->in)
|
||||||
{
|
{
|
||||||
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
|
_feed_cancel_out(e, EINA_TRUE);
|
||||||
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
|
|
||||||
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);
|
||||||
ee->in = EINA_FALSE;
|
ee->in = EINA_FALSE;
|
||||||
|
|
Loading…
Reference in New Issue