summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-01 08:40:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-05 08:34:16 +0000
commitdfa23c4170a4a5a567fe48bac6682d1a556e77ba (patch)
tree1b8c407cb279e048b8c38e092c9d5de44cf7d7b3 /vcl/source
parenta198bd4789eaf40e8c042ab16fe93ea2d04dcb97 (diff)
fdo79368 Don't process overflow menu items twice.
We reuse the toolbox overflow menu for toolbarmanager's context menu -- toolbarmanger previously added its menu listener to the toolboxes menu permanently, meaning that it would try to handle overflow menu items (in addition to the context menu items which it should handle), instead we should only add the listener when we are actually using the menu as a context menu. Perhaps it would be better in the long run to actually use fully separate menus instead, and ask toolbox to specifically add its items to that rather than trying to hack the context menu on top of the overflow menu? Change-Id: Iecface2c6eae9ab79dbcdb25ffdbaf446e2885ea (cherry picked from commit 1ae89d189200c1e351a396a3f02612b84a69985f) Reviewed-on: https://gerrit.libreoffice.org/9602 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/toolbox2.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 608b27cd8c27..2fc6b4b500a3 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -2184,7 +2184,13 @@ void ToolBox::ImplExecuteCustomMenu()
// call button handler to allow for menu customization
mpData->maMenuButtonHdl.Call( this );
- // register handler
+ // We specifically only register this event listener when executing our
+ // overflow menu (and remove it directly afterwards), as the same menu
+ // is reused for both the overflow menu (as managed here in ToolBox),
+ // but also by ToolBarManager for its context menu. If we leave event
+ // listeners alive beyond when the menu is showing in the desired mode
+ // then duplicate events can happen as the context menu "duplicates"
+ // items from the overflow menu, which both listeners would then act on.
GetMenu()->AddEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
// make sure all disabled entries will be shown