Skip to content

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

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

Open
Pix3lP3rf3ct opened this issue Apr 15, 2025 · 2 comments
Open
Labels

Comments

@Pix3lP3rf3ct
Copy link

Pix3lP3rf3ct commented Apr 15, 2025

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:

@ocornut
Copy link
Owner

ocornut commented Apr 15, 2025

Hello Joe,
Could you open Debug Log->IO and report mouse events passed to the app and imgui ?
This would happen if clicking the osx title bar would report a mouse click to the event, but afaik standard backends shouldn’t do that.

@Pix3lP3rf3ct
Copy link
Author

Hi Omar! You are right, if the app is focused we always pass mouse movement changes to the application and if you click the title bar we do pass the click event to Imgui. I'll look into our backend and see why we're doing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants