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

Re: RFE: Never, ever steal focus.



On Wed, 2010-01-06 at 23:04 +0000, Zing wrote:
> On Wed, 06 Jan 2010 15:59:14 -0500, Owen Taylor wrote:
> 
> > On Wed, 2010-01-06 at 16:00 +0100, nodata wrote:
> >> I'd like to suggest an enhancement for Fedora 13: nothing should ever
> >> steal focus from the window I am typing in. If I am typing in a shell
> >> window, or in a word processor, or an e-mail, nothing should ever take
> >> keyboard focus away from that window.
> >> 
> >> Clearly I'm missing something, otherwise we would have this, hence the
> >> posting to the list :)
> > 
> > I'm not sure what you are missing, but I know what I'm missing here - a
> > description of when exactly focus was stolen from you that was a
> > problem.
> > 
> > In almost all cases, if you are typing into one application in Fedora,
> > and a window pops up from another application and steals away your
> > focus, and your typing goes to the wrong place, that's a bug that should
> > be filed against one of:
> > 
> >  - The application that popped up a window - The application that you
> >  are typing into - The window manager
> > 
> > With the most likely candidate being the first one. If you run into such
> > problems and you are using GNOME with Metacity (or gnome-shell and
> > Mutter), please feel free to file bugs against Metacity and I'll help
> > you figure out where they should be reassigned.
> > 
> > There are also a number of GConf options for Metacity that can be set to
> > modify the exact behavior; these are mostly, however, intended as
> > workarounds for people using closed source applications that can't be
> > fixed properly. When all the applications are under our control, it
> > should "just work".
> 
> Would you (or someone) mind explaining why the following happens and how I 
> could get pre-F12 behaviour?:
> 
> In Fedora 12,
> 1. start seamonkey
> 2. start gnome-terminal (be on top of seamonkey window)
> 3. $ seamonkey -remote "openurl(http://lwn.net,new-tab)"
> 4. seamonkey pops in front and steals focus.
> 
> This used to just load the page in the background without stealing focus.  
> It seems like there are a myriad of confusing ways this can happen and a 
> several options to mitigate it... but I'm lost.

(A caveat here is that I can't speak to Compiz or Kwin or XFCE behavior,
I can only discuss the behavior of Metacity. That is, GNOME with Compiz
not selected in the desktop-effects tool.)

In regards to Metacity, there were no changes that I can think of in
this area between Fedora 11 and Fedora 12, so if anything changed it
probably was a change to Seamonkey.

There are two things in the situation that you describe which are
somewhat difficult to handle:

First, when you run a program from a terminal, there's no way that a
launch timestamp will be set on that program, because the launching
isn't done by gnome-panel, or some other GUI program, it's done by bash,
which is ignorant of desktop niceties. So at that point, it's basically
back to a fixed policy of taking focus or not stealing focus. The
default is to take the focus.

Second, when activating an existing app rather than starting a new
application, the focus timestamp, if it exists, has to be passed across
whatever protocol is used (here it is the "Mozilla Remote" protocol
via X messages.)

If I had to guess, I'd guess that prior to Fedora 12, Seamonkey wasn't
worrying about timestamps at all - it wasn't passing a timestamp - so
the new window was created with an old timestamp of the last time you
interacted with Seamonkey. But an updated version now tries to do
something smarter. Since no focus timestamp exists when invoking the
remote command from a terminal, it ends up grabbing the focus
unconditionally.

There's not really a fix for this - either grabbing the focus or not
grabbing the focus will annoy some people. But since it annoys you, you
may find:

 gconftool-2 -s -t string /apps/metacity/general/focus_new_windows strict

To be useful - when that's set, new windows never take focus away from 
a window that looks like a terminal window. (This is assuming the above 
opens a new window. If it changes an existing window, then "focus_new_windows" 
won't affect the behavior.)

- Owen



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