From 782900720ce5450acc0ae8fec7c08fe6c5339985 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 1 Feb 2026 11:31:42 +0100 Subject: [PATCH] GUITable: Prevent scrollbar from passing down events Events are generally forwarded to the parent. In this case, this is undesired. This commit makes the behaviour consistent with 'GUIEditBoxWithScrollBar'. --- src/gui/guiTable.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/gui/guiTable.cpp b/src/gui/guiTable.cpp index aa11df316..2eddc0122 100644 --- a/src/gui/guiTable.cpp +++ b/src/gui/guiTable.cpp @@ -43,12 +43,11 @@ GUITable::GUITable(gui::IGUIEnvironment *env, } const s32 s = skin->getSize(gui::EGDS_SCROLLBAR_SIZE); - m_scrollbar = new GUIScrollBar(Environment, this, -1, - core::rect(RelativeRect.getWidth() - s, - 0, - RelativeRect.getWidth(), - RelativeRect.getHeight()), - false, true, tsrc); + core::rect scrollbarrect = RelativeRect; + scrollbarrect.UpperLeftCorner.X += RelativeRect.getWidth() - s; + + m_scrollbar = new GUIScrollBar(Environment, getParent(), -1, + scrollbarrect, false, true, tsrc); m_scrollbar->setSubElement(true); m_scrollbar->setTabStop(false); m_scrollbar->setAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_LOWERRIGHT, @@ -889,14 +888,6 @@ bool GUITable::OnEvent(const SEvent &event) // Update tooltip setToolTipText(cell ? m_strings[cell->tooltip_index].c_str() : L""); - // Fix for #1567/#1806: - // GUIScrollBar passes double click events to its parent, - // which we don't want. Detect this case and discard the event - if (event.MouseInput.Event != EMIE_MOUSE_MOVED && - m_scrollbar->isVisible() && - m_scrollbar->isPointInside(p)) - return true; - if (event.MouseInput.isLeftPressed() && (isPointInside(p) || event.MouseInput.Event == EMIE_MOUSE_MOVED)) { -- 2.47.3