When using your Macintosh the foremost window may periodically lose focus, which can be frustrating when you are typing or otherwise providing input to a window. This usually happens because another window is demanding your attention via an alert or dialogue box.
Many applications will implement the bouncing dock icon as a way to alert you about something, but others may not do this and instead bring the whole application to the front. In addition, beyond alerts, there are times when launching applications will continually steal focus as windows are generated and activated for that program.
Some people have wondered whether there is a way to disable this, or otherwise permanently lock a window to the foreground.
Apple discussion poster "AdamD.I.Kramer" writes:
"I have a simple desire: I never want any application to steal focus from the current application without me explicitly clicking on that application. IF I'm working in one app, I don't want any other app to bring itself to the front...ever. Put differently, I want to kill makeKey unless the application already has keyboard focus."
Unfortunately, there are no ways to implement this sort of window lock. The Mac OS X GUI has options for floating and persistent windows, which can be implemented by programmers for various uses, but unless a program implements an option to toggle a window into this mode there are no ways to specify which windows are to remain on top.
The best way to reduce the prevalence of windows losing focus is to know what processes are stealing focus, and end them. Applications in the middle of launching will always steal focus, but some applications that contain alerts in particular are known to keep removing focus from other windows as long as they are active.
The biggest offender that I can think of is iCal. iCal keeps alerts alive until they are manually closed, and as long as an iCal alert is active it will periodically switch focus to itself. I like keeping iCal alerts open for a while to remind myself about an upcoming event, but doing this will burden me with this focus-switching behavior.
In addition to iCal, there are a variety of other applications that will output persistent windows as well, so check which ones you have running to see if they contain alert windows. Possible culprits can be Growl notifications, third-party firewalls, or any system monitors that you might have running in the OS X menu bar.