summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-01-17 11:31:48 -0500
committerChris Michael <cp.michael@samsung.com>2017-01-17 11:31:48 -0500
commit7906537c021c574fe4cebabbfff4134e8c9be730 (patch)
treec54baeff86c3eae0ce9dd1769508c5ce8650a600
parentd01509cf260b1156c9bb7da8e84cc1e4661cf9b6 (diff)
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>
-rw-r--r--src/bin/e_comp_wl.c31
-rw-r--r--src/bin/e_comp_wl.h2
-rw-r--r--src/modules/xwayland/dnd.c6
3 files changed, 31 insertions, 8 deletions
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index deaa6f404..58c940e9a 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -369,6 +369,15 @@ _e_comp_wl_send_mouse_move(E_Client *ec, int x, int y, unsigned int timestamp)
369 wl_fixed_from_int(x - ec->client.x), 369 wl_fixed_from_int(x - ec->client.x),
370 wl_fixed_from_int(y - ec->client.y)); 370 wl_fixed_from_int(y - ec->client.y));
371 } 371 }
372
373 EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res)
374 {
375 if (!e_comp_wl_input_touch_check(res)) continue;
376 if (wl_resource_get_client(res) != wc) continue;
377 wl_touch_send_motion(res, timestamp, 1,
378 wl_fixed_from_int(x - ec->client.x),
379 wl_fixed_from_int(y - ec->client.y));
380 }
372} 381}
373 382
374static void 383static void
@@ -395,6 +404,7 @@ _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
395 Evas_Event_Mouse_Down *ev = event; 404 Evas_Event_Mouse_Down *ev = event;
396 405
397 e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button, 406 e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
407 ev->canvas.x, ev->canvas.y,
398 WL_POINTER_BUTTON_STATE_PRESSED); 408 WL_POINTER_BUTTON_STATE_PRESSED);
399} 409}
400 410
@@ -405,6 +415,7 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
405 Evas_Event_Mouse_Up *ev = event; 415 Evas_Event_Mouse_Up *ev = event;
406 416
407 e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button, 417 e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
418 ev->canvas.x, ev->canvas.y,
408 WL_POINTER_BUTTON_STATE_RELEASED); 419 WL_POINTER_BUTTON_STATE_RELEASED);
409} 420}
410 421
@@ -1343,7 +1354,6 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
1343 1354
1344 _e_comp_wl_surface_state_buffer_set(state, NULL); 1355 _e_comp_wl_surface_state_buffer_set(state, NULL);
1345 1356
1346
1347 if (ec->comp_data->shell.surface) 1357 if (ec->comp_data->shell.surface)
1348 { 1358 {
1349 if (ec->comp_data->shell.set.min_size.w) 1359 if (ec->comp_data->shell.set.min_size.w)
@@ -3317,7 +3327,7 @@ e_comp_wl_key_up(Ecore_Event_Key *ev)
3317} 3327}
3318 3328
3319E_API Eina_Bool 3329E_API Eina_Bool
3320e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state) 3330e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, int x, int y, uint32_t state)
3321{ 3331{
3322 Eina_List *l; 3332 Eina_List *l;
3323 struct wl_client *wc; 3333 struct wl_client *wc;
@@ -3368,9 +3378,6 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
3368 3378
3369 if (!ec->comp_data->surface) return EINA_FALSE; 3379 if (!ec->comp_data->surface) return EINA_FALSE;
3370 3380
3371 if (!eina_list_count(e_comp_wl->ptr.resources))
3372 return EINA_TRUE;
3373
3374 wc = wl_resource_get_client(ec->comp_data->surface); 3381 wc = wl_resource_get_client(ec->comp_data->surface);
3375 *state_serial = serial = wl_display_next_serial(e_comp_wl->wl.disp); 3382 *state_serial = serial = wl_display_next_serial(e_comp_wl->wl.disp);
3376 3383
@@ -3380,6 +3387,20 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
3380 if (!e_comp_wl_input_pointer_check(res)) continue; 3387 if (!e_comp_wl_input_pointer_check(res)) continue;
3381 wl_pointer_send_button(res, serial, timestamp, btn, state); 3388 wl_pointer_send_button(res, serial, timestamp, btn, state);
3382 } 3389 }
3390
3391 EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res)
3392 {
3393 if (wl_resource_get_client(res) != wc) continue;
3394 if (!e_comp_wl_input_touch_check(res)) continue;
3395 if (state == WL_POINTER_BUTTON_STATE_PRESSED)
3396 wl_touch_send_down(res, serial, timestamp,
3397 ec->comp_data->surface, 0,
3398 wl_fixed_from_int(x - ec->client.x),
3399 wl_fixed_from_int(y - ec->client.y));
3400 else
3401 wl_touch_send_up(res, serial, timestamp, 0);
3402 }
3403
3383 return EINA_TRUE; 3404 return EINA_TRUE;
3384} 3405}
3385 3406
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index a78f5cd0c..ca8164859 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -381,7 +381,7 @@ E_API void e_comp_wl_output_remove(const char *id);
381 381
382EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev); 382EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev);
383EINTERN Eina_Bool e_comp_wl_key_up(Ecore_Event_Key *ev); 383EINTERN Eina_Bool e_comp_wl_key_up(Ecore_Event_Key *ev);
384E_API Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state); 384E_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);
385 385
386E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD; 386E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD;
387 387
diff --git a/src/modules/xwayland/dnd.c b/src/modules/xwayland/dnd.c
index 47c5d9569..56b1fbaf7 100644
--- a/src/modules/xwayland/dnd.c
+++ b/src/modules/xwayland/dnd.c
@@ -93,9 +93,11 @@ _xwayland_drop(E_Drag *drag, int dropped)
93 if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return; 93 if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return;
94 e_comp_wl->drag = NULL; 94 e_comp_wl->drag = NULL;
95 if ((!e_comp_wl->ptr.ec) || 95 if ((!e_comp_wl->ptr.ec) ||
96 (wl_resource_get_client(e_comp_wl->ptr.ec->comp_data->surface) != e_comp_wl->xwl_client)) 96 (wl_resource_get_client(e_comp_wl->ptr.ec->comp_data->surface) != e_comp_wl->xwl_client))
97 e_comp_wl_evas_handle_mouse_button(e_comp_wl->drag_client, 0, 97 e_comp_wl_evas_handle_mouse_button(e_comp_wl->drag_client, 0,
98 e_comp_wl->ptr.button, WL_POINTER_BUTTON_STATE_RELEASED); 98 e_comp_wl->ptr.button,
99 e_comp_wl->ptr.x, e_comp_wl->ptr.y,
100 WL_POINTER_BUTTON_STATE_RELEASED);
99 if (dropped || e_object_is_del(E_OBJECT(drag)) || (!e_comp_wl->selection.target)) 101 if (dropped || e_object_is_del(E_OBJECT(drag)) || (!e_comp_wl->selection.target))
100 _xdnd_finish(0); 102 _xdnd_finish(0);
101 else 103 else