IDEA stealing focus after compilation

When I compile, say using Ctrl+F9, and then move to another application,
my IDEA Windows goes to the top and steals focus back when the
compilation is over. This has been the behavior for quite some time. I
searched but didn't find a bug associated with this. Is this a feature,
IDEA bug, or JRE bug? I could actually consider this a feature if I
could control it such that the focus is snatched back only when
compilation encounters an error. What do others think of the current
behavior and whether it needs improvement?


P.S. I'm on WindowsXP and build #695.

Comment actions Permalink

I hate this behaviour.

Something similar has been raised before a couple of times in the tracker but they always close it with "Do Not Fix".

For me, it's worse on startup. It takes so long to start up I switch to my email or whatever to do some work. 30 seconds later while I'm in the middle of typing something IDEA finally starts up and steals the focus back.

Maybe there's a good reason they say "Do Not Fix", who knows. If they could have said why, e.g. it's a JRE bug or is for a good reason I'd probably stop bleating on about it.

See 9356, 8181.

Comment actions Permalink

They probably always label this issue a "Do Not Fix" because it is primarily an OS issue. Ultimately, the question is, "Is it ever appropriate for an application to steal focus from what you are doing?" From both a usability and security standpoint (yes, security, as anyone who has witnessed an instant messenger popup right when you are about to type a password can attest to) I think the answer is NO. In that vein, download TweakUI for the version of Windows you are using. I believe in both the Win2K & XP version there is a setting on the "General" tab:

"Prevent applications from stealing focus"

Check that box. And then configure below as you see fit.



Tweak UI for XP:

Tweak UI for Windows 2000, NT, ME, 98, 95:

Comment actions Permalink

Do you know how to achieve the same result under Linux?

Is it really an OS issue? I haven't used Windows for ages but say for example you background-print a large document in MS Word and switch to another app while it's generating the print job, does Word steal the focus back when the spooling is complete?

I thought the way it behaved was that if your application is running in the background, it would only steal the focus if it displayed a dialog box. If you're just updating a pane that's embedded in your own application it wouldn't/shouldn't steal the focus.

It sounds like a really minor, picky, issue but it's really very frustrating (for me at least).

Comment actions Permalink

No, I do not know how to accomplish that under Linux. I stopped using that OS years ago, but I believe a feature like that would be totally up to the window manager. According to the following changelog for KDE, there is a new feature to resolve this problem: "KWin: smart mechanism that avoids focus stealing from windows the user is active on by windows that pop-up (M. Ettrich)"

As for Windows, when you use the TweakUI fix I mentioned, apps will not ever popup and steal focus from what you are doing, whether or not they are displaying a dialog.


Comment actions Permalink

Well, I hate this problem, too.

If I remember correctly, it is caused by AWT (on Windows NT). IDEA
shows a modal progress dialog. If this dialog is closed, AWT brings
the main window on top. The only possibility I see is, that IDEA does
not close the modal progress dialog, if it lost the focus (or
active-window state), unless it is activated again.



Please sign in to leave a comment.