mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-20 01:14:20 +00:00
PopupMenu: Use DPI awareness of target component when creating new windows
Also updates the drop shadower so that the DPI-awareness of the shadows matches the DPI-awareness of the shadowed component.
This commit is contained in:
parent
858aab823a
commit
4bfcb78809
2 changed files with 22 additions and 0 deletions
|
|
@ -2017,6 +2017,17 @@ PopupMenu::Options PopupMenu::Options::withInitiallySelectedItem (int idOfItemTo
|
|||
Component* PopupMenu::createWindow (const Options& options,
|
||||
ApplicationCommandManager** managerOfChosenCommand) const
|
||||
{
|
||||
#if JUCE_WINDOWS
|
||||
const auto scope = [&]() -> std::unique_ptr<ScopedThreadDPIAwarenessSetter>
|
||||
{
|
||||
if (auto* target = options.getTargetComponent())
|
||||
if (auto* handle = target->getWindowHandle())
|
||||
return std::make_unique<ScopedThreadDPIAwarenessSetter> (handle);
|
||||
|
||||
return nullptr;
|
||||
}();
|
||||
#endif
|
||||
|
||||
return items.isEmpty() ? nullptr
|
||||
: new HelperClasses::MenuWindow (*this, nullptr, options,
|
||||
! options.getTargetScreenArea().isEmpty(),
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@ public:
|
|||
|
||||
if (comp->isOnDesktop())
|
||||
{
|
||||
#if JUCE_WINDOWS
|
||||
const auto scope = [&]() -> std::unique_ptr<ScopedThreadDPIAwarenessSetter>
|
||||
{
|
||||
if (comp != nullptr)
|
||||
if (auto* handle = comp->getWindowHandle())
|
||||
return std::make_unique<ScopedThreadDPIAwarenessSetter> (handle);
|
||||
|
||||
return nullptr;
|
||||
}();
|
||||
#endif
|
||||
|
||||
setSize (1, 1); // to keep the OS happy by not having zero-size windows
|
||||
addToDesktop (ComponentPeer::windowIgnoresMouseClicks
|
||||
| ComponentPeer::windowIsTemporary
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue