Is it impossible to know when your plugin is brought to the front or gains focus?

There is a thread here. Can be reproduced with the juce demo runner: Repaint issue with JUCE_COREGRAPHICS_DRAW_ASYNC=1