send wl_touch events when we handle mouse buttons

Small patch to enable sending wl_touch down/up events when pointer
mouse button events are handled. This is needed in the case where we
do Not have any mouse pointer at all, but we do have touch support.

ref T5094

NB: This allows weston-simple-touch client to operate in Enlightenment
now. There is still something strange happening with EFL clients in E
wrt touch events tho...

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-01-17 11:31:48 -05:00
parent d01509cf26
commit 7906537c02
3 changed files with 31 additions and 8 deletions

View File

@ -369,6 +369,15 @@ _e_comp_wl_send_mouse_move(E_Client *ec, int x, int y, unsigned int timestamp)
wl_fixed_from_int(x - ec->client.x),
wl_fixed_from_int(y - ec->client.y));
}
EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res)
{
if (!e_comp_wl_input_touch_check(res)) continue;
if (wl_resource_get_client(res) != wc) continue;
wl_touch_send_motion(res, timestamp, 1,
wl_fixed_from_int(x - ec->client.x),
wl_fixed_from_int(y - ec->client.y));
}
}
static void
@ -395,6 +404,7 @@ _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
Evas_Event_Mouse_Down *ev = event;
e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
ev->canvas.x, ev->canvas.y,
WL_POINTER_BUTTON_STATE_PRESSED);
}
@ -405,6 +415,7 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
Evas_Event_Mouse_Up *ev = event;
e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
ev->canvas.x, ev->canvas.y,
WL_POINTER_BUTTON_STATE_RELEASED);
}
@ -1343,7 +1354,6 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
_e_comp_wl_surface_state_buffer_set(state, NULL);
if (ec->comp_data->shell.surface)
{
if (ec->comp_data->shell.set.min_size.w)
@ -3317,7 +3327,7 @@ e_comp_wl_key_up(Ecore_Event_Key *ev)
}
E_API Eina_Bool
e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state)
e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, int x, int y, uint32_t state)
{
Eina_List *l;
struct wl_client *wc;
@ -3368,9 +3378,6 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
if (!ec->comp_data->surface) return EINA_FALSE;
if (!eina_list_count(e_comp_wl->ptr.resources))
return EINA_TRUE;
wc = wl_resource_get_client(ec->comp_data->surface);
*state_serial = serial = wl_display_next_serial(e_comp_wl->wl.disp);
@ -3380,6 +3387,20 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
if (!e_comp_wl_input_pointer_check(res)) continue;
wl_pointer_send_button(res, serial, timestamp, btn, state);
}
EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_comp_wl_input_touch_check(res)) continue;
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
wl_touch_send_down(res, serial, timestamp,
ec->comp_data->surface, 0,
wl_fixed_from_int(x - ec->client.x),
wl_fixed_from_int(y - ec->client.y));
else
wl_touch_send_up(res, serial, timestamp, 0);
}
return EINA_TRUE;
}

View File

@ -381,7 +381,7 @@ E_API void e_comp_wl_output_remove(const char *id);
EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev);
EINTERN Eina_Bool e_comp_wl_key_up(Ecore_Event_Key *ev);
E_API Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state);
E_API Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, int x, int y, uint32_t state);
E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD;

View File

@ -93,9 +93,11 @@ _xwayland_drop(E_Drag *drag, int dropped)
if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return;
e_comp_wl->drag = NULL;
if ((!e_comp_wl->ptr.ec) ||
(wl_resource_get_client(e_comp_wl->ptr.ec->comp_data->surface) != e_comp_wl->xwl_client))
(wl_resource_get_client(e_comp_wl->ptr.ec->comp_data->surface) != e_comp_wl->xwl_client))
e_comp_wl_evas_handle_mouse_button(e_comp_wl->drag_client, 0,
e_comp_wl->ptr.button, WL_POINTER_BUTTON_STATE_RELEASED);
e_comp_wl->ptr.button,
e_comp_wl->ptr.x, e_comp_wl->ptr.y,
WL_POINTER_BUTTON_STATE_RELEASED);
if (dropped || e_object_is_del(E_OBJECT(drag)) || (!e_comp_wl->selection.target))
_xdnd_finish(0);
else