Skip to content

Commit

Permalink
event: restore event sequence number after passing it to Xlib handlers
Browse files Browse the repository at this point in the history
We set event sequence number to the last sequence xlib knows about to
silence its complaint about missing sequence numbers, but we forgot to
restore it back afterwards.

This used to break error ignoring mechanism in `should_ignore`. In the
last commit we updated it to use full_sequence which incidently fixed
this problem. But let's restore the sequence number anyway for good
measure.

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Dec 14, 2022
1 parent 8b189bc commit 5a5ea76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ static inline const char *ev_name(session_t *ps, xcb_generic_event_t *ev) {
CASESTRRET(ClientMessage);
}

if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type)
if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type) {
return "Damage";
}

if (ps->shape_exists && ev->response_type == ps->shape_event)
if (ps->shape_exists && ev->response_type == ps->shape_event) {
return "ShapeNotify";
}

if (ps->xsync_exists) {
int o = ev->response_type - ps->xsync_event;
Expand Down Expand Up @@ -695,8 +697,11 @@ void ev_handle(session_t *ps, xcb_generic_event_t *ev) {
// missing sequence numbers.
//
// We only need the low 16 bits
uint16_t seq = ev->sequence;
ev->sequence = (uint16_t)(LastKnownRequestProcessed(ps->dpy) & 0xffff);
proc(ps->dpy, &dummy, (xEvent *)ev);
// Restore the sequence number
ev->sequence = seq;
}

// XXX redraw needs to be more fine grained
Expand Down

1 comment on commit 5a5ea76

@yshui
Copy link
Owner Author

@yshui yshui commented on 5a5ea76 Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize this has been broken for so long...

Please sign in to comment.