[PATCH inputproto multitouch v2] Allow grabbing clients to accept or reject touches any time

Chase Douglas chase.douglas at canonical.com
Wed Sep 14 13:14:51 PDT 2011


On 09/14/2011 02:57 PM, Peter Hutterer wrote:
> On Wed, Sep 14, 2011 at 02:43:17PM -0500, Chase Douglas wrote:
>> This is potentially both a performance and client complexity
>> improvement. An example is a gesture recognizer using touch grabs on
>> each window with a subscription. If events on a child window is known
> 
> s/is/are/
> 
>> to not match any subscription on the child window, then the client
>> should be able to reject the touch grab even if the parent window hasn't
>> accepted any of the touches, perhaps because the parent window
>> gesture hasn't timed out or crossed other thresholds yet.
>>
>> As an inverse example, the events may match a child window subscription
>> before the root window has rejected ownership. The child window should
>> be able to accept the touch proactively. This allows for further clients
>> to receive a TouchEnd event earlier, and means the client may be able to
>> reduce state being tracked. If this were not allowed, the client would
>> need to wait until it received ownership before accepting the sequence.
>>
>> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> 
> I think this may require some rewording of the other sections to emphasise
> this more. We can do that at a later review of the whole document.
>> ---
>>  XI2proto.h         |    3 ++-
>>  specs/XI2proto.txt |   28 ++++++++++++++++++----------
>>  2 files changed, 20 insertions(+), 11 deletions(-)
>>
>> diff --git a/XI2proto.h b/XI2proto.h
>> index 3315f1e..9e2c63c 100644
>> --- a/XI2proto.h
>> +++ b/XI2proto.h
>> @@ -648,8 +648,9 @@ typedef struct {
>>      uint8_t     mode;
>>      uint8_t     pad;
>>      uint32_t    touch_id;               /**< Since XI 2.2 */
>> +    Window      grab_window;            /**< Since XI 2.2 */
>>  } xXIAllowEventsReq;
>> -#define sz_xXIAllowEventsReq                   16 /**< Was 12 before XI 2.2 */
>> +#define sz_xXIAllowEventsReq                   20 /**< Was 12 before XI 2.2 */
>>  
>>  
>>  /**
>> diff --git a/specs/XI2proto.txt b/specs/XI2proto.txt
>> index 9bd586a..dfc80cc 100644
>> --- a/specs/XI2proto.txt
>> +++ b/specs/XI2proto.txt
>> @@ -1373,6 +1373,7 @@ active device grab becomes not viewable.
>>                                 ReplayDevice, AsyncPair, SyncPair, AcceptTouch*,
>>                                 RejectTouch* }
>>              touch_id*:       CARD32
>> +            grab_window*:    Window
>>      └───
>>  
>>  * since XI 2.2
>> @@ -1391,13 +1392,17 @@ ownership processing.
>>      touch_id
>>          The ID of the touch sequence to accept or reject. The value is undefined
>>          for event modes other than AcceptTouch and RejectTouch.
>> +    grab_window
>> +        The window on which to accept or reject a touch sequence grab. The value
>> +        is undefined for event modes other than AcceptTouch and RejectTouch.
>>  
>> -The request has no effect if the specified time is earlier than the
>> -last-grab time of the most recent active grab for the client, or if the
>> -specified time is later than the current X server time.
>> +For event modes other than AcceptTouch and RejectTouch, the request has no
>> +effect if the specified time is earlier than the last-grab time of the most
>> +recent active grab for the client, or if the specified time is later than the
>> +current X server time.
> 
> why do we need to change this? could we not keep this around (or otherwise
> force clients to use CurrentTime for passive touch grabs).

The time check is used for pointer or key passive grabbing. For example:

1. Button press causes passive grab
2. Button press releases grab
3. Button press causes passive grab
4. Client receives passive grab events from the press in step 1
5. Client makes XIAllowEvents request

The time helps determine which grab the XIAllowEvents is supposed to
affect. Or something like that anyways.

With touches, each new touch has a new ID, so the touch_id and window
fields effectively take care of all ambiguities.

Here at XDC, Peter suggested to just require clients to use CurrenTime
instead of leaving it undefined for touch modes. I'll fix that up and
push it.

-- Chase


More information about the xorg-devel mailing list