Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 80412 - focus doesn't follow mouse pointer after workspace switch
focus doesn't follow mouse pointer after workspace switch
Product: Red Hat Public Beta
Classification: Retired
Component: metacity (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Havoc Pennington
: MoveUpstream, Triaged
Depends On:
Blocks: 79579
  Show dependency treegraph
Reported: 2002-12-25 19:37 EST by Alexandre Oliva
Modified: 2007-04-18 12:49 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-02-18 23:55:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alexandre Oliva 2002-12-25 19:37:58 EST
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-12 23:06:27 EST
Upstream as http://bugzilla.gnome.org/show_bug.cgi?id=103335
Comment 5 Havoc Pennington 2003-01-13 23:01:34 EST
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 01:00:05 EST
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-18 23:55:58 EST
Comment 8 Jens Petersen 2004-08-05 05:40:40 EDT
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 00:38:22 EDT
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.