the NSViewComponentPeer::isFocused has some problems, when working with shared windows (isSharedWindow == true).
The “currentlyFocusedPeer” has a wrong value or is falsely a NULL pointer depending on the parent app.
bool NSViewComponentPeer::isFocused() const
return isSharedWindow ? this == currentlyFocusedPeer
: (window != 0 && [window isKeyWindow]);
I could only test this with two apps that use shared windows but its 100% reproducable:
As long as no AlertWindow was opened currentlyFocusedPeer inside NSViewComponentPeer::isFocused has the right value of the Peer that should actually be the currently focused peer.
After an AlertWindow was opened and closed again, the currentlyFocusedPeer will remain the adress of the AlertWindow and won’t be set correctly to the Peer that actually has focus untill the complete Peer is closed and a new one is created.
Logic 8 (maybe this has changed in Logic 9 but I don’t have it, so I can’t check):
currentlyFocusedPeer inside NSViewComponentPeer will only have the right adress of the shared window Peer until you click inside the window for the first time. After that, it will always be a NULL pointer. Note that as long as you only click the top bar of the window for example to move it, the Peer has the correct adress but even clicking in the area where presets and bypass and so on are located, will make the window lose the correct Peer.
I guess this is the reason why logic never gets any mouse enter/exit… events or focus callbacks after a click somewhere inside the window.
Something seems to be not correct when dealing with shared windows. I hope someone has an idea how to fix this or at least a hint where I could start trying to fix it myself.