Description of problem: I start a program, for example mozilla by clicking on its panel icon. As it takes several seconds to start/appear, I go to type in another already existing window. In the middle of my typing , the mozilla window appears and the last part of my typing goes to the mozilla windows, instead of the other window. My typed chars are aither lost, or worse trigger some unwanted function in mozilla. ( Think deleteing some chars in an editor and a file manager window pops up and deletes some file of yours. ) Version-Release number of selected component (if applicable): metacity-2.4.34-3 How reproducible: Steps to Reproduce: 1. start any graphical program that takes a while to appear 2. go use some other window 3. Actual results: The new window appears and takes focus Expected results: Focus should stay with the window the user is using. Additional info:
This is especially bad in the following situation: 0) run some IM program like gaim 1) start typing password into terminal window 2) someone writes you a message. their window steals the focus 3) you finish typing your password in the chat window and send it to them.
There's a reasonably general solution here using startup notification; it's only going to work with GTK/Qt apps that use the new startup notification stuff though. This should fix Mozilla. For GAIM though, GAIM should be fixed, it's about that simple.
kwin has some work in this area, see http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebase/kwin/workspace.cpp?rev=1.398.2.59&content-type=text/x-cvsweb-markup&only_with_tag=kwin_iii Search for "Prevention of focus stealing"
Yes, KWin work is the startup notification based stuff I'm talking about.
I thought the simple solution is "the window manager should not change focus, unless the user requests it"
95% of the time if someone chooses a menu item or button that opens a new window, they intend to immediately use said window. So the default should be to focus the window - the user has requested to use that window. Which is why Windows, Mac Classic, Mac OS X, etc. all have this default.
For menus, yes, that is normal, but if a pre-existing window suddenly decides to jump in my face, that is different. It should not steal focus. The difference in this two cases is obvious and should not be hard to implement either. Same thing for newly created windows. They should appear in the background, or wait until the user "approves" their apperance or whatever. Just don't let them steal the focus.
The WM can keep existing windows from raising themselves, but that breaks a lot of apps that have legitimate reasons to do that. Not all windows in X are what you think of as windows - tooltips, popup menus, etc. are also windows. Metacity originally did not allow apps to raise windows and it broke various apps. You just need to file bugs against those apps that do things wrongly, because to allow the legitimate uses the WM must allow the illegitimate ones also. New windows are just what I'm talking about with the 95%. People should not have to explicitly focus new windows, because they almost always want them focused. So the computer should just do that. For the cases where you opened the window but aren't planning to use it, it's simple enough to move the focus back. Anyway, duplicate of http://bugzilla.gnome.org/show_bug.cgi?id=82921