It seems the CallOutBox no longer provides mouse over / move events to components if the CallOutBox or a child component does not have focus.
The effect is that if I show a CallOutBox and hover with the mouse over a button it does no longer change its appearance. After I click anywhere into the CallOutBox the mouse events are forwarded correctly and hovering starts working again.
Is this change in behaviour a bug?
Presumably this is on OSX?
Standard OSX behaviour is to not send mouse-move events to windows that aren't focused - the only reason that juce windows generally work differently is because I've got stuff internally that bodges this, but it can only work if another juce window is focused. You might just need to grab focus on your CalloutBox for it to work.
Yes I am working on OS X. Grabbing the focus does not work either.
In the Component I want to show I do now:
This is how I show the component and grab focus:
CallOutBox::launchAsynchronously(panel, sourceComponent->getScreenBounds(), nullptr);
Another glitch I just noticed. When I click the CalloutBox the 3 buttons on the top left go gray. I may be wrong but I thought the CallOutBox should behave as part of the main app window. The window should at least look as if it still has focus. At least thats how these CallOutBoxes work in other Mac apps. I can go back to a previous version of JUCE to double check if this behaviour has changed as well if you want.
Looking through recent JUCE changes I found the reason. Commit 3cc8406b3d7d3f488379282f8beee1168d479907 [3cc8406], "Workaround for mysterious OSX focus problem."
If I revert isFocused() in juce_mac_NSViewComponentPeer.mm back to the original one things start working again:
bool isFocused() const override
return isSharedWindow ? this == currentlyFocusedPeer
: [window isKeyWindow];
// return this == currentlyFocusedPeer;
Is it possible to find a different way to work around the mysterious OSX focus problem? I would imagine the current state is worse, because all buttons in CalloutBoxes have stopped responding to mouse hover changes.
The bug that it was fixing is explained here:
Are you running an app or a plugin?
Looking at the bug that it was fixing it may be that this is related:
Ok, try again now. (I've rolled the change back for apps but kept it for plugins)
Works like a charm. Thanks!