Explicitly cast X sequence number

Fix an undefined behavior.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-17 00:45:13 +00:00
parent a6b63cd035
commit eabe2b5bb8
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 3 additions and 1 deletions

View File

@ -1936,7 +1936,9 @@ ev_handle(session_t *ps, xcb_generic_event_t *ev) {
// proc might also just be Xlib internal event processing functions, and
// because they probably won't see all X replies, they will complain about
// missing sequence numbers.
ev->sequence = LastKnownRequestProcessed(ps->dpy);
//
// We only need the low 16 bits
ev->sequence = (uint16_t)(LastKnownRequestProcessed(ps->dpy) & 0xffff);
proc(ps->dpy, &dummy, (xEvent *)ev);
}