Re: Focus stealing



On Tue, 2009-12-08 at 09:35 +0000, Michael T wrote:
> Dear List,
> 
> I wanted to post about a subject that annoys many people, but has somehow
> apparently never been adequately solved.  More specifically, I have a simple
> suggestion as to how this problem could be solved once and for all, and I would
> like feedback on it (read I am ready to be flamed for my ignorance in thinking
> it will do any good :) ).
> 
> Basically, my idea is that focus stealing is almost never the right thing to do,
> but that in the few situations where it is, the window having its focus stolen
> *will know that that this should be happening*.  So, that window could create a
> property advertising the fact that it is ready to have its focus stolen,
> optionally including information about the window that will steal the focus to
> prevent the wrong one from doing it.  This property could even be set and
> deleted automatically by new application start-up APIs in Gnome and KDE.
> 
> That was it.  Comments?  Flames? :)

Mostly duplicating what other people have said, here, but would like to
emphasize that:

 A) The WM spec includes a detailed solution for focus stealing

 B) This is widely implemented both in toolkits and window managers.

So, it's not really useful to ask about focus stealing prevention
without providing a detailed description of what applications you are
using and the behavior you are seeing; focus stealing is not expected
behavior on the Linux desktop.

If you are getting focus stealing running in GNOME with Metacity, this
is most likely a result of using old applications that don't support
focus-stealing-prevention properly.

If an application maps a new window without setting the 
_NET_WM_USER_TIME property (or providing the equivalent information
through the startup notification specification) then the environment has
no reliable indication about whether the window should be focused or
not, and has to make an arbitrary decision.

GNOME will generally focus such windows, because not focusing them would
result in legacy application not getting focused when launched.

(There's a patch in GNOME Bugzilla
https://bugzilla.gnome.org/show_bug.cgi?id=599248 that allows
blacklisting certain windows from getting focus; it's not really in the
spirit of Metacity, but assuming legacy applications that can't be
modified, it's hard to do better.)

- Owen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]