LWN.net Logo

Advertisement

The developers' conference: Userspace, kernelspace, and Xspace

Advertise here

Focus stealing

Posted Aug 22, 2005 5:03 UTC (Mon) by EricBackus (guest, #2816)
In reply to: Focus stealing by newren
Parent article: GNOME and the way forward

newren wrote:
> Okay, you reiterated that you want the window under the pointer to
> always have focus. But then you went and stated two exceptions.

Actually, I see only one exception in Jon's response--an application
grabbing the mouse. And I think both he and you acknowledged that there's
nothing for the window manager to do in this case anyway.

I'm not a Gnome user, so maybe my opinions on this are not very important.
For what it's worth, I use KDE set to "Focus Follows Mouse", which DOES
give the focus to new windows. But there is an alternative setting "Focus
Under Mouse" which sounds like it does exactly what Jon is asking for.

In response to your questions, I can provide my own answers:

* The window list on the taskbar, like many things on the taskbar, is a
special case. I'd expect having the mouse over the taskbar to be much
like having the mouse over the background, so I don't see anything
contradictory about making a click on the window list switch window focus
just as though you briefly moved the mouse over the new application.

* Alt-tab or alt-esc could perhaps warp the pointer. If you don't warp
the pointer, perhaps you could merely top the selected application, but
leave focus wherever the mouse is. I don't use these so I don't really
have an opinion.

* I also don't use the keyboard to move applications between workspaces.
But if I did, and doing this puts the mouse over a different application,
it sure seems like it *should* give that application the focus.

But the above answers aside, I suspect that what Jon wants is simply to
have new applications NOT automatically get focus, while leaving
essentially everything else about window focus alone.


(Log in to post comments)

Focus stealing

Posted Aug 30, 2005 6:04 UTC (Tue) by newren (subscriber, #5160) [Link]

Sorry for the slow response...

> Actually, I see only one exception in Jon's response--an application
> grabbing the mouse.

The other was "If focus remains when the pointer goes onto the background, that's OK." There is always a window under the mouse, even if it's the background window (the thingy drawn by nautilus with the icons on it) or the root window when nothing like nautilus is running (the root window will be a concept most users are unaware of as it's kind of an x implementational detail though it is exposed to some extent in some environments so some users do know about it). Allowing a window to retain focus despite the mouse being over a different window, such as the nautilus background window or root window, is an exception to the "window under the pointer has the focus, always" rule. Some users may not realize that it's an exception, but that's kind of my point--there are likely other exceptions that the user doesn't know about or doesn't realize that they are exceptions. I want to know what the exceptions are and what aren't.

> But there is an alternative setting "Focus
> Under Mouse" which sounds like it does exactly what Jon is asking for.

It may be exactly what he's asking for, but that's what I'm trying to find out. Note that "Focus Under Mouse" in KWin destroys keynav (as claimed by KWin itself). That seems strange to me. It may actually be what users want, but I wanted to find out if perhaps something that doesn't focus new windows without destroying keynav might be more desirable. There's a number of other behaviors I need to get nailed down as well...

> * I also don't use the keyboard to move applications between workspaces.
> But if I did, and doing this puts the mouse over a different application,
> it sure seems like it *should* give that application the focus.

Yeah, that's the initial response of everyone that hasn't tried this (and it was the way I initially coded it too; I definitely was in the "everyone" group at one point). It seems to make sense. After all, if a user switches workspaces without moving a window with them we definitely want to focus the new window under the mouse. It isn't obvious without looking closer why things would be different when bringing a window with you while switching workspaces. So, let's look a little closer...

Let's say you were trying to move the original application, A, two workspaces to the right using keybindings. If the mouse is over the desktop instead of A, but A is still active (meaning that this can only happen with "sloppy" focus) then there's a special case: If another application, B, happens to be at the same coordinates where the mouse is in the intermediate workspace, and we focus B after the first workspace change like you suggest, that will make it impossible for the user to get application A where they want it without moving the mouse. But the thing is, users aren't aware of this. Instead, they just do this expecting things to work and then get really surprised when A moves only one workspace and B ("some random app") also moves one workspace...and it does take them a while to figure out what is really going on. Further, even if the user only moves one workspace over, they are moving A with them which means they almost certainly have an intent to continue interacting with that window (just as if the user alt-tabbed to it).

So focusing B really doesn't make sense (at least not for any use cases I've ever seen--maybe there are users out there, perhaps ones that don't mind keybindings being broken altogether, that would like this?). Anyway, ever since we switched from focusing the window B in this specific case, all the complaints about this issue stopped (which is surprising--virtually any change you make in a window manager, including "obvious" bugfixes, almost always results in bug reports with people requesting an option for the old behavior).

> But the above answers aside, I suspect that what Jon wants is simply to
> have new applications NOT automatically get focus, while leaving
> essentially everything else about window focus alone.

Good, I'm glad to hear that someone else is coming to the same conclusion. :-)

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.