[PATCH v2 libXi multitouch 4/4] Implement support for XI 2.2
Chase Douglas
chase.douglas at canonical.com
Sun Oct 16 16:08:01 PDT 2011
On Oct 16, 2011, at 3:53 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> On Fri, Oct 14, 2011 at 09:22:27AM -0700, Chase Douglas wrote:
>> On 10/13/2011 10:23 PM, Peter Hutterer wrote:
>>> From: Chase Douglas <chase.douglas at canonical.com>
>>>
>>> XI 2.1 has not been implemented yet, so this code defines version info
>>> for it too. These will be dropped when XI 2.1 support is merged.
>>>
>>> The code is based on what we have in the prototype libXi in Ubuntu. The
>>> main differences are:
>>>
>>> * No touch valuator classes
>>> * No TouchUpdateUnownedEvents
>>> * Addition of raw touch events
>>> * Touch grab and ungrab is handled in existing passive grab functions
>>> * XIAllowTouchEvents has been added as an extension of XIAllowEvents
>>> * XIAllowEvents has been extended when XI 2.2 is supported
>>>
>>> The last item causes a bit of an issue. The XIAllowEvents handling in
>>> released X.org servers check that the size of the request is exactly the
>>> size published in XI 2.0. Since we are extending the request, we must
>>> get the right request size from the Xlib buffer depending on what
>>> version of XI the server supports.
>>>
>>> None of this code has been tested because we don't have a server to test
>>> it with yet.
>>>
>>> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
>>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>>> ---
>>> Changes to v1:
>>> - adjust to current protocol
>>> - rebase on current libXi master
>>> - re-use code in XIAllowTouchEvents and XIAllowEvents
>>>
>>> This patch requires http://patchwork.freedesktop.org/patch/7580/
>>> Untested for lack of a server supporting MT, and it doesn't include the man
>>> pages yet either.
>>
>> [snip]
>>
>>> diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
>>> index 1d388b3..e53cf25 100644
>>> --- a/src/XIAllowEvents.c
>>> +++ b/src/XIAllowEvents.c
>>> @@ -29,9 +29,12 @@
>>> #include <X11/extensions/extutil.h>
>>> #include "XIint.h"
>>>
>>> -Status
>>> -XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time)
>>> +static Status
>>> +_XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
>>> + unsigned int touch_id, Window grab_window)
>>> {
>>> + Bool have_XI22 = False;
>>
>> It looks like have_XI22 is set backwards. Shouldn't it be True here, and
>> then ...
>>
>>> + int req_len = sz_xXIAllowEventsReq; /* in bytes */
>>> xXIAllowEventsReq *req;
>>>
>>> XExtDisplayInfo *extinfo = XInput_find_display(dpy);
>>> @@ -40,14 +43,51 @@ XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time)
>>> if (_XiCheckExtInit(dpy, XInput_2_0, extinfo) == -1)
>>> return (NoSuchExtension);
>>>
>>> - GetReq(XIAllowEvents, req);
>>> + /* 2.2's XIAllowEvents is 8 bytes longer than 2.0 */
>>> + if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1) {
>>> + req_len -= 8;
>>> + have_XI22 = True;
>>
>> set to False here?
>
> oops. thanks, amended locally.
Then,
Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
Sorry if this comes across as html, I'm replying from my phone.
More information about the xorg-devel
mailing list