[PATCH libXi 3/4] Added XIGrabDeviceWithConfine.
Daniel Stone
daniel at fooishbar.org
Mon Jun 6 04:57:17 PDT 2011
On Thu, Jun 02, 2011 at 09:59:22AM -0700, Jeremy Huddleston wrote:
> > @@ -65,10 +65,15 @@ XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
> > buff = calloc(1, len * 4);
> > memcpy(buff, mask->mask, mask->mask_len);
> >
> > + len++; /* for the confine_to */
> > +
> > SetReqLen(req, len, len);
> > - Data(dpy, buff, len * 4);
> > + Data(dpy, buff, (len - 1) * 4);
> > free(buff);
> >
> > + /* put the confine_to window at the end */
> > + Data32(dpy, &confine_to, 4);
> > +
> > if (_XReply(dpy, (xReply *)&reply, 0, xTrue) == 0)
> > reply.status = GrabSuccess;
>
> This feels cleaner to me:
>
> len = req->mask_len + 1;
> buff = calloc(1, req->mask_len * 4);
> memcpy(buff, mask->mask, mask->mask_len);
>
> SetReqLen(req, len, len);
> Data(dpy, buff, req->mask_len * 4);
> free(buff);
>
> Data32(dpy, &confine_to, 4);
Or to really be picky:
buff = calloc(req->mask_len, 4);
Cheers,
Daniel
More information about the xorg-devel
mailing list