From afd083788b40e465955176be7c2e4458f2a9ec6a Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 24 Mar 2016 12:44:21 -0500 Subject: [PATCH] ecore-evas wayland: use www protocol when available handle www protocol events and store the provided data into engine data Signed-off-by: Derek Foreman --- .../wayland/ecore_evas_wayland_common.c | 48 +++++++++++++++++-- .../wayland/ecore_evas_wayland_private.h | 4 ++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index a43209d496..5d17831b0f 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -34,7 +34,7 @@ EVAS_SMART_SUBCLASS_NEW(_smart_frame_type, _ecore_evas_wl_frame, /* local variables */ static int _ecore_evas_wl_init_count = 0; -static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5]; +static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[7]; static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); @@ -382,6 +382,43 @@ _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize) _rotation_do(ee, rotation, resize); } +static Eina_Bool +_ecore_evas_wl_common_cb_www_drag(void *d EINA_UNUSED, int t EINA_UNUSED, void *event) +{ + Ecore_Wl2_Event_Window_WWW_Drag *ev = event; + Ecore_Evas_Engine_Wl_Data *wdata; + Ecore_Evas *ee; + + ee = ecore_event_window_match(ev->window); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + wdata = ee->engine.data; + wdata->dragging = !!ev->dragging; + if (!ev->dragging) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_evas_wl_common_cb_www(void *d EINA_UNUSED, int t EINA_UNUSED, void *event) +{ + Ecore_Wl2_Event_Window_WWW *ev = event; + Ecore_Evas_Engine_Wl_Data *wdata; + Ecore_Evas *ee; + + ee = ecore_event_window_match(ev->window); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + wdata = ee->engine.data; + wdata->x_rel += ev->x_rel; + wdata->y_rel += ev->y_rel; + wdata->timestamp = ev->timestamp; + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + return ECORE_CALLBACK_RENEW; +} + int _ecore_evas_wl_common_init(void) { @@ -405,7 +442,12 @@ _ecore_evas_wl_common_init(void) _ecore_evas_wl_event_hdls[4] = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, _ecore_evas_wl_common_cb_window_configure, NULL); - + _ecore_evas_wl_event_hdls[5] = + ecore_event_handler_add(_ecore_wl2_event_window_www, + _ecore_evas_wl_common_cb_www, NULL); + _ecore_evas_wl_event_hdls[6] = + ecore_event_handler_add(_ecore_wl2_event_window_www_drag, + _ecore_evas_wl_common_cb_www_drag, NULL); ecore_event_evas_init(); return _ecore_evas_wl_init_count; @@ -421,7 +463,7 @@ _ecore_evas_wl_common_shutdown(void) if (--_ecore_evas_wl_init_count != 0) return _ecore_evas_wl_init_count; - for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++) + for (i = 0; i < EINA_C_ARRAY_LENGTH(_ecore_evas_wl_event_hdls); i++) { if (_ecore_evas_wl_event_hdls[i]) ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]); diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h index ecbaede7d8..6aafa8430a 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h @@ -39,6 +39,10 @@ struct _Ecore_Evas_Engine_Wl_Data struct wl_egl_window *egl_win; #endif struct wl_callback *anim_callback; + int x_rel; + int y_rel; + uint32_t timestamp; + Eina_Bool dragging : 1; Eina_Bool sync_done : 1; Eina_Bool defer_show : 1;