Prevent SelectionRequests from interfering with blinking cursor (#173)

Some old clipboard managers, such as greenclip and parcellite,
constantly poll applications with SelectionRequest events, which breaks
the internal timer and blinking cursor. This fix prevents these events
from causing any disruption.

Fixes #172
This commit is contained in:
veltza 2025-04-22 10:53:53 +03:00 committed by GitHub
parent da81ae1704
commit cb91e175ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

12
x.c
View file

@ -3804,8 +3804,12 @@ run(void)
xev = 0;
while (XPending(xw.dpy)) {
xev = 1;
XNextEvent(xw.dpy, &ev);
#if BLINKING_CURSOR_PATCH
xev = (!xev || xev == SelectionRequest) ? ev.type : xev;
#else
xev = 1;
#endif // BLINKING_CURSOR_PATCH
if (XFilterEvent(&ev, None))
continue;
if (handler[ev.type])
@ -3832,10 +3836,10 @@ run(void)
if (!drawing) {
trigger = now;
#if BLINKING_CURSOR_PATCH
if (IS_SET(MODE_BLINK)) {
win.mode ^= MODE_BLINK;
if (xev != SelectionRequest) {
win.mode &= ~MODE_BLINK;
lastblink = now;
}
lastblink = now;
#endif // BLINKING_CURSOR_PATCH
drawing = 1;
}