fb64a5
From 5583843084fe8ce68e6e0072e2e85d79bbd8edb8 Mon Sep 17 00:00:00 2001
fb64a5
From: Carlos Soriano <csoriano@gnome.org>
fb64a5
Date: Wed, 8 Nov 2017 00:27:55 +0100
fb64a5
Subject: [PATCH] CascadeBG: Fix shortcuts not working after mouse click
fb64a5
fb64a5
The situation is that when a menu is clicked twice to open and close,
fb64a5
the shorcuts stop working.
fb64a5
fb64a5
This happens because when the mouse click to close the pop menu finishes,
fb64a5
it starts a drag. When a drag is started, the bit "wasposted" is set to
fb64a5
prevent the menu from being messed with.
fb64a5
fb64a5
When the user clicks again with the mouse, this bit is unset and all is
fb64a5
fine.
fb64a5
fb64a5
However, when using the keyboard this was not unset and when trying to
fb64a5
select the menu it realized it was in a drag and instead of opening it
fb64a5
was closing it, effectively preventing to use the shortcuts closing the
fb64a5
menu while trying to opening it.
fb64a5
fb64a5
There are three possibilities:
fb64a5
1- Don't start a drag when the pop menu is dismissed
fb64a5
2- Unset the bit before selecting the menu when arming
fb64a5
3- Not disarming the menu when the "wasposted" bit is on
fb64a5
fb64a5
This patch goes with the option 2.
fb64a5
---
fb64a5
 lib/Xm/CascadeBG.c | 4 ++++
fb64a5
 1 file changed, 4 insertions(+)
fb64a5
fb64a5
diff --git a/lib/Xm/CascadeBG.c b/lib/Xm/CascadeBG.c
fb64a5
index 720cb732..c08c88d3 100644
fb64a5
--- a/lib/Xm/CascadeBG.c
fb64a5
+++ b/lib/Xm/CascadeBG.c
fb64a5
@@ -1394,6 +1394,10 @@ ArmAndActivate(
fb64a5
 	  else
fb64a5
 	     menuSTrait -> menuBarCleanup((Widget) parent);
fb64a5
 
fb64a5
+      /* if we are arming and activating doesn't make sense to have the menu bar
fb64a5
+       * as posted, so clean the state in case we initiated a drag in the last
fb64a5
+       * mouse click event */
fb64a5
+      CBG_SetWasPosted(cb, FALSE);
fb64a5
 	  /* do the select without calling the cascading callbacks again */
fb64a5
 	  Select (cb, event, FALSE);
fb64a5
 
fb64a5
-- 
fb64a5
2.14.3
fb64a5