mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
PopupMenu: Always attach a global mouse listener
This makes behaviour more consistent between the parented and non-parented display modes. Before this change, parented popup menus wouldn't respond to mouse clicks until the mouse was released once, which meant that clicking and dragging the mouse over a menu wouldn't trigger a menu item on mouse-up.
This commit is contained in:
parent
b0d7bad5ee
commit
51b0319342
1 changed files with 5 additions and 2 deletions
|
|
@ -375,10 +375,13 @@ struct MenuWindow final : public Component
|
|||
addToDesktop (ComponentPeer::windowIsTemporary
|
||||
| ComponentPeer::windowIgnoresKeyPresses
|
||||
| lf.getMenuWindowFlags());
|
||||
|
||||
Desktop::getInstance().addGlobalMouseListener (this);
|
||||
}
|
||||
|
||||
// Using a global mouse listener means that we get notifications about all mouse events.
|
||||
// Without this, drags that are started on a button that displays a menu won't reach the
|
||||
// menu, because they *only* target the component that initiated the drag interaction.
|
||||
Desktop::getInstance().addGlobalMouseListener (this);
|
||||
|
||||
if (options.getParentComponent() == nullptr && parentWindow == nullptr && lf.shouldPopupMenuScaleWithTargetComponent (options))
|
||||
if (auto* targetComponent = options.getTargetComponent())
|
||||
scaleFactor = Component::getApproximateScaleFactorForComponent (targetComponent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue