| @@ -1427,6 +1427,8 @@ public: | |||||
| void setVisible (bool shouldBeVisible) override | void setVisible (bool shouldBeVisible) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE); | ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE); | ||||
| if (shouldBeVisible) | if (shouldBeVisible) | ||||
| @@ -1468,6 +1470,8 @@ public: | |||||
| void setBounds (const Rectangle<int>& bounds, bool isNowFullScreen) override | void setBounds (const Rectangle<int>& bounds, bool isNowFullScreen) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| fullScreen = isNowFullScreen; | fullScreen = isNowFullScreen; | ||||
| auto newBounds = windowBorder.addedTo (bounds); | auto newBounds = windowBorder.addedTo (bounds); | ||||
| @@ -1534,6 +1538,8 @@ public: | |||||
| void setAlpha (float newAlpha) override | void setAlpha (float newAlpha) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| auto intAlpha = (uint8) jlimit (0, 255, (int) (newAlpha * 255.0f)); | auto intAlpha = (uint8) jlimit (0, 255, (int) (newAlpha * 255.0f)); | ||||
| if (component.isOpaque()) | if (component.isOpaque()) | ||||
| @@ -1558,6 +1564,8 @@ public: | |||||
| void setMinimised (bool shouldBeMinimised) override | void setMinimised (bool shouldBeMinimised) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| if (shouldBeMinimised != isMinimised()) | if (shouldBeMinimised != isMinimised()) | ||||
| ShowWindow (hwnd, shouldBeMinimised ? SW_MINIMIZE : SW_SHOWNORMAL); | ShowWindow (hwnd, shouldBeMinimised ? SW_MINIMIZE : SW_SHOWNORMAL); | ||||
| } | } | ||||
| @@ -1573,6 +1581,8 @@ public: | |||||
| void setFullScreen (bool shouldBeFullScreen) override | void setFullScreen (bool shouldBeFullScreen) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| setMinimised (false); | setMinimised (false); | ||||
| if (isFullScreen() != shouldBeFullScreen) | if (isFullScreen() != shouldBeFullScreen) | ||||
| @@ -1656,6 +1666,8 @@ public: | |||||
| void toFront (bool makeActive) override | void toFront (bool makeActive) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| setMinimised (false); | setMinimised (false); | ||||
| const bool oldDeactivate = shouldDeactivateTitleBar; | const bool oldDeactivate = shouldDeactivateTitleBar; | ||||
| @@ -1674,6 +1686,8 @@ public: | |||||
| void toBehind (ComponentPeer* other) override | void toBehind (ComponentPeer* other) override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| if (auto* otherPeer = dynamic_cast<HWNDComponentPeer*> (other)) | if (auto* otherPeer = dynamic_cast<HWNDComponentPeer*> (other)) | ||||
| { | { | ||||
| setMinimised (false); | setMinimised (false); | ||||
| @@ -1698,6 +1712,8 @@ public: | |||||
| void grabFocus() override | void grabFocus() override | ||||
| { | { | ||||
| const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); | |||||
| const bool oldDeactivate = shouldDeactivateTitleBar; | const bool oldDeactivate = shouldDeactivateTitleBar; | ||||
| shouldDeactivateTitleBar = ((styleFlags & windowIsTemporary) == 0); | shouldDeactivateTitleBar = ((styleFlags & windowIsTemporary) == 0); | ||||
| @@ -4181,7 +4197,10 @@ private: | |||||
| void windowShouldDismissModals (HWND originator) | void windowShouldDismissModals (HWND originator) | ||||
| { | { | ||||
| if (component.isShowing() && isAncestor (originator, hwnd)) | |||||
| if (shouldIgnoreModalDismiss) | |||||
| return; | |||||
| if (isAncestor (originator, hwnd)) | |||||
| sendInputAttemptWhenModalMessage(); | sendInputAttemptWhenModalMessage(); | ||||
| } | } | ||||
| @@ -4249,6 +4268,7 @@ private: | |||||
| SharedResourcePointer<TopLevelModalDismissBroadcaster> modalDismissBroadcaster; | SharedResourcePointer<TopLevelModalDismissBroadcaster> modalDismissBroadcaster; | ||||
| IMEHandler imeHandler; | IMEHandler imeHandler; | ||||
| bool shouldIgnoreModalDismiss = false; | |||||
| //============================================================================== | //============================================================================== | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HWNDComponentPeer) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HWNDComponentPeer) | ||||