Bug 80412 - focus doesn't follow mouse pointer after workspace switch
Summary: focus doesn't follow mouse pointer after workspace switch
Alias: None
Product: Red Hat Public Beta
Classification: Retired
Component: metacity
Version: phoebe
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Havoc Pennington
QA Contact:
Depends On:
Blocks: 79579
TreeView+ depends on / blocked
Reported: 2002-12-26 00:37 UTC by Alexandre Oliva
Modified: 2007-04-18 16:49 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-02-19 04:55:58 UTC

Attachments (Terms of Use)

Description Alexandre Oliva 2002-12-26 00:37:58 UTC
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:

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

Additional info:

Not having the option to bring windows with focus to the front makes this
misbehavior far more visible.

Comment 1 Havoc Pennington 2003-01-13 04:06:27 UTC
Upstream as http://bugzilla.gnome.org/show_bug.cgi?id=103335

Comment 5 Havoc Pennington 2003-01-14 04:01:34 UTC
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.

Comment 6 Alexandre Oliva 2003-01-14 06:00:05 UTC
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.

Comment 7 Alexandre Oliva 2003-02-19 04:55:58 UTC

Comment 8 Jens Petersen 2004-08-05 09:40:40 UTC
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?

Comment 9 Alexandre Oliva 2004-08-09 04:38:22 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.