ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.87k stars 304 forks source link

Inputs not working outside of main viewport in docking branch. #420

Open pyboers opened 1 year ago

pyboers commented 1 year ago

In the docking branch, if the main veldrid window is out of focus, scrolling right click etc does not work in ImGui windows outside of the the viewport.

zaafar commented 1 year ago

I'll look into it, but it's not really a high priority since docking_branch is just a Demo/Proof-of-Concept.

desiwko commented 1 year ago

@pyboers I'm not familiar with Veldrid, however I am working with an event based windowing system that needs a similar controller setup as the Veldrid example. You have to wire up input event routing inside each of the created windows independently of the main window and send them through ImGui's IO event system. Keep in mind that when using viewports ImGui expects the input events to be in raw screen space coordinate, so you might have to do some coordinate conversions.

@zaafar as an aside, why hasn't the docking branch been pulled up yet? I'm pretty sure viewports and docking have been merged into imgui master by now. I don't think there's any reason it shouldn't be in ImGui.NET either in terms of "it's supported, you have to do the legwork to make it work for your use case".

mellinoe commented 1 year ago

@zaafar as an aside, why hasn't the docking branch been pulled up yet? I'm pretty sure viewports and docking have been merged into imgui master by now. I don't think there's any reason it shouldn't be in ImGui.NET either in terms of "it's supported, you have to do the legwork to make it work for your use case".

That's essentially what the status is. The docking branch in this repo just has extra code in the sample application to enable multi-viewports and drive the extra windows, but it's unstable/experimental enough that it has always stayed in its own branch. You should be able to do roughly the same thing from the master branch, or from the NuGet package, although IIRC there's a few extra things that need to be wrapped that exist in the native library that aren't in the master branch.

desiwko commented 1 year ago

You should be able to do roughly the same thing from the master branch, or from the NuGet package, although IIRC there's a few extra things that need to be wrapped that exist in the native library that aren't in the master branch.

That makes sense. You do need the docking branch of ImGui, then obviously the appropriate branch for cimgui in order to support it. So this isn't an ImGui.NET issue, it's an upstream issue really. Gotcha.

zaafar commented 1 year ago

You do need the docking branch of ImGui, then obviously the appropriate branch for cimgui in order to support it.

yes imgui.net master branch is doing exactly that. Actually to be 100% clear the demo code in imgui.net repo master branch can do docking feature with 0 code change ( you just have to enable the docking flag ).

It's the (add,remove,get,update) viewport part which you folks are really talking about.

kateusz commented 5 months ago

Keep in mind that when using viewports ImGui expects the input events to be in raw screen space coordinate, so you might have to do some coordinate conversions.

could you show example?