Skip to content
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

ImGuiConfigFlags_NoMouseCursorChange behaviour ? #119

Closed
DaveInDev opened this issue Apr 28, 2020 · 8 comments
Closed

ImGuiConfigFlags_NoMouseCursorChange behaviour ? #119

DaveInDev opened this issue Apr 28, 2020 · 8 comments

Comments

@DaveInDev
Copy link

DaveInDev commented Apr 28, 2020

hi @eliasdaler,

I am fighting with the mouse cursor in my app...
I choose ConfigWindowsResizeFromEdges = true to resize imgui windows by their borders.

When I don't set ImGuiConfigFlags_NoMouseCursorChange , your SFML backend uses the correct "resize" cursor on the edges of a ImGUI window, but the resize cursor is not shown anymore on the edges of the main window.

And if I set ImGuiConfigFlags_NoMouseCursorChange , it's the opposite : no more cursor change on Imgui borders, but ok on main window borders.

I cannot figure out how to enable both behaviours... Do you have an idea ?

@eliasdaler
Copy link
Contributor

See #111 - unfortunately I didn't have time to look closer into this. It looks like a SFML bug for me and can't be easily fixed using ImGui-SFML's code only

@DaveInDev
Copy link
Author

waooo... I wonder what I can tell to SFML people about it. I don't think they will go into ImGui and Imgui-SFML.... Thanks for your answer anyway.

@DaveInDev
Copy link
Author

DaveInDev commented Apr 28, 2020

I see that the issue was already discussed with a russian guy in #110 . But the discussion was in russian. Can you tell me if you found a solution ?

@eliasdaler
Copy link
Contributor

There is no solution currently. The research is needed how SFML and SDL handle mouse cursors - the behaviour differs and my and the PR creator's previous research wasn't successful.

@DaveInDev
Copy link
Author

DaveInDev commented Apr 28, 2020

So as far I understood, it works ok with SDL backend, but not with SMFL backend. So you think it's not a problem of IMGUI nor Imgui-SFML but a problem of SFML itself ? I don't know how I can explain that to the SFML team...
Anyway, I tried and posted this
https://en.sfml-dev.org/forums/index.php?topic=27180.0
if case you want to add more explanations for the specialists around...

@DaveInDev
Copy link
Author

For those who needs, I just found a workaround. Switching the ImGuiConfigFlags_NoMouseCursorChange flag when ImGui really needs it. Here it is (it's a raw copy of my code, just to understand, but adapt to your own code)

[quote]
static ImGuiIO& ioImgui = ImGui::GetIO();

	static bool imguiHasCursorPrev = true;
	bool imguiHasCursor = ioImgui.WantCaptureMouse || ioImgui.WantCaptureKeyboard;

	if (imguiHasCursor != imguiHasCursorPrev)
	{
		if (imguiHasCursor)
		{
			ioImgui.ConfigFlags &= !ImGuiConfigFlags_NoMouseCursorChange;
		}
		else
		{
			ioImgui.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
			window.setMouseCursor(cursorDefault);
		}
		imguiHasCursorPrev = imguiHasCursor;
	}

[/quote]

note : "window" is my main sfml window.
and cursorDefault.loadFromSystem(sf::Cursor::Arrow);

Thx @eliasdaler for your answers, it helped me.

@Nightmare82
Copy link

Thanks a lot for the workaround @DaveInDev this worked perfectly for me too!

@gitpaul0
Copy link

gitpaul0 commented Mar 6, 2021

Great,

one small correction - to preserve flags it should be:
ioImgui.ConfigFlags &= ~ImGuiConfigFlags_NoMouseCursorChange;
not
ioImgui.ConfigFlags &= !ImGuiConfigFlags_NoMouseCursorChange;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants