mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
PopupMenu: Avoid dismissing menu in response to mouse events over the menu
In cases where no JUCE component had keyboard focus, clicking a menu item would cause the menu to be dismissed instead of triggering the item's action.
This commit is contained in:
parent
a7563b5e91
commit
081b1ff216
1 changed files with 5 additions and 4 deletions
|
|
@ -1407,7 +1407,9 @@ private:
|
|||
&& (ModifierKeys::currentModifiers.isAnyMouseButtonDown()
|
||||
|| ComponentPeer::getCurrentModifiersRealtime().isAnyMouseButtonDown());
|
||||
|
||||
if (! window.doesAnyJuceCompHaveFocus())
|
||||
const auto reallyContained = window.reallyContains (localMousePos, true);
|
||||
|
||||
if (! window.doesAnyJuceCompHaveFocus() && ! reallyContained)
|
||||
{
|
||||
if (timeNow > window.lastFocusedTime + 10)
|
||||
{
|
||||
|
|
@ -1416,10 +1418,9 @@ private:
|
|||
// Note: This object may have been deleted by the previous call.
|
||||
}
|
||||
}
|
||||
else if (wasDown && timeNow > window.windowCreationTime + 250
|
||||
&& ! (isDown || overScrollArea))
|
||||
else if (wasDown && timeNow > window.windowCreationTime + 250 && ! isDown && ! overScrollArea)
|
||||
{
|
||||
if (window.reallyContains (localMousePos, true))
|
||||
if (reallyContained)
|
||||
window.triggerCurrentlyHighlightedItem();
|
||||
else if ((window.hasBeenOver || ! window.dismissOnMouseUp) && ! isOverAny)
|
||||
window.dismissMenu (nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue