From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021218 Description of problem: Even though `focus follows mouse' is enabled, after a workspace switch, the window that gets the focus may not be the one that the mouse pointer is in. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Open two non- or partially-overlapping windows, say A and B, on the same workspace 2.Click on window A to bring it to the front 3.Switch to another workspace. 4.Move the mouse such that the pointer will point to window B 5.Switch back to the original workspace Actual Results: Window A gets the focus, even though the mouse is on window B. Expected Results: Since focus is set to follow the mouse, it should. It did on 8.0. Additional info: Not having the option to bring windows with focus to the front makes this misbehavior far more visible.
Upstream as http://bugzilla.gnome.org/show_bug.cgi?id=103335
I tracked this down, it's pretty simple; the EnterNotify when the workspace switch completes is ignored because when doing Alt+Tab we want to ignore EnterNotify caused by the little popup thingy, so the same code applies here. But it probably should not apply here. Since the EnterNotify does not focus the window the mouse pointer ends up in, the top window ends up focused as switching spaces focuses top window. Basically, mouse focus breaks keyboard navigation, because keynav does not move the mouse pointer, so there's a nest of hacks for ignoring the mouse pointer in specific cases (breaking the pointer location == focus location invariant), and it's a little bit fragile. There are various possible fixes, just have to put one in.
Thanks for the investigation. I suppose moving the mouse pointer on Alt-TAB is not an option? Say, to the center of the title of the window? I can see that some people might prefer otherwise, but if it's to preserve an invariant, it might be worth it.
Fixed.
I would really prefer (an option at least) that when returning to a workspace the window that last had focus there be given it back. Do people really think, "Ah I want to use the terminal in the top left corner on desktop1 now so better move the cursor there before switching over.."? I sure don't, but maybe it's just me?
If you don't have focus-follows-mouse enabled, I see that your suggestion makes a lot of sense. But if focus is supposed to follow the mouse, having the focus on a window that doesn't have the mouse on it after switching desktops doesn't feel like the right approach.