Clicking an OSX app title bar clears the focused item in the window #8574

Closed
opened 2025-04-15 23:04:11 +00:00 by Pix3lP3rf3ct · 0 comments
Pix3lP3rf3ct commented 2025-04-15 23:04:11 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

v1.91.9 WIP Docking

Back-ends:

Custom

Compiler, OS:

Clang 16

Full config/build information:

Dear ImGui 1.91.9 WIP (19186)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202002
define: IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
define: IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
define: IMGUI_DISABLE_FILE_FUNCTIONS
define: IMGUI_DISABLE_DEFAULT_ALLOCATORS
define: __APPLE__
define: __GNUC__=4
define: __clang_version__=16.0.0 (clang-1600.0.26.6)
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: NULL
io.BackendRendererName: imgui_impl_TGCEngine
io.ConfigFlags: 0x00000081
 NavEnableKeyboard
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigMacOSXBehaviors
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMoveFromTitleBarOnly
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001408
 PlatformHasViewports
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 1024,2048
io.DisplaySize: 2586.00,1493.00
io.DisplayFramebufferScale: 2.00,2.00
--------------------------------
style.WindowPadding: 6.00,6.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,4.00
style.FrameRounding: 2.00
style.FrameBorderSize: 1.00
style.ItemSpacing: 6.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

Clicking the native OSX window title bar to drag the window causes the internal focused window to be cleared. This causes the user to have to click back into the window to set the focus before triggering any shortcuts.

Screenshots/Video:

Tests tab has focus.
Image

After clicking on the title bar you can see it has lost focus.
Image

Callstack.
Image

Code that clears the focus.
Image

Commenting that line out fixes the issue. That isn't the right solution but shows there needs to be more logic around that call.

Minimal, Complete and Verifiable Example code:

### Version/Branch of Dear ImGui: v1.91.9 WIP Docking ### Back-ends: Custom ### Compiler, OS: Clang 16 ### Full config/build information: ``` Dear ImGui 1.91.9 WIP (19186) -------------------------------- sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20 define: __cplusplus=202002 define: IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS define: IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS define: IMGUI_DISABLE_FILE_FUNCTIONS define: IMGUI_DISABLE_DEFAULT_ALLOCATORS define: __APPLE__ define: __GNUC__=4 define: __clang_version__=16.0.0 (clang-1600.0.26.6) define: IMGUI_HAS_VIEWPORT define: IMGUI_HAS_DOCK -------------------------------- io.BackendPlatformName: NULL io.BackendRendererName: imgui_impl_TGCEngine io.ConfigFlags: 0x00000081 NavEnableKeyboard DockingEnable io.ConfigViewportsNoDecoration io.ConfigMacOSXBehaviors io.ConfigNavCaptureKeyboard io.ConfigInputTextCursorBlink io.ConfigWindowsResizeFromEdges io.ConfigWindowsMoveFromTitleBarOnly io.ConfigMemoryCompactTimer = 60.0 io.BackendFlags: 0x00001408 PlatformHasViewports RendererHasVtxOffset RendererHasViewports -------------------------------- io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 1024,2048 io.DisplaySize: 2586.00,1493.00 io.DisplayFramebufferScale: 2.00,2.00 -------------------------------- style.WindowPadding: 6.00,6.00 style.WindowBorderSize: 1.00 style.FramePadding: 4.00,4.00 style.FrameRounding: 2.00 style.FrameBorderSize: 1.00 style.ItemSpacing: 6.00,4.00 style.ItemInnerSpacing: 4.00,4.00 ``` ### Details: Clicking the native OSX window title bar to drag the window causes the internal focused window to be cleared. This causes the user to have to click back into the window to set the focus before triggering any shortcuts. ### Screenshots/Video: Tests tab has focus. <img width="431" alt="Image" src="https://github.com/user-attachments/assets/23d6f30a-dbf0-4d60-b339-7c895dcf446a" /> After clicking on the title bar you can see it has lost focus. <img width="426" alt="Image" src="https://github.com/user-attachments/assets/c389645d-7a03-48d7-bfda-e39bfb1ae3c3" /> Callstack. <img width="514" alt="Image" src="https://github.com/user-attachments/assets/bd18df6f-4254-4709-80da-82ba649e800e" /> Code that clears the focus. <img width="1309" alt="Image" src="https://github.com/user-attachments/assets/8bfa59c1-eb12-4070-b98e-b672b01ec2d6" /> Commenting that line out fixes the issue. That isn't the right solution but shows there needs to be more logic around that call. ### Minimal, Complete and Verifiable Example code:
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#8574
No description provided.