Skip to content

Conversation

@Antrophyy
Copy link

@Antrophyy Antrophyy commented Jul 11, 2025

Previously, if you had a window created with a text saying "Hey" and title bar saying, "My really long title", the title would be cut off. With this change, as long as title is longer than the content, it will make the window auto size to fit the title in as well.

It's very noticeable with ImGuiWindowFlags_AlwaysAutoResize flag.

This PR also takes into account the width of collapse button and close button (if present)

…tent

Previously, if you had a window created with a text saying "Hey" and title bar saying "My really long title", the title would be cut off. With this change, as long as title is longer than the content, it will make the window auto size to fit the title.
@Antrophyy Antrophyy changed the title AutoFitSize no longer ignores title length if it's wider than the content of the widndow AutoFitSize no longer ignores title length if it's wider than the content of the window Jul 11, 2025
@ocornut
Copy link
Owner

ocornut commented Aug 11, 2025

This always has been intentional though. Dear ImGui tends to favor small, high-density UI, and I found in a few cases that title bar text being accounted in auto-sizing was more of a nuisance than anything.
Can you explain in which situation this has been a problem for you?

If we were to somehow make that happen:

  • i imagine it would be bound to a style setting.
  • we would probably want title bar code to emit a desired width rather than compute it in CalcWindowAutoFitSize().
    (no need to pursue two two things in the PR yet, first I would likely to understand your reasoning for wanting this)

Thanks!

@Antrophyy
Copy link
Author

We're using ImGui in game development and we allow displaying windows for specific features (if you enabled showing of debug info). With that many systems, we may have more windows opened for debug values. Sometimes, the title is larger than the values which are being shown, which makes it harder to understand what it's really showing.

It's especially noticeable on consoles as resizing the window manually is harder than on PC. So, having the option to auto-size based on title would be very welcome in some cases.

@ocornut
Copy link
Owner

ocornut commented Aug 11, 2025

Thanks for your answer.
Not to detract from the main issue, but having many windows where their contents are very often shorter than their title seems unusual. Please note that if they are procedurally created windows (e.g. windows following on-screen entities) you can easily extend their content size by e.g. submitting Dummy().

It's especially noticeable on consoles as resizing the window manually is harder than on PC.

Also note that you can resize with gamepad controls or bind a mouse to your system (most SDK have a mouse API, some even wrap uSynergy (https://github.com/ocornut/imgui/tree/master/examples/libs/usynergy) into ready-to-use application requiring zero setup which will share your Windows mouse with the console, I can't name specific here due to NDA).

I'll leave this open until I have a chance to rework this.

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