From 92cf12ea025dfda642809d297a015131c1925052 Mon Sep 17 00:00:00 2001
From: Caolán McNamara <caolanm@redhat.com>
Date: Sat, 22 Jun 2019 20:34:06 +0100
Subject: tdf#125803 deactivate the menu regardless of menu item type
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

spacebar will toggle radios and checkbuttons without automatically
closing the menu. To handle this properly I imagine we need to set groups for the
radiobuttons so the others visually untoggle when the active one is togged and
we would further need to teach vcl that the state can change more than once.

so simpler to just dropdown the menus no matter what type was activated,
which won't happen in the unity case, but that's presumably mostly gone
by now(?)

Change-Id: I2ba841dd192c1461ef26d8395ba572843f4c5c4f
Reviewed-on: https://gerrit.libreoffice.org/74580
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
---
 vcl/unx/gtk/gtksalmenu.cxx | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'vcl/unx')

diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index e3d9dc85c087..0d149bf4b30c 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -1220,6 +1220,17 @@ void GtkSalMenu::DispatchCommand(const gchar *pCommand)
     MenuAndId aMenuAndId = decode_command(pCommand);
     GtkSalMenu* pSalSubMenu = aMenuAndId.first;
     GtkSalMenu* pTopLevel = pSalSubMenu->GetTopLevel();
+    if (pTopLevel->mpMenuBarWidget)
+    {
+        // tdf#125803 spacebar will toggle radios and checkbuttons without automatically
+        // closing the menu. To handle this properly I imagine we need to set groups for the
+        // radiobuttons so the others visually untoggle when the active one is togged and
+        // we would further need to teach vcl that the state can change more than once.
+        //
+        // or we could unconditonally deactivate the menus if regardless of what particular
+        // type of menu item got activated
+        gtk_menu_shell_deactivate(GTK_MENU_SHELL(pTopLevel->mpMenuBarWidget));
+    }
     pTopLevel->GetMenu()->HandleMenuCommandEvent(pSalSubMenu->GetMenu(), aMenuAndId.second);
 }
 
-- 
cgit