[FR] Check hidden ancestors in macOS implementation of ComponentPeer::isShowing()

ComponentPeer::isShowing() doesn’t include the “isHiddenOrHasHiddenAncestor” check on the macOS implementation, so the component may return as visible but be hidden because of a hidden ancestor.

A change is needed at juce_NSViewComponentPeer_mac.mm:

(not sure if the argument const bool checkHiddenAncestors = false is necessary, only if you need this to be fully backwards compatible)

bool isShowing (const bool checkHiddenAncestors = false) const override
{
    if (! [window isVisible] || isMinimised())
        return false;

    return ! checkHiddenAncestors || ! [view isHiddenOrHasHiddenAncestor];
}

instead of the current:

bool isShowing() const override
{
    return [window isVisible] && ! isMinimised();
}

For context of where this would be needed, see: https://forum.juce.com/t/maschine-3-unconventional-path-to-re-open-a-vst3-plugin-ui/69474

1 Like