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

Modal dialog, why is it with ImGuiWindowFlags_NoSavedSettings ? #3091

Closed
aiekick opened this issue Apr 1, 2020 · 4 comments
Closed

Modal dialog, why is it with ImGuiWindowFlags_NoSavedSettings ? #3091

aiekick opened this issue Apr 1, 2020 · 4 comments
Labels
popups settings .ini persistance

Comments

@aiekick
Copy link
Contributor

aiekick commented Apr 1, 2020

Hello,

Version: 1.76
Branch: docking

i would like to know what is the reason where modal dialog are declared with flag ImGuiWindowFlags_NoSavedSettings.

i have a file diallog im using with modal dialog, and at start its always in defualt size who is small and i need to resize it.
but if i reactivate by disabling ImGuiWindowFlags_NoSavedSettings in ImGui::BeginPopupModal
i can have the filedialog with custom size after loading.

its annoying to do that at each app start.

can we remove ImGuiWindowFlags_NoSavedSettings at line 8456 of imgui.cpp in function ImGui::BeginPopupModal, ?

@ocornut
Copy link
Owner

ocornut commented Apr 1, 2020 via email

@aiekick
Copy link
Contributor Author

aiekick commented Apr 1, 2020

cool, thanks

@ocornut ocornut added popups settings .ini persistance labels Apr 1, 2020
@ocornut
Copy link
Owner

ocornut commented Apr 1, 2020

FYI I was tracking the source for it been there since the initial commit:
bce495c

(Perhaps modal windows probably should not need to follow the popup api, it's just getting in the way for many reasons.)

ocornut added a commit that referenced this issue Jun 23, 2020
…ag anymore, and will not always be auto-centered. (#915, #3091)
ocornut added a commit that referenced this issue Jun 23, 2020
…ag anymore, and will not always be auto-centered. (#915, #3091)

# Conflicts:
#	imgui.cpp
@ocornut
Copy link
Owner

ocornut commented Jun 23, 2020

Implemented that change now.

Some very tangential thoughts (copying same message in #3091)

(
Generally speaking, modals tends to be closer to regular windows than they are to popups, and I imagine a revamp where we could fully use Begin() with ImGuiWindowFlags_Modal (as suggested by #402) and keep control of visibility. The BeginPopupModal() api could still work.

Centering a modal window is surprisingly unobvious in a multi-viewport context, there are just many desirable scenarios. Considering an hypothetical GetFocusedViewport() returning ~~g.NavWindow->Viewport

SetNextWindowPos(GetFocusedViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));

Won't work as expected due to how ImGuiCond_Appearing is set and because the focused/nav window tends to evolve across appearing frames. We probably need variety of access to monitors and viewports tagged with semantic (e.g. access to "focused (last interacted with?) monitor", access to "viewport from where popup was activated", access to "monitor mouse is in") and let the user choose. And I guess we may need to create more continuity between viewports and monitors down the line. Finishing work on the "there are no main viewport" task will probably help enforce this.

Currently the code and demo code uses io.DisplaySize * 0.5f in master branch and selectively CurrentWindow->Viewport's center or GetMainViewport()'s center in docking branch, which are ALL arbitrary, we ought to design standards and have them integrated in master asap.
)

@ocornut ocornut closed this as completed Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
popups settings .ini persistance
Projects
None yet
Development

No branches or pull requests

2 participants