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 Antoine Vaure
parent 0aad70af58
commit 49ac4d1e14

12
x.c
View file

@ -3851,8 +3851,12 @@ run(void)
xev = 0; xev = 0;
while (XPending(xw.dpy)) { while (XPending(xw.dpy)) {
xev = 1;
XNextEvent(xw.dpy, &ev); 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)) if (XFilterEvent(&ev, None))
continue; continue;
if (handler[ev.type]) if (handler[ev.type])
@ -3879,10 +3883,10 @@ run(void)
if (!drawing) { if (!drawing) {
trigger = now; trigger = now;
#if BLINKING_CURSOR_PATCH #if BLINKING_CURSOR_PATCH
if (IS_SET(MODE_BLINK)) { if (xev != SelectionRequest) {
win.mode ^= MODE_BLINK; win.mode &= ~MODE_BLINK;
}
lastblink = now; lastblink = now;
}
#endif // BLINKING_CURSOR_PATCH #endif // BLINKING_CURSOR_PATCH
drawing = 1; drawing = 1;
} }