imgui-rs
imgui-rs copied to clipboard
Cursor blinked on window borders
Running examples on win10 64. Thanks.
I think I might understand what @coolit was trying to say.
Let's say you hover your mouse over the top border of a window. Windows will set the cursor to ResizeNS:

Every frame, you are supposed to call WinitPlatform::prepare_render. That function sets the cursor again, back to Arrow. End result is, the cursor will flicker to ResizeNS but immediately go back to Arrow. This makes it look like imgui is "fighting" with Windows about what the cursor should be.
I can repro this in the gfx hello_world example:
cd imgui-gfx-examples
cargo run --example hello_world
My proposed fix: inside prepare_render, only set the cursor if the mouse position is inside the client area of the window. (as opposed to the non-client area, which is the title bar and window borders)
Reproduces for us too. Going to try the fix suggested above in our vendored version of imgui-winit-support (don't ask 🙈).
If it pans out well, I am happy to send a PR with the change to imgui-rs as well. @Gekkio ?
Don't call prepare_render unless the mouse cursor has changed.
https://github.com/Yatekii/imgui-wgpu-rs/blob/85fe1e4e66d057b174ab3023b79a91c8f50f28f2/examples/hello_world.rs#L203-L206
Don't call prepare_render unless the mouse cursor has changed.
If that's the case, perhaps the docs should be updated with info when is it valid to call prepare_render? Currently they say "every frame".