! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
"Always on top" windows steal focus after notification is displayed.
Status:
RESOLVED: DUPLICATE
Product:
Xfce4-notifyd
Component:
general

Comments

Description Alistair Buxton 2013-10-03 01:16:39 CEST
To reproduce:

1. Open two terminals.
2. Mark on of them as "Always on top".
3. Select the other one and run "notify-send hello".
4. Wait for the notification bubble to disappear.

Result: The "always on top" terminal steals focus when the notification bubble disappears.
Comment 1 Alistair Buxton 2013-12-09 23:57:02 CET
This is actually triggered by a Gtk bug:

https://bugzilla.gnome.org/show_bug.cgi?id=710389

If a window has accept focus = FALSE and take focus = TRUE, then when the window opens the window will not get focused, but when it closes, xfwm4 will behave as if that window *was* focused, and pass focus to the topmost window. The topmost window is not necessarily the currently focused window if "always on top" is in use.

This happens because having TAKE_FOCUS set causes clientAcceptFocus() to return true, overriding the focus hint:

    if ((c->screen_info->params->focus_hint)
        && !FLAG_TEST (c->wm_flags, WM_FLAG_INPUT | WM_FLAG_TAKEFOCUS))
    {
        return FALSE;
    }

This is a problem because in some places it gets used like this:

if (!clientAcceptFocus (c))

and in some places it is used like this:

if (!clientAcceptFocus (c) || (c->type & WINDOW_TYPE_DONT_FOCUS))

This causes pending_focus to be set to the notification window, even though it will never get focused.
Comment 2 Alistair Buxton 2013-12-10 06:14:04 CET
The focus code in xfwm4 is very fragile and has loads of workarounds already. I don't see a way to really "fix" this. (Actually I see several, and they would all have side-effects just as bad as this bug.)

Luckily though, the problem seems to have an easy fix in the notifyd. Just have it set override-redirect on it's bubbles, and then they won't interfere with anything at all, because the window manager won't even see them.
Comment 3 Alistair Buxton 2013-12-10 06:17:52 CET
Created attachment 5257 
Make notification bubbles override-redirect.

This saves the window-manager from having to deal with yet-more focus issues.
Comment 4 Alistair Buxton 2013-12-10 06:19:02 CET
Oh, btw, the Gtk bug is not really a bug. It's been that way so long it's now considered standard, if incorrect (depending who you ask) behaviour.
Comment 5 Alistair Buxton 2014-02-17 21:09:42 CET
Fixed at https://bugzilla.xfce.org/show_bug.cgi?id=10686

*** This bug has been marked as a duplicate of bug 10686 ***

Bug #10384

Reported by:
Alistair Buxton
Reported on: 2013-10-03
Last modified on: 2014-02-17

People

Assignee:
Olivier Fourdan
CC List:
0 users

Version

Version:
unspecified

Attachments

Additional information