Skip to content

Commit 20b2674

Browse files
committed
Merge pull request #105481 from bruvzg/rtl_title_sort
Fix incorrect title bar sorting in RTL layout.
2 parents 98aced4 + 5355fca commit 20b2674

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

editor/gui/editor_title_bar.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,23 @@ void EditorTitleBar::_notification(int p_what) {
9696
Control *prev = nullptr;
9797
Control *base = nullptr;
9898
Control *next = nullptr;
99-
for (int i = 0; i < get_child_count(); i++) {
99+
100+
bool rtl = is_layout_rtl();
101+
102+
int start;
103+
int end;
104+
int delta;
105+
if (rtl) {
106+
start = get_child_count() - 1;
107+
end = -1;
108+
delta = -1;
109+
} else {
110+
start = 0;
111+
end = get_child_count();
112+
delta = +1;
113+
}
114+
115+
for (int i = start; i != end; i += delta) {
100116
Control *c = as_sortable_control(get_child(i));
101117
if (!c) {
102118
continue;

0 commit comments

Comments
 (0)