Skip to content

Commit d7d09a9

Browse files
committed
Merge pull request #113521 from KoBeWi/switch_on_release_not_debug
Make dock tabs switch on button release
2 parents 2ab75a9 + 5a06774 commit d7d09a9

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

editor/docks/editor_dock_manager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ void EditorDockManager::register_dock_slot(DockConstants::DockSlot p_dock_slot,
955955
slot.container = p_tab_container;
956956
p_tab_container->set_popup(dock_context_popup);
957957
p_tab_container->connect("pre_popup_pressed", callable_mp(dock_context_popup, &DockContextPopup::select_current_dock_in_dock_slot).bind(p_dock_slot));
958+
p_tab_container->get_tab_bar()->set_switch_on_release(true);
958959
p_tab_container->get_tab_bar()->connect("tab_rmb_clicked", callable_mp(this, &EditorDockManager::_dock_container_popup).bind(p_tab_container));
959960
p_tab_container->set_drag_to_rearrange_enabled(true);
960961
p_tab_container->set_tabs_rearrange_group(1);

scene/gui/tab_bar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
223223
}
224224
}
225225

226-
if (mb->is_pressed()) {
226+
if (mb->is_pressed() != switch_on_release) {
227227
Point2 pos = mb->get_position();
228228
bool selecting = mb->get_button_index() == MouseButton::LEFT || (select_with_rmb && mb->get_button_index() == MouseButton::RIGHT);
229229

scene/gui/tab_bar.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class TabBar : public Control {
119119

120120
bool select_with_rmb = false;
121121
bool deselect_enabled = false;
122+
bool switch_on_release = false;
122123

123124
int cb_hover = -1;
124125
bool cb_pressing = false;
@@ -329,6 +330,8 @@ class TabBar : public Control {
329330
void set_max_tab_width(int p_width);
330331
int get_max_tab_width() const;
331332

333+
void set_switch_on_release(bool p_switch) { switch_on_release = p_switch; }
334+
332335
Rect2 get_tab_rect(int p_tab) const;
333336
Size2 get_minimum_size() const override;
334337

0 commit comments

Comments
 (0)