[PATCH libXi 3/4] Added XIGrabDeviceWithConfine.
Peter Hutterer
peter.hutterer at who-t.net
Mon Jun 6 20:48:49 PDT 2011
On Mon, Jun 06, 2011 at 12:57:17PM +0100, Daniel Stone wrote:
> 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);
amended locally, thanks.
Cheers,
Peter
More information about the xorg-devel
mailing list