From eb60a4c3e7c724d8a5ec2b4ca04403fb8105a5e3 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 24 Apr 2015 19:29:57 -0300 Subject: [PATCH] Tabs: disable mouse wheel when we are dragging tabs --- src/app/ui/tabs.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/app/ui/tabs.cpp b/src/app/ui/tabs.cpp index c0ba3559d..2effaf8e1 100644 --- a/src/app/ui/tabs.cpp +++ b/src/app/ui/tabs.cpp @@ -420,22 +420,24 @@ bool Tabs::onProcessMessage(Message* msg) } return true; - case kMouseWheelMessage: { - int dz = - (static_cast(msg)->wheelDelta().x + - static_cast(msg)->wheelDelta().y); + case kMouseWheelMessage: + if (!m_isDragging) { + int dz = + (static_cast(msg)->wheelDelta().x + + static_cast(msg)->wheelDelta().y); - auto it = std::find(m_list.begin(), m_list.end(), m_selected); - if (it != m_list.end()) { - int index = (it - m_list.begin()); - int newIndex = index + dz; - newIndex = MID(0, newIndex, int(m_list.size())-1); - if (newIndex != index) { - selectTabInternal(m_list[newIndex]); + auto it = std::find(m_list.begin(), m_list.end(), m_selected); + if (it != m_list.end()) { + int index = (it - m_list.begin()); + int newIndex = index + dz; + newIndex = MID(0, newIndex, int(m_list.size())-1); + if (newIndex != index) { + selectTabInternal(m_list[newIndex]); + } } + return true; } - return true; - } + break; case kKeyDownMessage: case kKeyUpMessage: {