aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/efl_wl/efl_wl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/efl_wl/efl_wl.c')
-rw-r--r--src/lib/efl_wl/efl_wl.c122
1 files changed, 92 insertions, 30 deletions
diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c
index 5f04eed930..88a9600b21 100644
--- a/src/lib/efl_wl/efl_wl.c
+++ b/src/lib/efl_wl/efl_wl.c
@@ -249,6 +249,7 @@ typedef struct Comp_Seat
Eina_Bool focused : 1;
Eina_Bool selection_changed : 1;
Eina_Bool selection_exists : 1;
+ Eina_Bool event_propagate : 1;
} Comp_Seat;
typedef struct Comp_Buffer_State
@@ -1956,7 +1957,7 @@ comp_surface_send_data_device_enter(Comp_Surface *cs, Comp_Seat *s)
wl_fixed_from_int(cx - x), wl_fixed_from_int(cy - y), offer);
}
-static void
+static Eina_Bool
comp_surface_send_pointer_enter(Comp_Surface *cs, Comp_Seat *s, int cx, int cy)
{
Eina_List *l, *ll;
@@ -1964,32 +1965,39 @@ comp_surface_send_pointer_enter(Comp_Surface *cs, Comp_Seat *s, int cx, int cy)
uint32_t serial;
int x, y;
- if (s->ptr.enter && (cs != s->grab)) return;
- if (!comp_surface_check_grab(cs, s)) return;
+ if (s->ptr.enter && (cs != s->grab)) return EINA_FALSE;
+ if (!comp_surface_check_grab(cs, s)) return EINA_FALSE;
s->ptr.enter = cs;
- if (cs->dead) return;
+ if (cs->dead) return EINA_FALSE;
if (s->drag.res && (!s->drag.tch))
{
comp_surface_send_data_device_enter(cs, s);
- return;
+ return EINA_TRUE;
}
l = seat_ptr_resources_get(s, wl_resource_get_client(cs->res));
- if (!l) return;
+ if (!l) return EINA_FALSE;
s->ptr.enter_serial = serial = wl_display_next_serial(cs->c->display);
//fprintf(stderr, "ENTER %s\n", cs->shell.popup ? "POPUP" : "TOPLEVEL");
evas_object_geometry_get(cs->obj, &x, &y, NULL, NULL);
EINA_LIST_FOREACH(l, ll, res)
wl_pointer_send_enter(res, serial, cs->res,
wl_fixed_from_int(cx - x), wl_fixed_from_int(cy - y));
+ return EINA_TRUE;
}
static void
comp_surface_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_In *ev = event_info;
+ Comp_Seat *s;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- comp_surface_send_pointer_enter(data, seat_find(data, ev->dev), ev->canvas.x, ev->canvas.y);
+ s = seat_find(data, ev->dev);
+ if (comp_surface_send_pointer_enter(data, s, ev->canvas.x, ev->canvas.y))
+ {
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ }
}
static void
@@ -2006,40 +2014,47 @@ comp_surface_send_data_device_leave(Comp_Surface *cs, Comp_Seat *s)
wl_data_device_send_leave(res);
}
-static void
+static Eina_Bool
comp_surface_send_pointer_leave(Comp_Surface *cs, Comp_Seat *s)
{
Eina_List *l, *ll;
struct wl_resource *res;
uint32_t serial;
- if (s->ptr.enter != cs) return;
- if (!comp_surface_check_grab(cs, s)) return;
+ if (s->ptr.enter != cs) return EINA_FALSE;
+ if (!comp_surface_check_grab(cs, s)) return EINA_FALSE;
s->ptr.enter = NULL;
- if (cs->dead) return;
+ if (cs->dead) return EINA_FALSE;
if (s->drag.res)
{
comp_surface_send_data_device_leave(cs, s);
- return;
+ return EINA_TRUE;
}
l = seat_ptr_resources_get(s, wl_resource_get_client(cs->res));
- if (!l) return;
+ if (!l) return EINA_FALSE;
serial = wl_display_next_serial(cs->c->display);
//fprintf(stderr, "LEAVE %s\n", cs->shell.popup ? "POPUP" : "TOPLEVEL");
EINA_LIST_FOREACH(l, ll, res)
wl_pointer_send_leave(res, serial, cs->res);
+ return EINA_TRUE;
}
static void
comp_surface_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Out *ev = event_info;
+ Comp_Seat *s;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- comp_surface_send_pointer_leave(data, seat_find(data, ev->dev));
+ s = seat_find(data, ev->dev);
+ if (comp_surface_send_pointer_leave(data, s))
+ {
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ }
}
-static void
+static Eina_Bool
comp_surface_mouse_button(Comp_Surface *cs, Comp_Seat *s, uint32_t timestamp, uint32_t button_id, uint32_t state)
{
uint32_t serial, btn;
@@ -2073,13 +2088,13 @@ comp_surface_mouse_button(Comp_Surface *cs, Comp_Seat *s, uint32_t timestamp, ui
btn = button_id + BTN_SIDE - 8;
break;
}
- if (s->ptr.enter != cs) return;
- if (!comp_surface_check_grab(cs, s)) return;
+ if (s->ptr.enter != cs) return EINA_FALSE;
+ if (!comp_surface_check_grab(cs, s)) return EINA_FALSE;
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
s->ptr.button_mask |= 1 << button_id;
else
{
- if (!(s->ptr.button_mask & (1 << button_id))) return;
+ if (!(s->ptr.button_mask & (1 << button_id))) return EINA_FALSE;
s->ptr.button_mask &= ~(1 << button_id);
if (s->drag.res && (!s->drag.tch))
{
@@ -2087,41 +2102,54 @@ comp_surface_mouse_button(Comp_Surface *cs, Comp_Seat *s, uint32_t timestamp, ui
comp_surface_input_event(&s->ptr.events, button_id, 0, timestamp, state == WL_POINTER_BUTTON_STATE_RELEASED);
s->ptr.enter = NULL;
comp_surface_send_pointer_enter(cs, s, s->ptr.pos.x, s->ptr.pos.y);
- return;
+ return EINA_TRUE;
}
}
if (cs->dead)
{
comp_surface_input_event(&s->ptr.events, button_id, 0, timestamp, state == WL_POINTER_BUTTON_STATE_RELEASED);
- return;
+ return EINA_TRUE;
}
l = seat_ptr_resources_get(s, wl_resource_get_client(cs->res));
- if (!l) return;
+ if (!l) return EINA_FALSE;
serial = wl_display_next_serial(s->c->display);
comp_surface_input_event(&s->ptr.events, button_id, serial, timestamp, state == WL_POINTER_BUTTON_STATE_RELEASED);
EINA_LIST_FOREACH(l, ll, res)
wl_pointer_send_button(res, serial, timestamp, btn, state);
+ return EINA_TRUE;
}
static void
comp_surface_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
+ Comp_Seat *s;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- comp_surface_mouse_button(data, seat_find(data, ev->dev), ev->timestamp, ev->button, WL_POINTER_BUTTON_STATE_PRESSED);
+ s = seat_find(data, ev->dev);
+ if (comp_surface_mouse_button(data, s, ev->timestamp, ev->button, WL_POINTER_BUTTON_STATE_PRESSED))
+ {
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ }
}
static void
comp_surface_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
+ Comp_Seat *s;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- comp_surface_mouse_button(data, seat_find(data, ev->dev), ev->timestamp, ev->button, WL_POINTER_BUTTON_STATE_RELEASED);
+ s = seat_find(data, ev->dev);
+ if (comp_surface_mouse_button(data, s, ev->timestamp, ev->button, WL_POINTER_BUTTON_STATE_RELEASED))
+ {
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ }
}
static void
@@ -2165,6 +2193,8 @@ comp_surface_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
wl_fixed_from_int(ev->cur.canvas.x - x), wl_fixed_from_int(ev->cur.canvas.y - y));
}
}
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ s->event_propagate = 1;
}
static void
@@ -2196,6 +2226,8 @@ comp_surface_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EI
if (!l) return;
EINA_LIST_FOREACH(l, ll, res)
wl_pointer_send_axis(res, ev->timestamp, axis, dir);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ s->event_propagate = 1;
}
static void
@@ -2218,6 +2250,8 @@ comp_surface_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
if (!l)
{
comp_surface_input_event(&s->tch.events, ev->device, 0, ev->timestamp, 0);
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return;
}
evas_object_geometry_get(cs->obj, &x, &y, NULL, NULL);
@@ -2226,6 +2260,8 @@ comp_surface_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
EINA_LIST_FOREACH(l, ll, res)
wl_touch_send_down(res, serial, ev->timestamp, cs->res, ev->device,
wl_fixed_from_int(ev->canvas.x - x), wl_fixed_from_int(ev->canvas.y - y));
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
}
static void
@@ -2250,12 +2286,16 @@ comp_surface_multi_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
if (s->drag.tch)
wl_data_device_send_drop(data_device_find(s, cs->res));
comp_surface_input_event(&s->tch.events, ev->device, 0, ev->timestamp, 1);
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return;
}
serial = wl_display_next_serial(cs->c->display);
comp_surface_input_event(&s->tch.events, ev->device, serial, ev->timestamp, 1);
EINA_LIST_FOREACH(l, ll, res)
wl_touch_send_up(res, serial, ev->timestamp, ev->device);
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
}
static void
@@ -2277,8 +2317,12 @@ comp_surface_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
if (s->drag.enter != cs) return;
res = data_device_find(s, cs->res);
if (res)
- wl_data_device_send_motion(res, ev->timestamp,
- wl_fixed_from_int(ev->cur.canvas.x - x), wl_fixed_from_int(ev->cur.canvas.y - y));
+ {
+ wl_data_device_send_motion(res, ev->timestamp,
+ wl_fixed_from_int(ev->cur.canvas.x - x), wl_fixed_from_int(ev->cur.canvas.y - y));
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ }
return;
}
else
@@ -2290,6 +2334,8 @@ comp_surface_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
EINA_LIST_FOREACH(l, ll, res)
wl_touch_send_motion(res, ev->timestamp, ev->device,
wl_fixed_from_int(ev->cur.canvas.x - x), wl_fixed_from_int(ev->cur.canvas.y - y));
+ s->event_propagate = 1;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
}
}
@@ -4907,9 +4953,13 @@ comp_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
Comp *c = data;
Evas_Event_Mouse_In *ev = event_info;
Comp_Seat *s;
-
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
s = comp_seat_find(c, ev->dev);
+
+ if (!s->event_propagate)
+ {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
+ }
+ s->event_propagate = 0;
if (s->drag.proxy_win)
{
ecore_evas_free(s->drag.proxy_win);
@@ -4943,8 +4993,12 @@ comp_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
Comp_Seat *s;
int w, h;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
s = comp_seat_find(c, ev->dev);
+ if (!s->event_propagate)
+ {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
+ }
+ s->event_propagate = 0;
s->tch.pos.x = ev->cur.canvas.x;
s->tch.pos.y = ev->cur.canvas.y;
if ((!s->drag.tch) || (!s->drag.surface)) return;
@@ -4960,8 +5014,12 @@ comp_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
Comp_Seat *s;
int w, h;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
s = comp_seat_find(c, ev->dev);
+ if (!s->event_propagate)
+ {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
+ }
+ s->event_propagate = 0;
s->ptr.pos.x = ev->cur.canvas.x;
s->ptr.pos.y = ev->cur.canvas.y;
if (s->drag.tch || (!s->drag.surface)) return;
@@ -4979,8 +5037,12 @@ comp_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_in
const char **types, *type;
unsigned int i = 0;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
s = comp_seat_find(c, ev->dev);
+ if (!s->event_propagate)
+ {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
+ }
+ s->event_propagate = 0;
s->ptr.in = 0;
ecore_evas_cursor_device_unset(ecore_evas_ecore_evas_get(e), ev->dev);
if (s->ptr.efl.obj)