Window Focus

Yessir, thanks for linking that forum I didn’t see that one. This is a rabbit hole for sure.

Have you found any functions that work?
I feel like I’ve tested almost everything I can think of.

I found this code from this thread, some what effective.


        auto topComp = this->getTopLevelComponent();

        if (topComp != nullptr)
        {
            ComponentPeer* peer = topComp->getPeer();
            if (peer)
            {
                const Point<float> point = peer->localToGlobal (Point<float>());

                if (point != previousPoint)
                {
                    grabKeyboardFocus();
                    previousPoint = point;
                    DBG("changed");
                }

             
            }
        }


            if(this->getTopLevelComponent()->hasKeyboardFocus(true)){
                std::cout << "focus gained by " + juce::String((int)localID) << std::endl;
            }else{
                std::cout << "focus lost by " + juce::String((int)localID) << std::endl;
            }