Skip to content

Fix EditorTitleBar excessive width - #109396

Closed
WhalesState wants to merge 1 commit into
godotengine:masterfrom
mounirtohami:editor-scroll-box
Closed

Fix EditorTitleBar excessive width#109396
WhalesState wants to merge 1 commit into
godotengine:masterfrom
mounirtohami:editor-scroll-box

Conversation

@WhalesState

@WhalesState WhalesState commented Aug 7, 2025

Copy link
Copy Markdown
Contributor
Screencast.From.2025-08-07.20-20-24.mp4

Summary of Changes:

  • EditorScrollBox Extracted for Reuse:

  • Improved Layout in EditorTitleBar:

    • Refactored the layout using three expanding containers instead of relying on spacer size calculations. This simplifies alignment and makes future layout changes easier:
      [ left_hb ] [ center_hb ] [ right_hb ]
  • New Minimum Editor Size:

    • The minimum size of the editor window is now set to 640×480. This change required adjusting many UI elements to fit within the new constraints. (Most of those adjustments are already done locally).
  • Selective Use of EditorScrollBox:

    • The new EditorScrollBox has been applied to the main menus and screen buttons, but not to right_hb, which includes the EditorRunBar and plugin-specific controls.
      Note: it’s currently difficult to keep the main screen buttons centered when many plugins are added to the right container.

Requires testing on Android Editor to confirm compatibility and layout integrity on smaller screens.

  • Note: The change to the Renderer Button shown in the demo video is not included in this PR. That change is part of Use renderer icons instead of text to reduce the topbar width. #109357, and is shown in the video only to demonstrate the final result when both PRs are merged.

  • Note: The Pause and Stop button changes shown in the video have been removed from this PR. They will be moved to a separate PR if needed.

@AThousandShips AThousandShips added this to the 4.x milestone Aug 7, 2025
@WhalesState
WhalesState force-pushed the editor-scroll-box branch 2 times, most recently from 2801488 to 1fc93ee Compare August 7, 2025 17:28
@WhalesState
WhalesState marked this pull request as ready for review August 7, 2025 17:28
@WhalesState
WhalesState requested review from a team as code owners August 7, 2025 17:28
@WhalesState
WhalesState requested a review from a team August 7, 2025 17:28
@WhalesState
WhalesState requested a review from a team as a code owner August 7, 2025 17:28
@KoBeWi

KoBeWi commented Aug 7, 2025

Copy link
Copy Markdown
Member

For the main screen buttons, I was wondering if we shouldn't change them to TabBar/TabContainer, which would eventually allow to use main screen as a dock slot. Related: #106164

@arkology

arkology commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

For main screen buttons (2D, 3D, ect.) this is 100% improvement (existing buttons will not break layout at editor minimum size and buttons added by plugins will not make it worse).
Other changes I think require more discussion.
In my opinion the end goal of all this changes (including #102301) is to fit editor on a quarter (at least) of the screen (fullhd monitor). For android - being able to use editor in portrait mode.

@WhalesState

WhalesState commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

For the main screen buttons, I was wondering if we shouldn't change them to TabBar/TabContainer, which would eventually allow to use main screen as a dock slot. Related: #106164

I already have an old change that allows reparenting the TabBar of the TabContainer which may help with this, The only issue is that all the Main Screen plugins have a very large width due to their top bar minimum width which will make it harder to align two of them horizontally.

image

I already have some changes locally that can reduce their width and was thinking about reusing the new EditorScrollBar container introduced in this PR to move the select buttons to the left of the 2D/3D Editors like how they are done in Blender, I remember i have seen a feature request asking for that too.

image

@WhalesState

Copy link
Copy Markdown
Contributor Author

For main screen buttons (2D, 3D, ect.) this is 100% improvement (existing buttons will not break layout at editor minimum size and buttons added by plugins will not make it worse). Other changes I think require more discussion. In my opinion the end goal of all this changes (including #102301) is to fit editor on a quarter (at least) of the screen (fullhd monitor). For android - being able to use editor in portrait mode.

  • Yes the main goal is to support smaller screens for the editor to be able to increase the editor scale or tile the editor window without issues, and the only issue we have now are bottom panels and the main screen editor plugins that are preventing that, if we follow the same approach here Improve and reduce animation player/track editor width. #109361 by having a HFlowContainer with two children LeftHBoxContainer and RightHBoxContainer we can eliminate most of those issues in a clean way, and we will be left with the EditorTitleBar preventing that which this PR fixes and it can go with only reusing the new Container for main screen buttons only, and also we can optionally allow disabling the button's text in the EditorSettings like this.
image

Comment thread doc/classes/EditorScrollBox.xml Outdated
@bruvzg

bruvzg commented Aug 7, 2025

Copy link
Copy Markdown
Member

This pretty much breaks editor title on macOS.

  • Window name is no longer visible.
  • Large portions of the title are not responding to drag.
  • Tabs seems off center.
  • Resizing is not quite uniform.
Screen.Recording.2025-08-07.at.22.44.00.mov

Title bar element alignment before the change, window name and all empty areas are draggable:

Screenshot 2025-08-07 at 22 48 07

@bruvzg

bruvzg commented Aug 7, 2025

Copy link
Copy Markdown
Member

Some notes:

There's set_center_control method in the EditorTitleBar used with main_editor_button_hb to force center it regardless of other controls. Current implementation require a direct child of EditorTitleBar as argument, so it won't work when it wrapped in the new container, and it also depends on main_editor_button_hb being fixed size to work. Forced centering supposed to work only if there's plenty of free space on both sides, so it probably can be adjusted.

Window title can be added to the menu scroll container, since only one of two can be visible at the same time (menu bar still need to be in the scene tree, but will be zero size and invisible).

Window drag can be fixed by setting PASS mouse filter on all new containers.

@WhalesState

Copy link
Copy Markdown
Contributor Author
  • Window name is no longer visible.

I have applied a fix, please test again to confirm it.

  • Large portions of the title are not responding to drag.

I have applied a fix, some containers was using mouse filter stop and changed them to pass, please confirm it.

  • Tabs seems off center.

This is a result of reducing the editor size to 640x480, happens on all platforms because the main screen and bottom panels plugins still doesn't support the new size efficiently.

  • Resizing is not quite uniform.

I gave the main screen buttons a higher stretch ratio on MACOS since there's no longer a menu. please check with EditorDebugger plugin for the best stretch ratio that fits MACOS.

@WhalesState

WhalesState commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

Some notes:

There's set_center_control method in the EditorTitleBar used with main_editor_button_hb to force center it regardless of other controls. Current implementation require a direct child of EditorTitleBar as argument, so it won't work when it wrapped in the new container, and it also depends on main_editor_button_hb being fixed size to work. Forced centering supposed to work only if there's plenty of free space on both sides, so it probably can be adjusted.

Window title can be added to the menu scroll container, since only one of two can be visible at the same time (menu bar still need to be in the scene tree, but will be zero size and invisible).

Window drag can be fixed by setting PASS mouse filter on all new containers.

We may not need this anymore after this PR since it doesn't require the old ways of centering the main screen buttons and it's managed automatically by only using 3 containers and their expanding methods, the MainScreenButtons now have the higher expand ratio and is still affected by the EditorRunBar and the Renderer Button which are all part of the right hbox now.

@bruvzg

bruvzg commented Aug 7, 2025

Copy link
Copy Markdown
Member

It's not always 3 controls, there are extra spacers (left/right_menu_spacer) added on macOS to account for window buttons, these spacers are always different width, so this will introduce misalignment.

I'll retest it tomorrow.

@bruvzg

bruvzg commented Aug 7, 2025

Copy link
Copy Markdown
Member

I guess these extra spacers can be replaced by extra margins on side containers, these only exist to reserve empty space, actual window buttons are native elements and controlled/drawn by OS.

@WhalesState

WhalesState commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

It's not always 3 controls, there are extra spacers (left/right_menu_spacer) added on macOS to account for window buttons, these spacers are always different width, so this will introduce misalignment.

Removed the right spacer since it's useless now after this change and moved the left spacer into the left HBox container is an internal child since it's only used for MACOS to show the title label, so they are now only 3 children for the EditorTitleBar.

Note: we also can add the label directly to the left hbox and we remove the left spacer too.

The new EditorScrollBox can't work with spacers since it doesn't have a minimum size and it needs to expand to fill the available space to be functional.

Also for testing i have used Zylan.EditorDebugger plugin to hide the CIE and the game editor top HFlowContainer because they was preventing resizing down the window.

@bruvzg

bruvzg commented Aug 8, 2025

Copy link
Copy Markdown
Member

Removed the right spacer since it's useles

It's not useless, if OS language is right-to-left and Godot language is left-to-right (or vice versa) buttons will be over the right spacer.

@bruvzg

bruvzg commented Aug 8, 2025

Copy link
Copy Markdown
Member

Dragging seems to work.

Title still not visible.

And main tabs still off center, it does not matter if there are a same number of controls on the both sides as long as spacers are different fixed size it will be off:

[  X  -  +  ][    left container    ][   center container   ][    right container   ][ ]
                                           /\                                           
                                         center

@WhalesState

Copy link
Copy Markdown
Contributor Author

[ X - + ][ left container ][ center container ][ right container ][ ]
/\
center

It's so hard to access a mac and it will be great if you can help me by downloading EditorDebugger from asset store then enabling inspecting elements in the plugin and you inspect the title bar with F12 to be able to change the label or container settings in editor inspector to find a quick fix.

The reason why they are not centered is that they are no longer 3 containers, it should be like this to work on mac similar to other platforms.
[ left container ] [ center container ] [ right container ]
[ [ X - + ] scene-name - Godot ] [ 2D 3D Game Assets ] [ play buttons [ right spacer ] ]

Also for RTL layout i tested it and it works fine in all other platforms.

@WhalesState
WhalesState force-pushed the editor-scroll-box branch 2 times, most recently from ab8f084 to 402ed20 Compare August 12, 2025 05:37
Button *button = get_left_button();
button->set_button_icon(theme_cache.arrow_left);
button->set_accessibility_name(TTRC("Scroll Left"));
button->set_tooltip_text(TTRC("Scroll Left\nHold Ctrl to scroll to the begin.\nHold Shift to scroll one page."));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On RTL layout it says scroll to the begin instead of end, and to fix this it will result in 4 translated lines instead of just 2, so we can consider replacing both translations to say Hold Ctrl to scroll to the far left and Hold Ctrl to scroll to the far right.

…op bar.

Co-authored-by: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
@Repiteo

Repiteo commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Needs rebase

Comment thread editor/editor_node.cpp
#endif
} else {
#ifndef MACOS_ENABLED
menu_scroll_box = memnew(EditorScrollBox);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think putting the menu buttons into a Scroll Box is a weird UX, I haven't seen menu buttons be scrollable like this.
It is also inconsistent, since to save space it can already be collapsed to a main menu button with an Editor Setting, there doesn't need to be 2 different ways to allow it to be smaller.

Ideally we would just switch to the collapsed main menu when there isn't enough space.
However I think it would need custom code to detect when it is too small (or something like godotengine/godot-proposals#12397), so this can be changed later in a future PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main screen plugins might eventually get converted to docks, so the top buttons would become a TabBar.

@akien-mga

Copy link
Copy Markdown
Member

This hasn't been rebased in a month, so this should probably be salvaged by another contributor.
It's too late to merge for 4.6 but should be mergeable in the 4.7 dev cycle if it's updated.

@KoBeWi

KoBeWi commented Dec 9, 2025

Copy link
Copy Markdown
Member

#113051 would effectively replace it if it's merged (like what happened with bottom panel xd).

@Repiteo
Repiteo requested a review from a team as a code owner February 17, 2026 20:10
@WhalesState

Copy link
Copy Markdown
Contributor Author

This hasn't been rebased in a month, so this should probably be salvaged by another contributor. It's too late to merge for 4.6 but should be mergeable in the 4.7 dev cycle if it's updated.

Sorry for the delay. I can rebase the PR and resolve the conflicts if needed.

But TBH, I actually prefer the dock-able main screens approach over this PR. This change was mainly a workaround to reduce the editor window width, but several other editor plugins would still require proper adjustments to fully support smaller layouts.

So in the long term, the dock-able solution feels cleaner since it doesn't require a new temporary editor class.

#113051 would effectively replace it if it's merged (like what happened with bottom panel xd).

To avoid unnecessary conflicts, it might be better to focus on testing and resolving the Android crash in #113051 instead.

@AdriaandeJongh
AdriaandeJongh self-requested a review March 5, 2026 14:30
@AdriaandeJongh
AdriaandeJongh removed their request for review March 20, 2026 10:22
@Repiteo
Repiteo dismissed stale reviews from bruvzg and AThousandShips June 17, 2026 16:35

Review is now stale

@Repiteo

Repiteo commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Superseded by #113051; thanks for your contribution!

@Repiteo Repiteo closed this Jun 17, 2026
@Repiteo Repiteo removed this from the 4.x milestone Jun 17, 2026
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.

8 participants