From b0ce015a8494bdc48e4d38ddf22b7e5e4c02814a Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Fri, 4 Mar 2011 01:00:41 +0100 Subject: Make grabbing client exclusive When a possible gesture is started for a global client (sysflag set), it is desirable that gestures to other clients are disregarded until all contacts have left the surface. In principle this could be refined further, such that if gesture are not detected, they are passed on to other clients, but that also affects how touches are passed onto lower layers like XI2.1, so simply making sure a global system client gets all events potentially leading to gestures is good enough for now. Also note that in the current combination of synaptics/evdev X servers and grail, there can be no overlapping potential gestures between two global clients, or the resulting event recipient is not correct. Signed-off-by: Henrik Rydberg --- src/grail-inserter.c | 9 +++++++++ src/grail-inserter.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/grail-inserter.c b/src/grail-inserter.c index 6f9a034..ff4f0b6 100644 --- a/src/grail-inserter.c +++ b/src/grail-inserter.c @@ -69,6 +69,13 @@ static void setup_new_gestures(struct grail *ge, for (j = 0; j < nclient; j++) { if (!grail_mask_get(info[j].mask, s->type)) continue; + if (gin->grab_active && + info[j].id.client != gin->grab_client) + continue; + if (grail_mask_get(info[j].mask, GRAIL_TYPE_SYSFLAG1)) { + gin->grab_active = 1; + gin->grab_client = info[j].id.client; + } s->client_id[s->nclient++] = info[j].id; } } @@ -105,6 +112,8 @@ void gin_frame_begin(struct grail *ge, const struct utouch_frame *frame) struct gesture_inserter *gin = ge->gin; memset(gin->types, 0, sizeof(gin->types)); gin->time = frame->time; + if (frame->num_active && !frame->prev->num_active) + gin->grab_active = 0; } void gin_frame_end(struct grail *ge, const struct utouch_frame *frame) diff --git a/src/grail-inserter.h b/src/grail-inserter.h index 3b8cd77..fb944dd 100644 --- a/src/grail-inserter.h +++ b/src/grail-inserter.h @@ -53,6 +53,8 @@ struct gesture_inserter { grail_mask_t used[DIM_INSTANCE_BYTES]; grail_time_t time; int gestureid; + int grab_active; + int grab_client; float scale_x, scale_y, scale_r; float trans_x, trans_y; }; -- cgit v1.2.3