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

Add the ability to toggle ImGuiViewportFlags_TopMost after viewport creation on win32 #3477

Closed
wants to merge 1 commit into from

Conversation

Kyuusokuna
Copy link

Currently the example imgui_impl_win32 does not respond to changes of ImGuiViewportFlags_TopMost as the SWP_NOZORDER uFlags and NULL hWndInsertAfter passed to SetWindowPos() prevents a window from changing its topmost style.

According to https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos hWndInsertAfter must be either HWND_TOPMOST or HWND_NOTOPMOST and uFlags must not contain SWP_NOZORDER in order to change the topmost style.

Testcase:

static bool topmost = true;
ImGui::Begin("Topmost Test");
ImGui::Checkbox("Topmost", &topmost);

if (topmost)
    ImGui::GetWindowViewport()->Flags |= ImGuiViewportFlags_TopMost;
else
    ImGui::GetWindowViewport()->Flags &= ~ImGuiViewportFlags_TopMost;

ImGui::End();

@ocornut
Copy link
Owner

ocornut commented Sep 17, 2020

Thank you very much Sven, I appreciate the patch and details/links. Merged now!

@ocornut ocornut closed this Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants