summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorator-dev <dominic.codedeveloper@gmail.com>2021-11-29 20:12:05 +0000
committerator-dev <dominic.codedeveloper@gmail.com>2021-11-29 20:25:42 +0000
commit8c2b7ea537e19d8c00dab10e1902f24fdd2c8e84 (patch)
treeb5030d4a3c088b2aef18b29d904248577b162565 /scene/gui
parent9d3875dde75b95ea172c60188ca345162f2b38b9 (diff)
Prevent hidden tab close buttons from intercepting input [4.0]
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/tab_bar.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp
index 57ee7fd494..c7d5a600a1 100644
--- a/scene/gui/tab_bar.cpp
+++ b/scene/gui/tab_bar.cpp
@@ -164,7 +164,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
if (rb_hover != -1) {
- // pressed
+ // Right mouse button clicked.
emit_signal(SNAME("tab_rmb_clicked"), rb_hover);
}
@@ -174,7 +174,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
if (cb_hover != -1) {
- // pressed
+ // Close button pressed.
emit_signal(SNAME("tab_close_pressed"), cb_hover);
}
@@ -183,7 +183,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
}
if (mb->is_pressed() && (mb->get_button_index() == MouseButton::LEFT || (select_with_rmb && mb->get_button_index() == MouseButton::RIGHT))) {
- // clicks
+ // Clicks.
Point2 pos = mb->get_position();
if (buttons_visible) {
@@ -235,7 +235,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
return;
}
- if (tabs[i].cb_rect.has_point(pos)) {
+ if (tabs[i].cb_rect.has_point(pos) && (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current))) {
cb_pressing = true;
update();
return;
@@ -659,7 +659,7 @@ void TabBar::_update_hover() {
}
const Point2 &pos = get_local_mouse_position();
- // test hovering to display right or close button
+ // test hovering to display right or close button.
int hover_now = -1;
int hover_buttons = -1;
for (int i = offset; i < tabs.size(); i++) {
@@ -684,7 +684,7 @@ void TabBar::_update_hover() {
emit_signal(SNAME("tab_hovered"), hover);
}
- if (hover_buttons == -1) { // no hover
+ if (hover_buttons == -1) { // No hover.
rb_hover = hover_buttons;
cb_hover = hover_buttons;
}
@@ -860,7 +860,7 @@ bool TabBar::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
if (from_path == to_path) {
return true;
} else if (get_tabs_rearrange_group() != -1) {
- // drag and drop between other TabBars
+ // Drag and drop between other TabBars.
Node *from_node = get_node(from_path);
TabBar *from_tabs = Object::cast_to<TabBar>(from_node);
if (from_tabs && from_tabs->get_tabs_rearrange_group() == get_tabs_rearrange_group()) {
@@ -895,7 +895,7 @@ void TabBar::drop_data(const Point2 &p_point, const Variant &p_data) {
emit_signal(SNAME("active_tab_rearranged"), hover_now);
set_current_tab(hover_now);
} else if (get_tabs_rearrange_group() != -1) {
- // drag and drop between Tabs
+ // Drag and drop between Tabs.
Node *from_node = get_node(from_path);
TabBar *from_tabs = Object::cast_to<TabBar>(from_node);
if (from_tabs && from_tabs->get_tabs_rearrange_group() == get_tabs_rearrange_group()) {