-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Updating demo with ImGuiWindowFlags_ResizeFromAnySide (was: Adding mouse cursor support in backends) #1495
Conversation
…dded cursor support to several of the platform examples.
Hello @amc522, I think there are a few issues: A) I haven't run your Win32 use case but having tried this approach myself, I'm pretty sure it is causing conflicts with Windows owns handling of cursors. Try to hover around the OS window borders and you'll notice that the resize cursors get overridden by ours. We are normally supposed to answer to the If you have a suggestion on how to tackle this another way I'd be interesting. B) For the 2 missing diagonal cursors see glfw/glfw#427, if you have some time to help the author of GLFW with adding those (depending on what she decided as the discussion was still dangling) I'd gladly appreciated it. C) The code is too long. How about using ImGuiMouseCursor_Count_ sized arrays instead? Don't worry about it too much, I can refactor, solving the problem in A) is the most important part here. |
A) Definitely see the issue and this is a way trickier problem than I thought it would be. I'll play around with some code and see what conclusions (and maybe solutions) I come to. |
Updated imgui_impl_dx11.cpp with some working code that handles WM_SETCURSOR and plays well with ImGui. It's not pretty, but seems to work well to me. Let me know what you think, and if you can find any cases that don't work. |
…ch of defines for this value all beginning with HT.
Hello @amc522, I am putting on hold because I'll be reworking the main bindings structure to support multiple windows, cross-window drag and drop and other advanced features. (See #1542), and some of that is having an effect on mouse cursors. I'll merge isolated bits or integrate equivalent-feature code over the course of the month probably. |
…mGui::GetMouseCursor() value and WM_SETCURSOR message handling). (#1495)
…r() value and WM_SETCURSOR message handling). (#1495)
@amc522 Same feature was implemented today on the 3 DirectX, 3 GLFW based examples and 2 SDL based examples. I took the logic and code from my other branches (less code, a little more tested and following imgui coding style more closely). I am keeping this PR open and renaming it because I would like to add the "ResizeFromAllSide" feature in the demo. However considering going via a route that we have flags to specify what the backend can do, and this feature is automatically enabled if the backend claims it supports mouse cursor. |
This looks great. Your code definitely looks cleaner and more sane than mine. I think enabling resize on all borders and corners by default if the back end says it supports mouse cursors is a great idea. One minor note regarding the corner resize grips. Why is there still a special case for the lower right grip to always be visible, even when there are multiple resize grips (imgui.cpp:5515)? I think it would be nicer if either all the grips were always visible, or, if there's more than one grip, not showing any of the grips until they are interacted with. So the code would be: Grips invisible until interacted with
Grips always visible
Thoughts? |
All grips always visible would be visually too noisy with the look they have. The right direction seem to be that the grip should be invisible before you hover/active it (which you can currently get by locally setting the |
There's no a standard way for back-end to communicate the features they support, What it means is that maybe we can retire the |
I think |
…vor `io.OptResizeWindowsFromEdges=true` to enable the feature globally. (#1495) The feature is not currently enabled by default because it is not satisfying enough.
@amc522 I have pushed a change to remove the
I'm currently not making it the default because the behavior is not satisfying enough (because of how we don't detect it when hovering slightly outside of window rectangle + probably we should have a stateful system where once the resize cursor is offered, we should allow the mouse to wander a little more without losing that possibility). Whenever the behavior is improved we'll make it the default. For now I think we can close this topic! |
Thanks for the update on the change. I dont have a lot of time right now, but maybe in a month or two i can start investigating how to use the mouse slightly outside the window. |
Several of the platform examples have been updated with cursor support. Some have not been updated because I do not have the build dependencies or proper computer to test on.