-
-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SDL2 option to disable mouse capture. #6410
base: master
Are you sure you want to change the base?
Conversation
(git tip: FYI when you make change to a PR you can amend/rework then force-push to existing branch. This way you keep same PR # and we can still access its history, no need to create a new PR) |
Is there a chance that this PR is merged? |
My last answer on the other thread stands: “It's hard to trust a PR if you don't put the effort of understanding why we normally need the capture on other systems, in order to decide what is actually the best design/solution for e.g. Wayland.” And your reply was to suggest you didn’t understand why that capture was needed for. I can’t trust any solution or workaround if you don’t understand the problem (of not capturing) first. |
Since imho it is particularly undesirable to disable mouse capture, at minimum you should understand why and the feature should contains ample comments to explain it to the user, as well as explanining the situation where it may be useful, and explaining why it shouldn’t be used in other situations, and explaining the debugger side solutions etc. |
I am afraid only someone with a full understanding of X11, Wayland, gdb, SDL and ImGui can provide an answer which ticks all your criteria. I am definitely not that developer. I can only bring my frustration when the mouse clicks are not passed to the debugger UI and a similar solution provided by Qt: https://doc.qt.io/qt-6/debug.html#command-line-options-recognized-by-qt This is all I can provide, but I understand it might not be enough. |
I will work on something based on what has been written in both threads. Could you test the GLFW examples and confirm if the same issue is observed on your setup, and should be lifted? if so I think i may move this to a backend agnostic configuration flag. edit: out of clarity you don’t need full understanding of those technologies above to understand what mouse capture does. Since you can mouse capture working on the system you can see the effect it would have on eg: click on a imgui item and move cursor outside of your platform window while holding the click: do you get updated mouse positions while doing so, with and without mouse capture ? |
I have tried 2 examples: example_glfw_opengl3 and example_sdl2_opengl3. I put a break point https://github.com/ocornut/imgui/blob/3733b5064e1820dc8517fedba2b34bfbdef569ab/imgui_demo.cpp#L1662C28-L1662C28 With glfw I can use the mouse in VSCode, but with SDL2 I cannot. I used to be able to avoid the issue with a gdb hook: This has stopped working, more or less at the same time as I moved to the default Ubuntu Wayland desktop. About capturing the mouse: my UI is not affected by it, but I probably make a very primitive usage of the available features. I only click, there is not dragging or movement tracking while clicking |
It can cause issues when debugging the application, as the mouse events are not passed to the IDE. ocornut#3650 Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
The last paragraph of this: https://wiki.libsdl.org/SDL2/SDL_CaptureMouse#remarks seems to talk about a similar use case, but I am not able to test nor confirm what it actually does. |
It can cause issues when debugging the application, as the mouse events are not passed to the IDE.
#3650