- Notifications
You must be signed in to change notification settings - Fork 55
Description
Currently we have the following going on in the destroy part of selection-edge:
Lines 142 to 147 in 1a9964a
/* HACK: although we recived a DestroyNotify event, the frame still | |
* might not have been updated. a compositor might also buffer frames | |
* adding latency. so wait a bit for the screen to update and the | |
* selection borders to go away. */ | |
struct timespec t = { .tv_nsec = 80 * 1000L * 1000L }; | |
while (nanosleep(&t, &t) < 0 && errno == EINTR); |
Instead of sleeping, we might want to detect whether the screen got repainted or not more reliably. This way, users who have a fast/low-latency system won't have to unnecessarily pay for the ~80ms sleep.
The XDamage extension might work. But my previous experience with it wasn't very fruitful.
And if we cannot detect it more reliably, then we might want to listen for vblank rather than sleeping a fixed amount. Listening for about 4~5
vblanks should be okay, on 60hz monitors that'll be around 80ms, on faster 240hz it'll be about ~21ms. (Unfortunately, I don't know any simple way to listen for vblanks on X without depending on opengl/GLX).