mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
PopupMenu: Avoid dismissing PopupMenus in bridged plugin editors
When bridging 32-bit/64-bit plugins on Windows, the plugin is hosted in an auxilliary process, and the plugin's editor is embedded into an HWND owned by a different process (the plugin host). Previously, the `isForegroundProcess` check would fail for bridged plugins, because the foreground window may belong to the DAW, rather than to the auxilliary hosting process. This patch adds an additional check, to find whether the same process owns both the foreground window, and the window which embeds the PopupMenu's target component. In this case, we avoid immediately dismissing the PopupMenu.
This commit is contained in:
parent
550127945d
commit
1ee106d730
7 changed files with 52 additions and 15 deletions
|
|
@ -263,15 +263,17 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
|
|||
}
|
||||
}
|
||||
|
||||
if (c == nullptr && Process::isForegroundProcess())
|
||||
if (c == nullptr)
|
||||
{
|
||||
auto& desktop = Desktop::getInstance();
|
||||
|
||||
// getting a bit desperate now: try all desktop comps..
|
||||
for (int i = desktop.getNumComponents(); --i >= 0;)
|
||||
if (auto* peer = desktop.getComponent(i)->getPeer())
|
||||
if (auto* target = findTargetForComponent (peer->getLastFocusedSubcomponent()))
|
||||
return target;
|
||||
if (auto* component = desktop.getComponent (i))
|
||||
if (isForegroundOrEmbeddedProcess (component))
|
||||
if (auto* peer = component->getPeer())
|
||||
if (auto* target = findTargetForComponent (peer->getLastFocusedSubcomponent()))
|
||||
return target;
|
||||
}
|
||||
|
||||
if (c != nullptr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue