[PATCH libXi] Don't use raw serial numbers in XIEvents

Jasper St. Pierre jstpierre at mecheye.net
Mon Oct 19 16:28:12 PDT 2015


On Sun, Oct 18, 2015 at 7:59 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> cookie->serial is an Xlib contoction, provided by _XSetLastRequestRead(). This

I assume this is meant to read "in->sequenceNumber is an Xlib
concoction"? Otherwise, it doesn't make sense.

> serial may be different to the raw serial number from the wire protocol.
> This causes issues when the raw serial is used to e.g. compare the event to
> other non-XI events.
>
> Use the cookie's serial number instead.
>
> https://bugzilla.gnome.org/show_bug.cgi?id=756649
>
> See also https://bugs.freedesktop.org/show_bug.cgi?id=64687
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/XExtInt.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/XExtInt.c b/src/XExtInt.c
> index 672d69a..a35fcc6 100644
> --- a/src/XExtInt.c
> +++ b/src/XExtInt.c
> @@ -1521,7 +1521,7 @@ wireToDeviceEvent(xXIDeviceEvent *in, XGenericEventCookie* cookie)
>      out = next_block(&ptr_lib, sizeof(XIDeviceEvent));
>      out->display = cookie->display;
>      out->type = in->type;
> -    out->serial = in->sequenceNumber;
> +    out->serial = cookie->serial;
>      out->extension = in->extension;
>      out->evtype = in->evtype;
>      out->send_event = ((in->type & 0x80) != 0);
> @@ -1794,7 +1794,7 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
>      cookie->data = out = malloc(sizeof(XIDeviceChangedEvent) + len);
>
>      out->type = in->type;
> -    out->serial = in->sequenceNumber;
> +    out->serial = cookie->serial;
>      out->display = cookie->display;
>      out->extension = in->extension;
>      out->evtype = in->evtype;
> @@ -1827,7 +1827,7 @@ wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie)
>      out->info           = (XIHierarchyInfo*)&out[1];
>      out->display        = cookie->display;
>      out->type           = in->type;
> -    out->serial         = in->sequenceNumber;
> +    out->serial         = cookie->serial;
>      out->extension      = in->extension;
>      out->evtype         = in->evtype;
>      out->send_event = ((in->type & 0x80) != 0);
> @@ -1868,7 +1868,7 @@ wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cook
>
>      out = next_block(&ptr, sizeof(XIRawEvent));
>      out->type           = in->type;
> -    out->serial         = in->sequenceNumber;
> +    out->serial         = cookie->serial;
>      out->display        = cookie->display;
>      out->extension      = in->extension;
>      out->evtype         = in->evtype;
> @@ -1919,7 +1919,7 @@ wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie)
>      out->buttons.mask = (unsigned char*)&out[1];
>
>      out->type           = in->type;
> -    out->serial         = in->sequenceNumber;
> +    out->serial         = cookie->serial;
>      out->display        = cookie->display;
>      out->extension      = in->extension;
>      out->evtype         = in->evtype;
> @@ -1962,7 +1962,7 @@ wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie)
>      cookie->data = out;
>
>      out->type           = in->type;
> -    out->serial         = in->sequenceNumber;
> +    out->serial         = cookie->serial;
>      out->extension      = in->extension;
>      out->evtype         = in->evtype;
>      out->send_event = ((in->type & 0x80) != 0);
> @@ -1983,7 +1983,7 @@ wireToTouchOwnershipEvent(xXITouchOwnershipEvent *in,
>      cookie->data = out;
>
>      out->type           = in->type;
> -    out->serial         = in->sequenceNumber;
> +    out->serial         = cookie->serial;
>      out->display        = cookie->display;
>      out->extension      = in->extension;
>      out->evtype         = in->evtype;
> @@ -2011,7 +2011,7 @@ wireToBarrierEvent(xXIBarrierEvent *in, XGenericEventCookie *cookie)
>
>      out->display    = cookie->display;
>      out->type       = in->type;
> -    out->serial     = in->sequenceNumber;
> +    out->serial     = cookie->serial;
>      out->extension  = in->extension;
>      out->evtype     = in->evtype;
>      out->send_event = ((in->type & 0x80) != 0);
> --
> 2.4.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



-- 
  Jasper


More information about the xorg-devel mailing list