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

Keith Packard keithp at keithp.com
Wed Feb 8 09:10:13 PST 2012


<#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.

> +
> +    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...

> +            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.

-- 
keith.packard at intel.com


More information about the xorg-devel mailing list