mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-09 04:30:09 +00:00
macOS: Don't play alert sound if NSWindow is blocked by modal component in canBecomeKeyWindow() and canBecomeMainWindow()
This commit is contained in:
parent
7c031b0318
commit
efdccd8f1d
1 changed files with 10 additions and 4 deletions
|
|
@ -997,7 +997,7 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
bool sendModalInputAttemptIfBlocked()
|
||||
bool isBlockedByModalComponent()
|
||||
{
|
||||
if (auto* modal = Component::getCurrentlyModalComponent())
|
||||
{
|
||||
|
|
@ -1005,7 +1005,6 @@ public:
|
|||
&& (! getComponent().isParentOf (modal))
|
||||
&& getComponent().isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
modal->inputAttemptWhenModal();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1013,6 +1012,13 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
void sendModalInputAttemptIfBlocked()
|
||||
{
|
||||
if (isBlockedByModalComponent())
|
||||
if (auto* modal = Component::getCurrentlyModalComponent())
|
||||
modal->inputAttemptWhenModal();
|
||||
}
|
||||
|
||||
bool canBecomeKeyWindow()
|
||||
{
|
||||
return component.isVisible() && (getStyleFlags() & juce::ComponentPeer::windowIgnoresKeyPresses) == 0;
|
||||
|
|
@ -1988,7 +1994,7 @@ private:
|
|||
|
||||
return owner != nullptr
|
||||
&& owner->canBecomeKeyWindow()
|
||||
&& ! owner->sendModalInputAttemptIfBlocked();
|
||||
&& ! owner->isBlockedByModalComponent();
|
||||
}
|
||||
|
||||
static BOOL canBecomeMainWindow (id self, SEL)
|
||||
|
|
@ -1997,7 +2003,7 @@ private:
|
|||
|
||||
return owner != nullptr
|
||||
&& owner->canBecomeMainWindow()
|
||||
&& ! owner->sendModalInputAttemptIfBlocked();
|
||||
&& ! owner->isBlockedByModalComponent();
|
||||
}
|
||||
|
||||
static void becomeKeyWindow (id self, SEL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue