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

SDL: focused viewport pushed into the background by tooltips in its own viewport #7950

Open
lailoken opened this issue Sep 3, 2024 · 0 comments

Comments

@lailoken
Copy link

lailoken commented Sep 3, 2024

Version/Branch of Dear ImGui:

Version 1.91 docking

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Linux + GCC

Full config/build information:

Dear ImGui 1.91.1 WIP (19101)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 4, sizeof(ImDrawVert): 20
define: __cplusplus=201103
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: IMGUI_DISABLE_OBSOLETE_KEYIO
define: __linux__
define: __GNUC__=13
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl2
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000481
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigDockingWithShift
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 12 fonts, Flags: 0x00000000, TexSize: 2048,2048
io.DisplaySize: 1.00,1.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: 1.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

My Problem is identical to #7354 except that I am on SDL backend.

Tooltips (when created as a viewport) steal input focus.

However, if I modify the create function in imgui_impl_sdl2.cpp with the following two lines preceding the create it works for me: (see example code below)

Incidentally I find that using SDL_WINDOW_POPUP_MENU there instead of SDL_WINDOW_TOOLTIP also makes it work, and is possibly something to be used for menus, but using SDL_WINDOW_TOOLTIP does not seem to break menu popups.

I'm not sure if this is the correct way to solve this, but I hope this can help.

For now I'll be using this in my project unless there is a better way.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

    if (viewport->ParentViewportId != 0 && (viewport->Flags & ImGuiViewportFlags_TopMost))
        sdl_flags |= SDL_WINDOW_TOOLTIP;

    vd->Window = SDL_CreateWindow("No Title Yet", (int)viewport->Pos.x, (int)viewport->Pos.y, (int)viewport->Size.x, (int)viewport->Size.y, sdl_flags);
@ocornut ocornut changed the title Focused window pushed into the background by tooltips of other windows SDL: focused viewport pushed into the background by tooltips in its own viewport Sep 3, 2024
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

2 participants