From 5355fcae6211cd1feee5a3f4a052eb79912efca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Thu, 17 Apr 2025 09:29:43 +0300 Subject: [PATCH] Fix incorrect title bar sorting in RTL layout. --- editor/gui/editor_title_bar.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/editor/gui/editor_title_bar.cpp b/editor/gui/editor_title_bar.cpp index cf5cd49b50d..19bb2fd7ea8 100644 --- a/editor/gui/editor_title_bar.cpp +++ b/editor/gui/editor_title_bar.cpp @@ -96,7 +96,23 @@ void EditorTitleBar::_notification(int p_what) { Control *prev = nullptr; Control *base = nullptr; Control *next = nullptr; - for (int i = 0; i < get_child_count(); i++) { + + bool rtl = is_layout_rtl(); + + int start; + int end; + int delta; + if (rtl) { + start = get_child_count() - 1; + end = -1; + delta = -1; + } else { + start = 0; + end = get_child_count(); + delta = +1; + } + + for (int i = start; i != end; i += delta) { Control *c = as_sortable_control(get_child(i)); if (!c) { continue;