[PATCH v3 xserver] Xi: handle new XIAllowEvents request in inputproto 2.1.99.6

Peter Hutterer peter.hutterer at who-t.net
Wed Feb 8 14:02:30 PST 2012


On Wed, Feb 08, 2012 at 09:10:13AM -0800, Keith Packard wrote:
> <#part sign=pgpmime>
> On Wed,  8 Feb 2012 19:18:19 +1000, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> 
> > -    /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */
> > +    xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
> > +    if (!xi_client)
> > +        return BadRequest;
> 
> Other uses of this private do not check for a NULL return as it "can't"
> happen.

oh. true enough. Removed the if check locally.
> 
> > +
> > +    if (version_compare(xi_client->major_version,
> > +                        xi_client->minor_version, 2, 2) >= 0)
> > +    {
> > +        REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
> > +        have_xi22 = TRUE;
> > +    } else
> > +        REQUEST_SIZE_MATCH(xXIAllowEventsReq);
> 
> I'd enclose the else clause in { } as REQUEST_SIZE_MATCH contains an
> 'if' clause. Fortunately, it doesn't cause any harm in this case, but...

amended locally, thanks.
 
> > +            rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess);
> > +            if (rc != Success)
> > +                return rc;
> > +
> > +            ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
> > +                                    stuff->grab_window, &client->errorValue);
> > +        }
> 
> Why does this look the window up and then pass the window ID along to
> TouchAcceptReject? Seems like a funky API to me.

for touch listeners, we store the window ID, not the WindowPtr. So the check
is there to make sure the window is valid (and we can return that to the
client). The actual use of it is limited to the numerical XID though.

Cheers,
  Peter


More information about the xorg-devel mailing list