Thanks for the elaboration.
As a "side bar" to your original questions, why is your login item running like this at all?
Mostly for historical reasons (the applications are pretty old, 10+ years, and underwent many changes meantime). We are considering a serious refactoring, but now we need to solve the problem quickly.
Interaction in your SA cause UI activity in your LI and, more importantly, your LI is attempting to activate your SA.
Quite. Unless/until we refactor, we simply have to, for clicking into the LI window must bring up the SA menu.
Which works well and completely reliably when the menu is not hidden.
When it is hidden though, for some weird reason the very menu bar which would normally be visible does not show when the pointer goes up. That's the problem we need to solve now.
When someone uses your app and another app unexpectedly steals focus...
... is not what happens here. In our case, the other app does not “steal” the focus and it is not unexpected. The focus is given to it willingly, it is as expected, and both the GUIs are written so that it works properly.
We never encountered any problem like accidentally entering text into the wrong app or so, and never we need to switch back to the original app: as mentioned above, both the applications are written to work like one from the user's perspective.
Our problem is quite different: while the SA is the menu owner and the menu is hidden, it (occasionally) does not show when the pointer goes up.
I strongly suspect that the issues you're seeing only happen when another app is involved in the activation process
Not really. The only involvement of another application is that it is active (both menu owner and frontmost) before the problem occurs.
not if you first activate your SA directly (for example, but clicking on the dock).
Quite, that's not our current problem. It happens when SA is activated through LI, as already outlined above:
another application is both menu owner and frontmost (which is the only involvement of any other application)
the LI's window title is clicked (seems that when the window content is clicked, the problem occasionally happens, but when the title bar is clicked, it always happens; weird)
this makes LI frontmost, but not menu owner (since it is a login item which does not mess with its presentation and thus can't have menu)
therefore, LI activates SA, so that it becomes the menu owner (note SA does not steal focus; LI gives it willingly)
then in the final step, SA activates LI to make its window the frontmost one (again, LI does not steal the focus; SA gives it willingly).
Now, LI is frontmost, SA is the menu owner. If menu is not hidden, the SA menu is at this moment shown properly. Alas, if the menu is hidden and at this moment the pointer goes up, nothing happens. What could we do to make sure that the SA menu occurs? Thanks.
Topic:
App & System Services
SubTopic:
General