Re: _NET_ACTIVE_WINDOW, revisited



Elijah Newren (newren gmail com):

> > - I think we should accept as a fact that some apps will try to
> > activate themselves. The WM should detect when it's okay to activate
> > it, and if not it should automatically refuse and make it only use
> > the demand attention flag (which is what focus stealing prevention
> > does). 
> 
> I agree and I think you hit the nail on the head here, Lubos.  Billy
> has mentioned the "user gets surprised by window getting pulled to
> users desktop" stuff before with relevant bug reports, but those were
> all before Metacity 2.10.x--i.e. before focus stealing prevention was
> turned on in Metacity.  I'm betting that his real annoyance was with
> Metacity unconditionally following _NET_ACTIVE_WINDOW requests but he
> placed the blame on what what he saw (i.e. the activation behavior)
> without realizing there was something deeper.  Billy: could you verify
> (in other words, were the problems your users were experiencing only
> occuring when an activation message was sent when no window from the
> application was active anymore)?

  In SWT, if the application does setFocus() on a widget, we first call
gdk_window_focus() (_NET_ACTIVE_WINDOW/XSetInputFocus wrapper) on the
window belonging to that widget.  Since many WMs do not have focus
stealing prevention, we only call this if we think one of our windows
has focus.  Due to races and bugs, sometimes that check is wrong, and we
call gdk_window_focus() more frequently.  Depending on the situation and
the version of Eclipse, the timestamp in the request may be 0.

  setFocus() is used frequently,  For example, it assigns focus to the
correct widget when you open a dialog.   Every time a dialog appears in
an SWT application, a _NET_ACTIVE_WINDOW request is therefore emitted.

  We're basically using _NET_ACTIVE_WINDOW as an assert to ensure that a
window has focus,   Usually, we hope it does nothing, but in the case
where the a find dialog calls setFocus() on the text area of a
particular editor window, we hope it works.

  Elijah: you are correct that the bugs we have occur when Eclipse
incorrectly believes it still had focus.  However, given the way we use
_NET_ACTIVE_WINDOW, I would still prefer a weaker definition.  It's much
safer to have a request that silently fails or simply sets a demands
attention hint if the WM decides it's not appropriate than to have
windows move desktops.

  -Billy




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