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

Un docked modal popup window text input via enter causes all inputs in all windows to be click == return. #3837

Closed
Cazadorro opened this issue Feb 24, 2021 · 8 comments

Comments

@Cazadorro
Copy link

Cazadorro commented Feb 24, 2021

System Info

Dear ImGui 1.82 WIP (18101)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201703
define: __linux__
define: __GNUC__=8
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000440
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

I'm using OpenGL 4.5 on Centos 7

My Issue/Question:

When undocking a modal window, using input text with the flag ImGuiInputTextFlags_EnterReturnsTrue appears to set every input to "click = return" even on re-creating the modal popup window (so this appears to effect every window). This behavior does not present itself if one instead uses a button to initiate a window close. This behaviors does not present itself when the window is docked in the main window.

Screenshots/Video

Vg8M9KL.-.Imgur.mp4

shows even the other window has click = return after the initial enter

TestSave2-2021-02-24_16.04.39.mp4

Standalone, minimal, complete and verifiable example: (see #2261)

This should be able to reproduce the issue, hypothetically only stuff within draw_ui is relevant, but only depends on ImGUI, glad, glfw3 and a c++17 compatible compiler:

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include <imgui_internal.h>
#include <misc/cpp/imgui_stdlib.h>


#include <iostream>
#include <optional>
#include <filesystem>

class TestContext{
public:
    void draw_ui(bool* p_open);
private:
    std::filesystem::path m_file_path;
    void MenuBar();
};

void sub_ui(){
    static double range_min;
    static double range_max;
    static double k;
    static int size;
    ImGui::Text("DetectorInfo:"
                "\n\t          range_a: [min %f, max %f]"
                "\n\t            k: [%f]"
                "\n\t       size: [width %i x height %i]"
            ,
                range_min,
                range_max,
                k,
                size,
                size
    );
    float min = range_min;
    float max = range_max;
    if(ImGui::DragFloatRange2("range",
                               &min,
                               &max,
                               1.0f, 0.0f, 0.0f,
                               "Min: %.1fpx", "Max: %.1fpx",
                               ImGuiSliderFlags_AlwaysClamp)){
        range_min = min;
        range_max = max;
    }

    if (ImGui::InputDouble("k", &k)) {
        k = std::max(k, 0.0);
    }
}

void TestContext::draw_ui(bool *p_open) {
    ImGuiWindowFlags window_flags =
            ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
    if (true) {
        ImGuiViewport *viewport = ImGui::GetMainViewport();
        ImGui::SetNextWindowPos(viewport->Pos);
        ImGui::SetNextWindowSize(viewport->Size);
        ImGui::SetNextWindowViewport(viewport->ID);
        ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
        ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
        window_flags |=
                ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
                ImGuiWindowFlags_NoMove;
        window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus |
                        ImGuiWindowFlags_NoNavFocus;
    }
    ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
    auto ret_val = ImGui::Begin("Test Window", p_open, window_flags);
    ImGui::PopStyleVar();
    if(ret_val){
        MenuBar();
        sub_ui();
        ImGui::PopStyleVar(2);
        ImGui::End();
    }
}

void TestContext::MenuBar() {

    static bool open_popup = false;
    if (ImGui::BeginMainMenuBar()) {

        static bool dark_mode = true;
        if (ImGui::BeginMenu("Menu")) {
            if (ImGui::MenuItem("Open Popup")) {
                open_popup = true;
            }
            ImGui::EndMenu();
        }

        ImGui::EndMainMenuBar();
    }
    if (open_popup) {
        ImGui::OpenPopup("TEST Selection");
    }

    if (ImGui::BeginPopupModal("TEST Selection")) {

        if (ImGui::Button("Cancel")) {
            ImGui::CloseCurrentPopup();
            open_popup = false;
            m_file_path = "test";
        }
        static std::string text;
        ImGui::Text("file");
        ImGui::SameLine();
        ImGui::PushItemWidth(-175);
        if (ImGui::InputText("##file_123", &text,
                             ImGuiInputTextFlags_EnterReturnsTrue)) {
            ImGui::CloseCurrentPopup();
            open_popup = false;
            m_file_path = text;
        }
        ImGui::SameLine();
        if (ImGui::Button("Other")) {
            ImGui::CloseCurrentPopup();
            open_popup = false;
            m_file_path = "test";
        }

        ImGui::EndPopup();
    }
}



const char *glsl_version = "#version 450";

void setup_gl() {
    if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) {
        throw std::runtime_error("Failed to initialize GLAD");
    }
    glFrontFace(GL_CCW);
//    glEnable(GL_CULL_FACE);     // Cull back facing polygons
    glCullFace(GL_BACK);
}

void application() {
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);

    GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", NULL, NULL);
    if (window == NULL) {
        return;
    }
    glfwMakeContextCurrent(window);
    glfwSwapInterval(1);
    setup_gl();

    // Setup Dear ImGui context
    IMGUI_CHECKVERSION();
    ImGui::CreateContext();
    ImGuiIO &io = ImGui::GetIO();
    (void) io;
    //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls
    //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;      // Enable Gamepad Controls
#ifdef IMGUI_DEBUG_LOG_DOCKING
    io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;           // Enable Docking
    io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
#endif
    // Setup Dear ImGui style
    ImGui::StyleColorsDark();
    //ImGui::StyleColorsClassic();

    // Setup Platform/Renderer backends
    ImGui_ImplGlfw_InitForOpenGL(window, true);
    ImGui_ImplOpenGL3_Init(glsl_version);

    // Our state
    ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);

    bool open = true;
    TestContext test_context;

    while (!glfwWindowShouldClose(window)) {

        glfwPollEvents();

        // Start the Dear ImGui frame
        ImGui_ImplOpenGL3_NewFrame();
        ImGui_ImplGlfw_NewFrame();
        ImGui::NewFrame();
        ImGui::ShowDemoWindow();
        test_context.draw_ui(&open);

        // Rendering
        ImGui::Render();
        int display_w, display_h;
        glfwGetFramebufferSize(window, &display_w, &display_h);
        glViewport(0, 0, display_w, display_h);
        glClearColor(clear_color.x, clear_color.y, clear_color.z,
                     clear_color.w);
        glClear(GL_COLOR_BUFFER_BIT);
        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

        if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
            GLFWwindow *backup_current_context = glfwGetCurrentContext();
            ImGui::UpdatePlatformWindows();
            ImGui::RenderPlatformWindowsDefault();
            glfwMakeContextCurrent(backup_current_context);
        }
        glfwSwapBuffers(window);
    }

    // Cleanup
    ImGui_ImplOpenGL3_Shutdown();
    ImGui_ImplGlfw_Shutdown();
    ImGui::DestroyContext();
    glfwDestroyWindow(window);
}


int main() {
    glfwSetErrorCallback([](int error_code, const char *description) {
        std::cout << "GLFW Error " << error_code << ": "
                  << description << "\n";
    });

    int inited = glfwInit();
    if (!inited) {
        std::cout << "Couldn't init glfw" << std::endl;
        return 1;
    }
    application();
    glfwTerminate();
    return 0;
}
@rokups
Copy link
Contributor

rokups commented Mar 1, 2021

I am unable to reproduce the issue. Could you trim your sample code down so it is actually minimal? Something we could paste into existing sample and get going, something that does not depend on details from graphics APIs. Also please try SDL backend.

@Cazadorro
Copy link
Author

Cazadorro commented Mar 1, 2021

@rokups I'm confused by what you mean by "details from graphics APIs" These "details" are ripped straight from the examples of the repo, are you saying those are some how not minimal? The only "graphics API details" are those found in here:

https://github.com/ocornut/imgui/blob/master/examples/example_glfw_opengl3/main.cpp

and in fact, I trimmed those down even more to make it easier to run, I only included that for complete-ness sake. And to a non contributor, Dear ImGUI is a black box so to speak, there's no reason for me not to believe that the particular backend I chose is not relevant to this behavior. Even then, I mentioned in my post

"hypothetically only stuff within draw_ui is relevant".

This is apparently 114 lines of code, I could reduce it, but you're not gaining much:

class TestContext{
public:
    void draw_ui(bool* p_open);
private:
    std::filesystem::path m_file_path;
    void MenuBar();
};

void sub_ui(){
    static double k;
    if (ImGui::InputDouble("k", &k)) {
        k = std::max(k, 0.0);
    }
}

void TestContext::draw_ui(bool *p_open) {
    ImGuiWindowFlags window_flags =
            ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
    if (true) {
        ImGuiViewport *viewport = ImGui::GetMainViewport();
        ImGui::SetNextWindowPos(viewport->Pos);
        ImGui::SetNextWindowSize(viewport->Size);
        ImGui::SetNextWindowViewport(viewport->ID);
        ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
        ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
        window_flags |=
                ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
                ImGuiWindowFlags_NoMove;
        window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus |
                        ImGuiWindowFlags_NoNavFocus;
    }
    ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
    auto ret_val = ImGui::Begin("Test Window", p_open, window_flags);
    ImGui::PopStyleVar();
    if(ret_val){
        MenuBar();
        sub_ui();
        ImGui::PopStyleVar(2);
        ImGui::End();
    }
}

void TestContext::MenuBar() {

    static bool open_popup = false;
    if (ImGui::BeginMainMenuBar()) {

        static bool dark_mode = true;
        if (ImGui::BeginMenu("Menu")) {
            if (ImGui::MenuItem("Open Popup")) {
                open_popup = true;
            }
            ImGui::EndMenu();
        }

        ImGui::EndMainMenuBar();
    }
    if (open_popup) {
        ImGui::OpenPopup("TEST Selection");
    }

    if (ImGui::BeginPopupModal("TEST Selection")) {
        static std::string text;
        ImGui::Text("file");
        ImGui::SameLine();
        ImGui::PushItemWidth(-175);
        if (ImGui::InputText("##file_123", &text,
                             ImGuiInputTextFlags_EnterReturnsTrue)) {
            ImGui::CloseCurrentPopup();
            open_popup = false;
            m_file_path = text;
        }
        ImGui::EndPopup();
    }
}

and you loose the ability to verify visually and test buttons, hence why those were included.

That being said, I'm not sure how people are supposed to run this with out the appropriate backend, removing said code would stop people from running the example as is. That's also not a minimal complete example.

Also are you asking me to see if this is still an issue with SDL or are you asking me to switch to SDL? if it is the latter, no that's not an acceptable option, if it is the former, I may not be able to do that with my environment, but I'll try.

@rokups
Copy link
Contributor

rokups commented Mar 2, 2021

@rokups I'm confused by what you mean by "details from graphics APIs"

Sorry, i used a wrong word. I really meant. Backend APIs. It is very likely anything related to glfw/opengl is just unrelated noise that makes it harder to reproduce an issue.

Also are you asking me to see if this is still an issue with SDL or are you asking me to switch to SDL?

I was merely asking to try SDL backend. I would myself, but i am unable to reproduce the issue.

Sample code is still rather big. I assume it should be enough to have couple inputs, a popup and maybe a button to reproduce the issue? Also a textual list of steps to follow to reproduce the issue would be very useful. I tried my best to follow these two videos, but i was unable to reproduce this behavior.

Hopefully a combination of tiny code sample and a list of steps would help us reproduce the issue, which then will lead to a fix.

@ocornut
Copy link
Owner

ocornut commented Mar 2, 2021

Thanks for your effort trimming the code!
Some thoughts:

(1)
One way to clarify if this is back-end related (e.g. a stuck Return key) would be to open the Metrics/Debugger window and inspect some of the data there. Also the Demo -> Inputs sections shows all pressed keys and mouse buttons. If you leave that open in your app that could be helpful.

there's no reason for me not to believe that the particular backend I chose is not relevant to this behavior

You are right, but interestingly making the repro as thin as possible (removing the backend dependency and turning it into a pastable-in-any-imgui-app contained chunk of code) can actually be able to prove or disprove that it is or isn't backend related, and help narrow down the cause of the issue. But checking demo/metrics as mentioned above is an easier first step.

That statement:

This behaviors does not present itself when the window is docked in the main window.
Seems like clue that it could be a stuck key? e.g. the Return Key Up event not received. What happens if you press Return again after?
(Note that issue doesn't appear related to docking at all, but rather to multi-viewports.)

(2)
Note that your report "click == return" statement uses terminology that is biased toward one specific assumption. While I don't know what the issue is, it might be e.g. that something keeps stealing the ActiveID away from the InputText and it's not key related.

(3)
A cursory glance at your code (which I haven't ran but only looked at) suggests that you keep reopening the popup: every frame:

    static bool open_popup = false;
[...]
            if (ImGui::MenuItem("Open Popup")) {
                open_popup = true;
[...]
    if (open_popup) {
        ImGui::OpenPopup("TEST Selection");

In the code likely as presented, I do not think this is related to your issue but still misleading/incorrect, you only want to open the popup once, so removing that static would help. In your own code a slightly different arrangement of code could accidentally trigger a reopening of the popup at the wrong time, stealing focus away from the input text.

@ocornut ocornut removed the docking label Mar 2, 2021
@Cazadorro
Copy link
Author

Cazadorro commented Mar 3, 2021

@ocornut I did what you said, and indeed, this image shows it does appear to be some sort of event related issue instead of a flag set, here is the video:

TestSaveNext1-2021-03-03_11.15.05.mp4

For some reason, it looks like my key is infinitely being activated (which is not actually the case, my physical keyboard is fine, I can use it outside the context of imgui while it is doing this and nothing is broken, additionally other applications work fine). When I press enter on the field, it fixes the behavior, but I can revert it just as quickly by following the same steps again. I updated GLFW just incase, and it still appears to be an issue.

Again, I demonstrate in the video that if the popup is docked, there is no issue, this held down key issue doesn't happen.

steps to reproduce:

  • run example
  • click Menu
  • click Open popup
  • hit enter in field
  • attempt to select any field on main gui (it will act as if enter is held down, it isn't)

A cursory glance at your code (which I haven't ran but only looked at) suggests that you keep reopening the popup: every frame:

I only did that because apparently opening popups directly is apparently broken inside menus, and this was the solution of the an issuer somewhere here. It doesn't make logical sense but neither does modal popups not working inside of menus, so at that point the reasoning for why things like that are done goes out the window, the issue is a black box to me, and so is the specific incantation of the solution. As far as I know there is no demo example of menu modal popups.

Do you want me to change the OP code example with this change?

@Cazadorro
Copy link
Author

@ocornut @rokups This behavior is specific to GLFW, see here, I do not encounter this in SDL

TestSaveNext2-2021-03-03_12.00.07.mp4

rokups added a commit to rokups/imgui that referenced this issue Mar 8, 2021
@rokups
Copy link
Contributor

rokups commented Mar 8, 2021

You are right. This issue manifests because pressing enter key triggers a destruction of popup window and it's viewport at the end of current frame. This is problematic because by the time we poll events at the start of next frame - window is already gone and it can not receive key-release event. Fixing issue at it's core may not be trivial, but you may use patch linked above ☝🏻 as a temporary workaround.

@ocornut
Copy link
Owner

ocornut commented Mar 26, 2021

I have now merged the fixproposed by @rokups, I believe it is the best solution.

Was tempted to propose to GLFW that they send those events before window destruction, but it may leads unprepared applications to crash.... So in fact I think that "workaround" is really the best fix.

@ocornut ocornut closed this as completed Mar 26, 2021
DnA-IntRicate added a commit to DnA-IntRicate/imgui that referenced this issue Oct 7, 2022
* Docking: added comments. added experimental TabItemFlagsOverrideSet to ImGuiWindowClass.

(Could probably do something similar with TabBarFlagsOverrideSet+Clear for ocornut#2700 later.)

* Docking: docked window honor tab and text colors by storing them. (ocornut#2771)

Later to lead into ocornut#2700 and ocornut#2539
Move tab submission block above in DockNodeUpdateTabBar(), not strictly necessary for this change as is, but useful if needing to apply override for TitleBg* as we'd need a value for node->VisibleWindow earlier than currently set.

* Fixed some compile warnings with Clang on Windows (ocornut#3754)

* Viewports, Backends: Vulkan: handle VK_ERROR_OUT_OF_DATE_KHR when resizing secondary viewport (ocornut#3766, ocornut#3758)

Cannot repro here but appears to a user on Linux. Fix may be not super solid.

* Docking: on node split, update memorized DockId for currently closed windows (ocornut#3716)

Amended by @ocornut with same fix in DockBuilderRemoveNodeChildNodes().

* Docking: fix gap in hit test hold when using ImGuiDockNodeFlags_PassthruCentralNode touching the edge of a viewport. (ocornut#3733)

* Viewports: (breaking) removed ImGuiPlatformIO::MainViewport which is now pretty much unused and duplicate (and misleading as we will evolve the concept)

Use GetMainViewport() if stuck.

* Viewports: Moved in own section of imgui.h ahead of merging a small part of viewport interface to master.

* Viewports: trying to treat GetMainViewport() as const. Reducing unnecessary casts of ImGuiViewportP*

Metrics: readded root Drawlists node in metrics to match master.
The (void*) casts are implying const-casst but currently left GetMainViewport() as returning non-const.

* Viewports: (Breaking) turned GetWorkPos(), GetWorkSize() into straight fields -> WorkPos, WorkSize before exposing in master branch.

* Fix for compiling imgui_internal.h without operators + made GetWorkRect() consistent with clamped WorkSize.

* Misc tweaks - mostly toward minimizing diff in upcoming backport merge of a few viewport structures in master

* Viewports: Fix issue inferring viewport z-order when new popups gets created. (ocornut#3734) + Metrics updates.

Revert 6bc5266
Showing inferred order and missing flags in metrics.

* Viewports: Setting the new (currently dummy) flags on viewports. (ocornut#3789, ocornut#1542, ocornut#3680, ocornut#3350, ocornut#3012, ocornut#2471)

Amend the merging of f14042c (merge ee59d7a)

* Remove redundant GetMainViewport decl in imgui.h (ocornut#3801, ocornut#3800)

* Docking: Made close button enable logic consistent on dockspace. When no docked window have a close button or it is disabled on the node, the space is given to tabs.

Clarified close_button_is_visible vs close_button_is_enabled behavior in DockNodeUpdateTabBar().. (ocornut#3633, ocornut#3521)
Reduced alpha of disabled close button a little bit further.
Removed 'EnableCloseButton' which was actually unused (can't be infered early, need ->VisibleWindow anyway, which is not == ->ActiveWindow)

* Examples: DX9-DX11: Removed half-assed DPI awareness enable. Updated Docking/Viewports part of Changelog (e.g. removed bits that are now already in master, clarified some added bits)

* Viewports: Fix setting of ImGuiViewportFlags_NoRendererClear. (ocornut#3213)

* Internals: Add a way to request window to not process any interactions for specified number of frames.

* Added missing IMGUI_API to internal docking-related structs. (ocornut#3850)

* Internals: Docking: some renaming.

* Internals: rename RootWindow->RootWindowDockTree, RootWindowDockStop->RootWindow.

Why?  So by default RootWindow matches user expectation on both branches, and RootWindowDockTree is more intentful.
(Actually should reduce diff between master<>docking)

* Viewports, Backend: SDL: Fix missing ImGuiBackendFlags_HasSetMousePos flag in docking branch (ok in master), GLFW: Fix application of WantSetMousePos. (ocornut#1542, ocornut#787)

Shows how little this feature is used with nav (was designed for small devices and frankly may be dropped) - but the backend support itself we will make use of for other features.

* Viewports, Internals: added GetViewportPlatformMonitor() will a safety net to keep code portable + simplified handling of disconnected monitor in Begin().

* ImDrawFlags: rework/revert c2d6d26 + 39432bf in a way that is closer to old version and back to opt-in but with default 0 = all corners.

* Removed deprecated flag stopping compilation (ocornut#3902)

* Docking: Dockspace() never draws a background. (ocornut#3924)

* Docking: undocking nodes/windows covering most of the monitor max their size down to 90% to ease further manipulations.

Kind of a welcome hack.

* Docking: Add support for split_outer in DockContextCalcDropPosForDocking().
Misc: Add FIXME regarding behavior of some window fields.

* Viewports, Backends: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (ocornut#3881)

* BeginMainMenuBar(): remove expectation that we don't know menu bar height ahead, allowing up to generalize placement in any direction (will be done in master)

Amend 75de34e

* Viewports: Hotfix for crash in monitor array access, caused by 4b9bc49. (ocornut#3967)

* TabBar: Use mouse position instead of hardcoded +1/-1 offset when reordering tabs.

Fixes tab reordering in test engine when using fast mode.

# Conflicts:
#	imgui_widgets.cpp

* TabBar: Amend previous commit. Fix tab reordering when tab bar has scrolling.

Some tidying up with helpers + honor 16-bit offsets as with other tab bar features (unlikely single reorder can reach that but consistent)

* Backends, Viewports: GLFW: Add a workaround for stuck keys after closing a GLFW window (ocornut#3837).

* Docking: DockSpace() returns its node ID + adding branch changelog.

* Docking: fix undocking from tab-bar by moving mouse horizontally, broken by d705192.

* Docking: removed io.ConfigDockingWithShift option. (ocornut#2109)

* Docking: fix undocking from tab-bar by moving mouse horizontally, amend 3ed07a8 + d705192.

Automation system may drag e.g. right-most tab far left (and vice-versa) and one frame and our current logic would fail at it.

* Fix popup positioning, broken by 84e6fe4. (ocornut#3991, ocornut#3982)

* Docking: Fixed restoring of tab order within a dockspace or a split node.

(tests in "docking_tab_order")

* Docking: Fixed multiple simultaneously reappearing window from appearing undocked in their initial frame.

* Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame.

* Docking: move NavWindow to SelectedTabId application lower to leave a chance for in-between code to alter focus. + store per-node window menu button id to simplify usage.

* Docking: Fix window menu button. Broken by 3f16a52 (ocornut#4043)

Worked on single-frame click.

* Changelog: added docking+entries from 1.72 to 1.82 to increase their visibility.

* Backends: Vulkan: Fix for using IMGUI_IMPL_VULKAN_NO_PROTOTYPES (ocornut#4151, ocornut#3759, ocornut#3227)

* Docking: Docking node tab bar honors ItemInnerSpacing.x before first tab. Tweak rendering and alignment of dock node menu marker. (ocornut#4130)

+ Fix ~0 in EndFrameDrawDimmedBackgrounds() which is obsolete way of signifying "all round corners".

* Docking: Fix IsWindowAppearing() and ImGuiCond_Appearing on docked windows. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061)

* Docking: Amend 91704b7, window->DockXXX booleans not properly cleared when window not docked. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061)

Fix issue with freshly split windows/nodes incorrectly returning true to IsWindowAppearing().

* Docking: Fix IsWindowAppearing() unnecessarily returning true twice in a row. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061) + added a zealous assert.

* Docking: Clicking on the right-most close button of a docking node closes all windows. (ocornut#4186)

* Docking: comments (ocornut#4189)

* Added PushDisabled(), PopDisabled() currently only exposed in imgui_internal.h (ocornut#211)

* ImVector: added clear_delete(), clear_destruct() helpers.

# Conflicts:
#	imgui.cpp

* Nav, Drag and Drop, Docking: fixed two issues leading nav result to conflict with moving a window. (ocornut#4211, ocornut#3025)

* Backends, Viewports: Vulkan: Fix the use of the incorrect fence in wait for fence. (ocornut#4208)

The fence being waited upon was not the one associated with the current frame.
This results in validation error detecting a reset of command buffers still in use and resetting fences while still in use.
Read more details in ocornut#4208

* Metrics: Tentative fix for bad printf format.

Ref b53b8f5, a7a1b3b

* Viewport: extracted code out of Begin() into WindowSyncOwnedViewport() - no other change

* Viewports: Fix popup/tooltip created without a parent window from being given a ParentViewportId value of the implicit/fallback window. (ocornut#4236, ocornut#2409)

Amend 3ead982

* Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys().

No need to clear fields before deletion. DX12: renamed to match docking branch.

* Backends: Viewports: renamed viewport storage structures ImGuiViewportDataXXXX -> ImGui_ImplXXXX_ViewportData and locals (matching naming convention in 70c6038)

* Docking: removed DockNodeFlagsOverrideClear flags from ImGuiWindowClass. (ocornut#2999, ocornut#3521, ocornut#3633)

+ extraded bits of metrics into DebugNodeDockNodeFlags()

* Docking: Reworked node flags saving/inheritance... (ocornut#4292, ocornut#3834, ocornut#3633, ocornut#3521, ocornut#3492, ocornut#3335, ocornut#2999, ocornut#2648)

..so that flags enforced by docked windows via the DockNodeFlagsOverrideSet mechanism are are not left in empty dockspace nodes once the windows gets undocked.

* Docking: Added ImGuiDockNodeFlags_NoDockingOverEmpty. Breaking definition of ImGuiDockNodeFlags_NoDockingOverOther which now means "non empty node". (ocornut#3492, ocornut#2648, ocornut#4292)

* Docking: Fixed crash issues using DockBuilderRemoveNode() in some situations. (ocornut#3111, ocornut#3179, ocornut#3203, ocornut#4295)

If the deleted root node isn't part of a dockspace with a central node, it won't be "protected" but removed when last window gets removed.

* Docking: Fix crash when a dock node gets re-qualified as dockspace>floating>dockspace.. (ocornut#3203, ocornut#4295)

Which tends to happen when incorrectly calling DockBuilderAddNode() without ImGuiDockNodeFlags_Dockspace and using it as a Dockspace on the next frame after the floating window hosting the node has been automatically created.

* Added missing IMGUI_API to GetViewportPlatformMonitor. (ocornut#4309)

* Backends: Win32, SDL, GLFW: only honor io.WantSetMousePos when focused + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (ocornut#787, ocornut#2445, ocornut#2696, ocornut#3751, ocornut#4377)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp

* IO: modify io.AddFocusEvent() to tolerate in/out for multi-viewports. Amend 2f40be6. (ocornut#3532)

* Fix BeginDisabled(false), (ocornut#211, ocornut#4452)

* Fix BeginDisabled(false), again, (ocornut#211, ocornut#4452, ocornut#4453) Version 1.84.1

(forced pushed since our earlier versioning didn't sort correctly in github web)

# Conflicts:
#	docs/CHANGELOG.txt

* Backends: GLFW: Fixed unused variable warning for empty assert macro. (ocornut#4459)

* Docking: fixed settings load issue when mouse wheeling. (ocornut#4310)

* Docking: fix 58f5092 (ocornut#4310)

If we clear _ChildWindow flag we must remove it from here otherwise render loop will fail.

* Docking: warning fix for when IM_ASSERT() is empty

* Fixed bad merge of Changelog in docking branch

* Internals: refactored IsWindowHovered()/IsWindowFocused() to make their logic more similar + change underlying value of ImGuiHoveredFlags_AllowWhenBlockedByPopup + comment out docking only flags.

* Fixed _ChildWindows from leaking docking hierarchy. Added ImGuiFocusedFlags_DockHierarchy and ImGuiHoveredFlags_DockHierarchy.

* Viewports: fixed unnecessary creation of temporary viewports when multiple docked windows got reassigned to a new node (created mid-frame) which already has a HostWindow

* Viewports: Fixed a crash while a window owning its viewport disappear while being dragged.

t would manifest when e.g. reconfiguring dock nodes while dragging.

* Viewports: fix window with viewport ini data immediately merged into a host viewport from leaving a temporary viewport alive for a frame (would leak into backend).

* Fixed IsWindowFocused/IsWindowHovered with _ChildWindows for not following through popup parents (amend 6b1e094, fix ocornut#4527)

* Viewports: extracted DestroyViewport() out of UpdateViewportsNewFrame() function.

* Docking: bits.

* Docking: floating node with a central node hides properly when nothing is docked + rename.

* Docking: Improved resizing system so that non-central zone are better at keeping their fixed size.

* Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation is disabled. (ocornut#4547, ocornut#4439)

* Docking: Fixed IsItemHovered() and functions depending on it (e.g. BeginPopupContextItem()) when called after Begin() on a docked window (ocornut#3851)

Fix ee643b2

* Added ImGuiFocusedFlags_NoPopupHierarchy and ImGuiHoveredFlags_NoPopupHierarchy (followup ocornut#4527)

IsWindowFocused: fix flag usage (amend 6b1e094) was technically harmless because of light typing.

* Docking: reinstate io.ConfigDockingWithShift option. (ocornut#4643)

This more or less reverts commit 3ed07a8.

* Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (ocornut#4655, ocornut#4452, ocornut#4453, ocornut#4462)

* Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (ocornut#4656)

* Viewports: Made it possible to explicitly assign ImGuiWindowClass::ParentViewportId to 0. (ocornut#3152, ocornut#2871)

* Fixed tooltip in own viewport over modal from being incorrectly dimmed. (ocornut#4729)

Normally we would aim to ensure that g.Windows[] gets maintained to reflect display layer but it is presently non trivial.

* Fixed crash on right-click without modal, introduced by previous commit a3667f4,  (ocornut#4729)

* Viewports: fix missing default per-window value for ParentViewportId due to zero-cleared in-window instance (ocornut#4756)

Broken by 2080d12

* Docking: Fixed a bug undocking windows docked into a non-visible or _KeepAliveOnly dockspace. (ocornut#4757)

* Docking: Fix typo (had no side effect) (ocornut#4778)

Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com>

* Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport + moved EndFrameDrawDimmedBackgrounds() call + removed duplicate code in Begin() already in EndFrameDrawDimmedBackgrounds()

* Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree.

* Docking: Fixed single-frame node pos/size inconsistencies when window stop or start being submitted.

Fix 718e15c while preserving its intended property. Tested by "docking_window_appearing_layout". (ocornut#2109)

* Docking: internals: extracted rounding corner calculation into reusable CalcRoundingFlagsForRectInRect() function.

* Docking: docked windows honor ImGuiCol_WindowBg. Host window in charge of rendering seams. (ocornut#2700, ocornut#2539 + Docked windows honor display their border properly. (ocornut#2522)

Plus: better support for transparent one in nodes
Side effects: DockContextBindNodeToWindow doesn't alter node->IsVisible.
Side effects: ImDrawList:: _ResetForNewFrame() needs to merge, sane (in case of
(Amended, force-pushed)

* Docking: Amend b16f738 fixed dimming of docked window + removed thin highlight around windows (never worked on docked window, not viewports friendly, hard to move to EndFrame) (ocornut#2700, ocornut#2539, ocornut#2522)

* Nav, Docking: reworked modal/ctrl+tab dimming system to be entirely processed at end of the frame, which will simplify things for an upcoming commit.

(Will backport some of this back to master now.)

* Nav, Docking: Fix dimming on docked windows.

* Nav, Docking: Fix crash on dimming docked window and DockSpaceOverViewport() with PassthruCentralNode.

(amend 1dc3af3, 23ef6c1, 657073a)

* Added an assertion for the common user mistake of using "" as an identifier at the root level of a window. (ocornut#1414, ocornut#2562, ocornut#2807, ocornut#4008, ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796)

  ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796)

* Docking: prevent docking any window created above a popup/modal. (ocornut#4317)

* Internals: UpdateWindowInFocusOrderList: amend a528398 to fix docking. (ocornut#3496, ocornut#4797)

* Internals: reduced side-effects of setting window->HiddenFramesForRenderOnly > 0

* Viewports: Fixed a CTRL+TAB crash with viewports enabled (ocornut#4023, ocornut#787) (amend 1dc3af3, 23ef6c1, 657073a)

+ Expose FindHoveredViewportFromPlatformWindowStack() in imgui_internal.h

* Update .gitignore

* Backends: OSX: Fixed typo.

* Rename io.AddKeyModEvent() -> io.AddKeyModsEvent() and updated backends accordingly. (ocornut#2625, ocornut#4858)

Amend 790132a (breaking)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp

* IO: fix SetKeyEventNativeData() not handling ImGuiKey_None the same way as AddKeyEvent(). (ocornut#4905, ocornut#4858)

* Merge "Backends: SDL: Fix for Emscriptem. Amend 98ce013." + Fix bad merge from master of "is_app_focused" property (Amend 0647ba3)

* Viewports: Fixed active InputText() from preventing viewports to merge. (ocornut#4212)

* Viewports: Relaxed specs for backend supporting ImGuiBackendFlags_HasMouseHoveredViewport. Backends: SDL: Added support for simplified HasMouseHoveredViewport. (ocornut#1542, ocornut#4665)

* IO: added AddMouseViewportEvent() + used in backends.

* Docking: Fixed a CTRL+TAB crash when aiming at an empty docked window. (ocornut#4792)

* Revert moving ImGuiKeyModFlags to internal.h (amendc906c65)

# Conflicts:
#	imgui.cpp

* Backends: SDL: no support for ImGuiBackendFlags_HasMouseHoveredViewport under OSX/LInux (ocornut#4960)

* Docking: Fixed size constraints not working on single window holding on a dock id (still doesn't work on docked windows).

* Docking: Tabs use their own identifier (in order to make window->ID refer to whole window in test engine).  Also prevents Tab ID from clashing with "" which was common.

* Docking: Fixed CTRL+TAB back into a docked window not selecting menu layer when no item are on main layer.

Could merge on master.

* Backends: SDL: Amend 08350e5, multi-viewports mouse tracking works under Linux. (ocornut#4960) + Reword tests to help static analysis.

* Docking: fixed potential crash if a passthrough dock node is submitted without a child intermediate (currently not possible via API)

* Internals: rework RenderMouseCursor() signature so we can use it in docking branch more naturally. (Merged from master+ rework for docking)

# Conflicts:
#	imgui.cpp
#	imgui_draw.cpp

* Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (ocornut#4900)

* Docking: Fixed floating docked nodes not being clamped into viewport workrect to stay reachable when g.ConfigWindowsMoveFromTitleBarOnly is set and multi-viewports are disabled. (ocornut#5044)

* Viewports: Fixed translating a host viewport from briefly altering the size of AlwaysAutoResize windows. (ocornut#5057)

* Backends: SDL: Fix multi-viewport dragging issue with SDL on some systems. (ocornut#5012)

* Backends: SDL: Fix more dragging issues. SDL_CaptureMouse() is essentially broken. (ocornut#5012, ocornut#5082)

master got c5f6721 which is combining f337378 and this commit.

* Windows: Fixed first-time windows appearing in negative coordinates. (ocornut#5215, ocornut#3414)

Regression added in 6af92b0

* Backends: OSX, Metal: Added multi-viewports support. (ocornut#4821, ocornut#2778)

* Backends: OSX, Metal: Amend d111133, tidying up, remove unused, misc tweaks. . (ocornut#4821, ocornut#2778)

* Backends: OSX: Implement ImGui_ImplOSX_ShowWindow(). (ocornut#5299)

* Examples: Apple+OpenGL: Fix build.

* Docking: Fixed moving window being interrupted when undocing a window with "io.ConfigDockingAlwaysTabBar = true". (ocornut#5324)

Regression introduced in 6b77668

* Docking: Fix unhiding tab bar regression. (ocornut#5325, ocornut#5181)

Broken by 9038678

* Misc: Fix custom assertion macro failing to compile imgui.cpp (ocornut#5378)

* Docking: Fixed incorrect focus highlight on docking node when focusing empty central node or a child window which was manually injected into a dockspace window.

* Backends: SDL+GLFW, Examples: SDL+Metal, GLFW+Metal: Fix viewport support with Metal backend.

Fixes ocornut#5392 + alignment fixes and removed static_cast<> + Amended with fix.

* Docking, Modal: Fixed a crash when opening popup from a parent which is being docked on the same frame. (ocornut#5401)

Ideally we should untangle the purpose of parent_window_in_stack / ParentWindowInBeginStack better.

* Docking: Amend 24dfebf. Fixed incorrect focus highlight on docking node with nested hierarchies.

* Backends: GLFW: Fixed leftover static variable preventing from changing or reinitializing backend while application is running. (ocornut#4616, ocornut#5434)

* Backends, Viewport: Metal: Pull format from shared context. (ocornut#5403, ocornut#5437)

* Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer  (ocornut#5463, ocornut#4792)

Fix 37958ca

* Docking: Fix docked window contents not rendering when switching with CTRL+Tab.

(regression from 8eb8689).

* Internals: Docking: make DockContextFindNodeByID() more visible (instead of DockBuilderGetNode)

+ using defines for channel changes.

* Docking: Fixed splitting/docking into a node that has buttons amended into tab bar. Windows were not moved correctly. (ocornut#5515)

* Docking: Fixed amending into an existing tab bar from rendering invisible items. (ocornut#5515, amend b16f738 ocornut#2700, ocornut#2539)

Commit b16f738 left us with a "current" channel 0 which seems inadequate. Undoing that, assuming default is always 1, code filling bg color does a switch. Only DockContextEndFrame() leave it at 0 and it's not particularly necessary.

* Docking+Viewports: Fix undocking window node causing parent viewport to become unresponsive. (ocornut#5503)

Amend 67be485, Somehow ties to 58f5092 + 0eb45a0 (ocornut#4310)
Unsure of exact chain of event but this caused a parent link msimatch between the time of the MouseMoving test in AddUpdateViewport() setting _NoInputs on the wrong parent., and the release clearing _NoInputs on the rght one.

* Docking: Simplify logic of moving tabs between nodes. Amends 0abe7d. (ocornut#5515)

The idea is that in the absence of a tab bar, as new one gets created new tabs will be sorted based on window->DockOrder so this may work but we're not 100% sure.

* Docking: Add source dock node parameter DockContextCalcDropPosForDocking() to facilitate test engine (un)docking nodes before they are split out to their own window.
Metrics: Display dock_node->Windows in node metrics.

* Internals: Docking: rename HoveredDockNode to DebugHoveredDockNode to clarify that it isn't usable for much other than debugging.

* Nav: Fixed regression in e99c4fc preventing CTR+Tab to work without NavEnableKeyboard (ocornut#5504, ocornut#4023);

* Obsoleted using SetCursorPos()/SetCursorScreenPos() to extend parent window/cell boundaries. (ocornut#5548)

This incorrect pattern has been mentioned or suggested in: ocornut#4510, ocornut#3355, ocornut#1760, ocornut#1490, ocornut#4152, ocornut#150

# Conflicts:
#	imgui.cpp

* Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (ocornut#5665)

* Docking: Fixed incorrect focus highlight on docking node when focusing a menu. (ocornut#5702)

* Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709)

# Conflicts:
#	backends/imgui_impl_opengl3.cpp

* Update imgui_impl_vulkan.h to match martty/imgui

https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.h

* Update imgui_impl_vulkan.cpp to match martty/imgui

https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.cpp

* Viewports: Fix AddMouseViewportEvent() to honor AppAcceptingEvents, filter duplicate, add to debug log.

* Docking: Fixed missing highlight when using dock node host window borders. (ocornut#5702)

Amend 8f43487, 9764adc, 24dfebf

* Fixed ImGuiWindowFlags_UnsavedDocument clipping label in docked windows with no close button. [changes for docking] (ocornut#5745)

+ TabBar: starts displaying the unsaved document marker with a frame delay to match how close button is processed, otherwise the transition would be noticeable.

* Fix for Vulkan validation layer warnings

Fix from: TheCherno@add065f
ocornut#3957

Co-authored-by: ocornut <omarcornut@gmail.com>
Co-authored-by: Sammy Fatnassi <sammyfreg@gmail.com>
Co-authored-by: GamingMinds-DanielC <daniel.cremers@gamingmindsstudios.com>
Co-authored-by: Adam Kewley <contact@adamkewley.com>
Co-authored-by: Rokas Kupstys <rokups@zoho.com>
Co-authored-by: David Maas <contact@pathogenstudios.com>
Co-authored-by: CheckmateAt7 <66566308+CheckmateAt7@users.noreply.github.com>
Co-authored-by: warriormaster12 <streng.alexander@gmail.com>
Co-authored-by: Michel Lesoinne <michel.lesoinne@androdevllc.com>
Co-authored-by: Mikko Sivulainen <mikko.sivulainen@gmail.com>
Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com>
Co-authored-by: Dima Koltun <koltundimachamp@gmail.com>
Co-authored-by: stuartcarnie <stuart.carnie@gmail.com>
Co-authored-by: omar <ocornut@users.noreply.github.com>
Co-authored-by: Andrej Redeky <41929176+WSSDude420@users.noreply.github.com>
Co-authored-by: Runik <rtoumazet@free.fr>
Co-authored-by: Stephen H. Gerstacker <stephen@gerstacker.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants