mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
HWNDComponentPeer: Avoid dismissing modals from peer-initiated messages
This commit is contained in:
parent
1124ec146d
commit
c19cd73306
1 changed files with 21 additions and 1 deletions
|
|
@ -1427,6 +1427,8 @@ public:
|
|||
|
||||
void setVisible (bool shouldBeVisible) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE);
|
||||
|
||||
if (shouldBeVisible)
|
||||
|
|
@ -1468,6 +1470,8 @@ public:
|
|||
|
||||
void setBounds (const Rectangle<int>& bounds, bool isNowFullScreen) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
fullScreen = isNowFullScreen;
|
||||
|
||||
auto newBounds = windowBorder.addedTo (bounds);
|
||||
|
|
@ -1534,6 +1538,8 @@ public:
|
|||
|
||||
void setAlpha (float newAlpha) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
auto intAlpha = (uint8) jlimit (0, 255, (int) (newAlpha * 255.0f));
|
||||
|
||||
if (component.isOpaque())
|
||||
|
|
@ -1558,6 +1564,8 @@ public:
|
|||
|
||||
void setMinimised (bool shouldBeMinimised) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
if (shouldBeMinimised != isMinimised())
|
||||
ShowWindow (hwnd, shouldBeMinimised ? SW_MINIMIZE : SW_SHOWNORMAL);
|
||||
}
|
||||
|
|
@ -1573,6 +1581,8 @@ public:
|
|||
|
||||
void setFullScreen (bool shouldBeFullScreen) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
setMinimised (false);
|
||||
|
||||
if (isFullScreen() != shouldBeFullScreen)
|
||||
|
|
@ -1656,6 +1666,8 @@ public:
|
|||
|
||||
void toFront (bool makeActive) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
setMinimised (false);
|
||||
|
||||
const bool oldDeactivate = shouldDeactivateTitleBar;
|
||||
|
|
@ -1674,6 +1686,8 @@ public:
|
|||
|
||||
void toBehind (ComponentPeer* other) override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
if (auto* otherPeer = dynamic_cast<HWNDComponentPeer*> (other))
|
||||
{
|
||||
setMinimised (false);
|
||||
|
|
@ -1698,6 +1712,8 @@ public:
|
|||
|
||||
void grabFocus() override
|
||||
{
|
||||
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);
|
||||
|
||||
const bool oldDeactivate = shouldDeactivateTitleBar;
|
||||
shouldDeactivateTitleBar = ((styleFlags & windowIsTemporary) == 0);
|
||||
|
||||
|
|
@ -4181,7 +4197,10 @@ private:
|
|||
|
||||
void windowShouldDismissModals (HWND originator)
|
||||
{
|
||||
if (component.isShowing() && isAncestor (originator, hwnd))
|
||||
if (shouldIgnoreModalDismiss)
|
||||
return;
|
||||
|
||||
if (isAncestor (originator, hwnd))
|
||||
sendInputAttemptWhenModalMessage();
|
||||
}
|
||||
|
||||
|
|
@ -4249,6 +4268,7 @@ private:
|
|||
|
||||
SharedResourcePointer<TopLevelModalDismissBroadcaster> modalDismissBroadcaster;
|
||||
IMEHandler imeHandler;
|
||||
bool shouldIgnoreModalDismiss = false;
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HWNDComponentPeer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue