Comment 47 for bug 627195

Matthew Paul Thomas (mpt) wrote :

JaSauders, when a window opens or asks for focus, the window manager has to decide whether focusing it is a good idea.

If you choose an item in an indicator menu, wanting to see a particular window, obviously it should be focused, right? Well, no. For example, when I choose the date item in the clock menu, Evolution takes 31 seconds to launch and open its window. If I get bored and continue typing this comment in Firefox in the meantime, I don't want the Evolution window to be focused when it eventually opens, because that would mean some of my typing would go into the wrong window.

So, a window should be focused if you don't do anything -- or you aren't *about to* do anything -- between the time you ask for it and the time it opens. Simple enough, right? Well, no. Because the window manager usually doesn't know (A) exactly what action of yours -- if any -- caused the window to open in the first place, or (B) whether you are about to do something. (It can't see your finger getting ready to press a key, for example.) The fixes for this bug address (A), by including the timestamp of your menu selection with the request to launch a particular app. But sometimes that isn't possible, often it isn't supplied even when it is possible, and either way, that still doesn't address (B).

So the focus-prevention-level setting is a dial for how eager the window manager should be in granting focus requests. The higher it is, the more often you'll get focus sticking -- a window failing to take focus when you expect it to. But the lower it is, the more often you'll get focus stealing -- one window taking focus while you are trying to use another.