slop
slop copied to clipboard
Support for high refresh rate monitors
On a high refresh rate monitor (in @iambeingtracked's case 144hz) the selection GUI doesn't act as smooth as it should act with such a refresh rate.
Supersedes https://github.com/naelstrof/maim/issues/278
Likely source of the issue:
https://github.com/naelstrof/slop/blob/864bdb2ce8bd6403e9e38c5c400cb93138952407/src/slop.cpp#L190-L192
The XSync function flushes the output buffer and then waits until all requests have been received and processed by the X server.
I think the fix would be to replace
XFlush(x11->display);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
with a simple
XSync(x11->display, False);
CC @naelstrof
Yeah that seems like it'll work, someone make a pull request and I'll accept it
I'm not sure if XSync the "right" fix here or not. Ideally you'd want to sync with the vblank - using something like XPresent. (But I don't have any first hand experience in doing that, so can't offer anything more atm).
maybe we should even use XNextEvent. slop is not a videogame, it only has to refresh screen when a new input event arrives.
though I don't have any experience, too.