Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 80412

Summary: focus doesn't follow mouse pointer after workspace switch
Product: [Retired] Red Hat Public Beta Reporter: Alexandre Oliva <aoliva>
Component: metacityAssignee: Havoc Pennington <hp>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: phoebeCC: notting, petersen, wtogami
Target Milestone: ---Keywords: MoveUpstream, Triaged
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-02-19 04:55:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 79579    

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

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.