Skip to content

HoveredWindow state is no longer cleared after closing a secondary viewport #7971

Closed
@tombuskens

Description

Version/Branch of Dear ImGui:

version 1.91.0 (19100), docking branch

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx12.cpp

Compiler, OS:

Windows 10 + MSVC 14.39.33218

Full config/build information:

Dear ImGui 1.91.0 (19100)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202002
define: _WIN32
define: _WIN64
define: _MSC_VER=1939
define: _MSVC_LANG=202002
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx12
io.ConfigFlags: 0x00000481
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoAutoMerge
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMoveFromTitleBarOnly
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 39 fonts, Flags: 0x00000000, TexSize: 1024,1024
io.DisplaySize: 784.00,561.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

Details:

In the docking branch, after closing a modal dialog, the hovered window state is no longer cleared when moving the mouse from within the app to outside the app.
The expected behavior would be that the hovered window state is cleared.

See video for steps to reproduce, .e.g.

  • Open a modal dialog
  • Close it
  • Hover over a window (HoveredWindow is set correctly)
  • Move from the window to a location outside of the application (HoveredWindow is incorrectly still set)

I noticed normally, when moving the mouse outside the application generates both a MouseViewport (0x00000000) and a MousePos(-FLT_MAX, -FLT_MAX). After opening and closing the modal, only a MouseViewport (0x00000000) is generated when moving outside the application.

As a workaround I'm currently calling ImGui::GetIO().AddMousePosEvent(-FLT_MIN, -FLT_MIN); after closing a modal dialog.

Screenshots/Video:

hovered_window.mp4

Minimal, Complete and Verifiable Example code:

Unmodified demo window.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions