From d931ebb61c3702aeeb445d3c0a29a87411a1d60a Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 10 Apr 2019 00:41:04 +0800 Subject: [PATCH] filter out the middle and right button for item selection(#413) --- source/gui/widgets/combox.cpp | 7 +++++-- source/gui/widgets/tabbar.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/gui/widgets/combox.cpp b/source/gui/widgets/combox.cpp index 619446a2..6e949def 100644 --- a/source/gui/widgets/combox.cpp +++ b/source/gui/widgets/combox.cpp @@ -1,7 +1,7 @@ /* * A Combox Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -676,7 +676,10 @@ namespace nana { auto * editor = drawer_->editor(); editor->mouse_pressed(arg); - drawer_->open_lister_if_push_button_positioned(); + + //Pops up the droplist only if left button is clicked + if(arg.is_left_button()) + drawer_->open_lister_if_push_button_positioned(); drawer_->draw(); if(editor->attr().editable) diff --git a/source/gui/widgets/tabbar.cpp b/source/gui/widgets/tabbar.cpp index cf58e0f6..3cbe921d 100644 --- a/source/gui/widgets/tabbar.cpp +++ b/source/gui/widgets/tabbar.cpp @@ -1,6 +1,6 @@ /* * A Tabbar Implementation - * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -1291,7 +1291,8 @@ namespace nana void trigger::mouse_down(graph_reference, const arg_mouse& arg) { - if(layouter_->press()) + //Activates the tab only if left button is clicked. + if(arg.is_left_button() && layouter_->press()) { if(false == layouter_->active_by_trace(arg)) layouter_->toolbox_answer(arg); @@ -1593,10 +1594,10 @@ namespace nana API::dev::lazy_refresh(); } - void driver::mouse_down(graph_reference graph, const arg_mouse&) + void driver::mouse_down(graph_reference graph, const arg_mouse& arg) { auto & indexes = model_->get_indexes(); - if ((indexes.hovered_pos == model_->npos) || (indexes.active_pos == indexes.hovered_pos)) + if ((indexes.hovered_pos == model_->npos) || (indexes.active_pos == indexes.hovered_pos) || !arg.is_left_button()) return; if (indexes.active_pos != indexes.hovered_pos)