More flexible new window focus setting would be nice

Olivier Fourdan fourdan at
Mon Feb 23 11:09:49 CET 2009

On Sun, Feb 22, 2009 at 9:25 PM, Jarno Suni <j_suni at> wrote:
>> Focus stealing prevention requires several conditions to be
>> met.
>> 1) The currently focused window must maintain and update a
>> property
>> called _NET_WM_USER_TIME  [1]. This property is used by the
>> window
>> manager to know when was the last user explicit interaction
>> with the
>> focused window.
> I suppose mouse movement should be registered as such an explicit user
> interaction, if focus follows mouse setting is used. But just having the mouse cursor at
> certain position does not guarantee focus will stay at the underlying window even
> with the setting enabled.

No. This is up to the application to update its timestamp. But cursor
move should definitely not count, only button and keyboard actions (ie
explicit user action).

> In Xfce 4.4.2 focus is changed only after mouse cursor moves to another window, so
> moving is not enough. Therefore it can happen that focus does not follow even
> mouse _movement_, if focus is changed by something else than mouse movement
> first.

It is up to the application to update the timestamp. So that makes no
difference between 4.4 and 4.6.


> If startup notification is not used, focus will just follow new window focus policy, right?
> Otherwise user action may override that policy.

Wrong, focus stealing prevention is independent from focus policy,

> As for launchee must comply with the startup notification standard, I suppose
> launchee gives focus and raises its window independently of window manager, as
> otherwise window manager could be used to control it.

Thing is, stacking and focus are different. When an application try to
raise itself, it translates to a configure _request_ that is sent to
the WM that might or might not honor the request (or partially honor
it, for example to maintain the concept of layers). Focus is
different, there is no focus request (alas), only notifications, ie
the application can (and broken apps do) manipulate focus.

> "Use startup notification" is useful when having new window focus (and raise)
> disabled, even if "focus stealing prevention" is not used, as it blinks the new
> window's (or windows') task list item(s).

No, the "blinking" in the taskbar is another property (needs
attention) that is set by the window manager, this has nothing to do
with startup notification per se.


> A new application that starts may open several windows like Firefox, if it is configured
> to remember windows and tabs from last time. Does Firefox set
> _NET_WM_USER_TIME for all but the first window opened automatically to be the
> same that the first Firefox window has?

>From what I see, new additional  Firefox windows have no startup time
nor user time set, so they get focused. If you want to tell for sure,
the logic is in clientFocusNew() in src/focus.c, you can add traces

>> Failing to set that timestamp
>> correctly
>> will result in either the window never or always being
>> focused.
> Do you mean the new window focus setting is applied then?

No, it's undeterministic, I cannot tell either way.


More information about the Xfce mailing list