Conversation
This is a signature breaking change
|
This looks great, thanks for contributing this :) I'll focus on getting the invalid slice fix through first, and then jump back to reviewing this. |
|
I haven't forgotten about this one - I'll move onto this next, and I will probably spend a bit more time with it and its likely that it will be part of a more major |
|
Thanks for your contribution @CrushedPixel, overall I think this looks great. I've left a few pieces of minor feedback. I'd be happy to merge this once addressed... |
|
|
||
| // enable docking by default if the feature is enabled | ||
| if cfg!(feature = "docking") { | ||
| config_flags |= ConfigFlags::DOCKING_ENABLE; |
There was a problem hiding this comment.
This fails to build when the docking feature is not enabled, since ConfigFlags::DOCKING_ENABLE doesn't exist
| F: FnOnce(&mut imgui::Io) -> R, | ||
| { | ||
| unsafe { | ||
| let mut ctx = self.ctx.write().unwrap(); |
There was a problem hiding this comment.
Prefer expect over unwrap, so that we can provide a decent error message here (e.g. "Failed to acquire write access to ImGui context"...)
| where | ||
| F: FnOnce(&mut imgui::Io) -> R, | ||
| { | ||
| unsafe { |
There was a problem hiding this comment.
This unsafe block is unnecessary...
|
Thanks, I'll look to address these shortly :) |
|
Superseded by #68 |
|
Fix published in crate |
This addresses #1.
Overview
These are three commits:
Added a feature
dockingthat enablesimgui/dockingfeature.Added
ImguiContext::with_io_mutto allow users to mutate Imgui's I/O struct. Without being able to modify the I/O struct, there is no way for a user to enable or configure docking.Add a field
config_flagstoImguiPluginthat defaults to enabling docking when thedockingfeature is enabled. This makes it possible to configure Imgui via config flags without having to usewith_io_mut.The third commit is technically a breaking change, as it changes
ImguiPlugin's struct layout, so existing code will need to be updated. Therefore, I understand if you don't want to merge this third commit - the first 2 are sufficient to properly use Imgui with docking. Just let me know if I should remove it from this branch.Demo
With the docking feature enabled, I added a
Startupsystem that runs:And now my windows are dockable, without any additional Imgui API calls:

Please let me know your thoughts!