summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-08-29 13:29:28 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-08-29 13:43:06 +0300
commitab67543e09568368b41faf3510841a1dd48b993f (patch)
tree079ba1559f9c0ef020f7bd43e109bf863c1e1eaa
parent1d3bb054b2f69f3af5ba49f0cf5ff8c7ac72f625 (diff)
Toolbar popups need explicit deactivation
... if based on MenuBarManager, because unlike context menus, we reuse the same menu instead of creating from scratch each time, so that it suffers from the same "double activation" problem as in tdf#97665. Note that for GtkSalMenu the problem is only for the top level popup menu, as the Deactivate callback is properly called when sub menus are closed. The non-native case also had this problem, but only when closing the menu by selecting one of its items, and was fixed already in b41deb2ef057c3bd43fa61448bb4d7299138c8d4. Change-Id: Iee037f7baba0f80c32fb3a45f16511f8585c203e
-rw-r--r--framework/source/uielement/menubarmanager.cxx4
-rw-r--r--vcl/osx/salnsmenu.mm1
-rw-r--r--vcl/unx/gtk/gtksalmenu.cxx2
3 files changed, 5 insertions, 2 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 560db8086fd7..6379451cfc84 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1026,8 +1026,8 @@ IMPL_LINK_TYPED( MenuBarManager, Select, Menu *, pMenu, bool )
}
if ( !m_bHasMenuBar )
- // Standalone popup menu doesn't fire deactivate event in this case,
- // so we have to reset the active flag here.
+ // Standalone (non-native) popup menu doesn't fire deactivate event
+ // in this case, so we have to reset the active flag here.
m_bActive = false;
return true;
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index cd22b7865592..be772f92b0cb 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -58,6 +58,7 @@
else if( mpMenu->mpVCLMenu )
{
mpMenu->mpVCLMenu->Activate();
+ mpMenu->mpVCLMenu->Deactivate();
// Hide disabled items
NSArray* elements = [pMenu itemArray];
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 75c19c3e943b..8856410448fe 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -399,6 +399,8 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const Rectangle& rRec
}
g_main_loop_unref(pLoop);
+ mpVCLMenu->Deactivate();
+
gtk_widget_insert_action_group(mpFrame->getMouseEventWidget(), "win", nullptr);
gtk_widget_destroy(pWidget);