imgui icon indicating copy to clipboard operation
imgui copied to clipboard

How to setup hardware mouse cursor ?

Open up-to-you opened this issue 3 months ago • 6 comments

Version/Branch of Dear ImGui:

Version 1.90.4, Branch: master

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Linux

Full config/build information:

No response

Details:

Trying to eliminate mouse movement delay by utilizing hardware mouse cursor. How to setup it in ImGui / SDL ?

Thanks in advance !

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

up-to-you avatar Mar 16 '24 20:03 up-to-you

That’s unrelated to dear imgui and wouldn’t be an API handled by us, but you migbt be asking the question backward. If you mean delay between window and mouse cursor, it is because you have hardware cursor enabled. Reducing latency is up to and your rendering system setup.

It may be advantageous to disable hardware cursor when dragging certain items.

ocornut avatar Mar 17 '24 01:03 ocornut

Yep, already got it, not an issue of imgui. But, if i run simple SDL hello world project, like this one https://lazyfoo.net/tutorials/SDL/01_hello_SDL/index2.php the cursor latency inside SDL window exactly the same as in my OS. And if i run imgui demo with SDL backend the cursor is slightly laggy and overall trying to investigate other GUIs built with Imgui the mouse latency always cause wrist fatigue. It's always require more effort to move mouse cursor somewhere inside Imgui window.

up-to-you avatar Mar 17 '24 03:03 up-to-you

Do you mean it feels laggy when simply moving the mouse (not dragging a window or a tooltip) ? There shouldn’t be a difference in this situation.

ocornut avatar Mar 17 '24 05:03 ocornut

imgui_impl_sdl2 is just using SDL_SetCursor with cursors created via SDL_CreateSystemCursor. We aren't doing anything special in that regard.

But, if i run simple SDL hello world project, like this one https://lazyfoo.net/tutorials/SDL/01_hello_SDL/index2.php the cursor latency inside SDL window exactly the same as in my OS.

Is this still the case for a non-trivial SDL app? (Or a simulated one by adding something like usleep(50 * 1000); to the main loop?)

PathogenDavid avatar Mar 17 '24 06:03 PathogenDavid

@ocornut yep, when simply moving. @PathogenDavid thats what im talking about (about your joke), the rendering and mouse handling is all about main loop, but how can i detach mouse handling from main loop ? How does other GUIs make rendering not affect mouse movement (and you don't feel the difference between movement out of window and inside) and still able to handle mouse events ?

up-to-you avatar Mar 17 '24 12:03 up-to-you

(about your joke)

It wasn't intended as a joke 😅

To clarify: I'm asking if this happens with other SDL apps that aren't using Dear ImGui. The part in parenthesis was meant as a suggestion that you could just modify the example app you linked in order to rule Dear ImGui out.

It would be helpful to know since if it happens in other SDL apps it might be an SDL issue.

how can i detach mouse handling from main loop ?

It's not expected that they're attached in the first place, this should be regarded as a bug with something.

PathogenDavid avatar Mar 17 '24 12:03 PathogenDavid