Bug 318350 - thunderbird somehow spawns a focus breaking "popup"
Summary: thunderbird somehow spawns a focus breaking "popup"
Status: RESOLVED UNMAINTAINED
Alias: None
Product: plasma4
Classification: Plasma
Component: containment-panel (show other bugs)
Version: 4.10.2
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 314172 318973 320902 333826 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-14 15:43 UTC by Janet
Modified: 2018-06-08 18:49 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
output of DISPLAY=:0 xwininfo -wm -id 0x2200386 (263 bytes, application/octet-stream)
2013-05-09 13:18 UTC, Janet
Details
output of DISPLAY=:0 xprop -id 0x2200386 (40.06 KB, application/octet-stream)
2013-05-09 13:22 UTC, Janet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Janet 2013-04-14 15:43:50 UTC
I really love the effect to have my inactive windows dimmed. But alas also plasma widget popups now dimm **active** windows when this effect is enabled.

E.g. the notifications popups dimm the window I'm currently working in - very annoying. Also the device notifier popup does this. Therefore I'd propose an option for the dimm effect to exclude all widgets, so that popup widgets are not allowed to dimm windows.

It seems to me this annoying effect got introduced with KDE SC 4.10 but I'm not quite sure because the time between upgrading from 4.8 to 4.9 and then 4.10 was very short here, so it might also have been 4.9...

Reproducible: Always
Comment 1 Thomas Lübking 2013-04-14 17:18:15 UTC
Neither device nor regular notifications cause this here.

The popup needs to request the input focus (ie. become active) to alter the state of the dimming effect.

If a "random popup" requests the input focus w/o reason, that popup is buggy and needs to be fixed (KWin can not know that a window is "a widget"- it has no deep insight into the windows content or nature.)

Kinda falls into categories of bug #314749, but as mentioned: the notifiers don't take the input focus here (therefore not alter the active window, thus not the dimming)

-> Please specify the notification system you use
(Ubuntu? -> "ayatana" or "colibri"?)
Comment 2 Janet 2013-04-14 17:25:00 UTC
I don't know the name of the notification system I'm using. It is the default one of KDE SC.
When I deactivate the dimm effect the popups, like the device manager and notifications don't dimm the active window...
Comment 3 Janet 2013-04-14 17:27:06 UTC
It's not colibri and it is not ayatana according to apt. Ayatana is not available and colibri is not installed.
Comment 4 Thomas Lübking 2013-04-14 17:35:03 UTC
Of course there's no dimming w/o the effect ;-)

-> if this happens, is the window you were working on actually still the active one (ie. has keyboard focus and a blue outline from the oxygen decoration)?

Please attach the output of "qdbus org.kde.kwin /KWin supportInformation"
Comment 5 Janet 2013-04-14 17:47:40 UTC
output of "qdbus org.kde.kwin /KWin supportInformation": http://pastebin.com/ayfGYHyj

Well, the window I was looking at was the only bright one and not dimmed so I guess it was active and also had the focus....
Comment 6 Thomas Lübking 2013-04-14 18:00:17 UTC
The question is whether it still has the focus after the notification showed up.

If yes, the issue would be somehow in the effect misassuming the active window.
If not, the bug would be the popup "stealing" the focus in the first place.
Comment 7 Janet 2013-04-14 18:52:21 UTC
I'll have an eye on it, need to wait until it happens again.
Comment 8 Janet 2013-04-15 10:33:46 UTC
The window loses the focus when the popup appears. Mainly the culprit seems to be thunderbird. I know it's not a KDE application but I wonder why the problem didn't appear before KDE SC 4.10 (the thunderbird version is the same as before).
Comment 9 Thomas Lübking 2013-04-15 11:03:05 UTC
(In reply to comment #8)
> Mainly the culprit seems to be thunderbird.

Well, who would have thought such? ... ;-)

Is it thunderbird loosing the focus, thunderbird causing a notification that occupies the focus or a thunderbird internal popup that causes this?

If you can reproduce it, please move to VT1 , login and run
DISPLAY=:0 xprop -root _NET_ACTIVE_WINDOW

that will get you a number like
_NET_ACTIVE_WINDOW(WINDOW): window id # 0x2200018
                                                                                ^^^^^^^^^^^

please obtain information about this window:
DISPLAY=:0 xprop -id 0x2200018 > active_window.props
DISPLAY=:0 xwininfo -wm -id 0x2200018 > active_window.info

Please attach both here.

If the focus is actually moved to the "popup", you can workaround this with a window rule on focus stealing prevention resp. just forbid this window to get the focus ever.

> problem didn't appear before KDE SC 4.10
*shrug*
Altered focus stealing prevention or focus policy?
Multiscreen issue?
Different virtual desktops / activities?
Comment 10 Thomas Lübking 2013-04-30 13:48:19 UTC
*** Bug 318973 has been marked as a duplicate of this bug. ***
Comment 11 Janet 2013-04-30 16:25:54 UTC
It is not only Thunderbird. There are other notifications (printer messages e.g.) that steal the focus. I have gotten a lot less focus stealing since I disabled the notifications for applications in the notifications setup but the popups then are always in the way so that'S no option - and sometimes it happens with no popup at all (open windows in that case were only chromium and dolphin).

I cannot reproduce the focus stealing in a certain case...
Comment 12 Thomas Lübking 2013-04-30 18:22:11 UTC
Ok, but what is really needed is an information about the window as provided by "xwininfo", "xwininfo -wm" and "xprop"

What i get here is a managed client which demands attention (ie wanted to be activated, what's bad enough) but is (very important) also
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _NET_WM_WINDOW_TYPE_NORMAL

and docks don't get the focus. Period. ;-)

I also removed the notifications from the panel and added them to the desktop -> same result.

If i however remove all notification widgets, i get windows of type
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_UTILITY, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _NET_WM_WINDOW_TYPE_NORMAL

Which *could* get the focus, but don't try here.
Comment 13 Janet 2013-05-09 13:15:18 UTC
It definitely is not thunderbird as it happens also without. Now that I have activated the Nepomuk indexer my session nearly isn't usable anymore because once twice every second I have to click into the window I am in to reactivate it. Typing is really hard, as it also interrups that.
Comment 14 Janet 2013-05-09 13:18:47 UTC
Created attachment 79796 [details]
output of DISPLAY=:0 xwininfo -wm -id 0x2200386

When the active window gets "lost" it seems as if the desktop itself is grabbing the attention...
Comment 15 Janet 2013-05-09 13:22:21 UTC
Created attachment 79797 [details]
output of DISPLAY=:0 xprop -id 0x2200386

Sorry, the other file is the output of xwininfo!
Comment 16 Thomas Lübking 2013-05-09 15:08:02 UTC
That's a dock and kwin usually won't activate it.

The two only ways it could obtain the inputfocus would be 
a) completely bypassing the WM and just XSetInputFocus itself
b) calling KWindowSystem::forceActiveWindow()

Try to setup a rule for that panel ("kcmshell4 kwinrules", press detect and pick the panel where you notifier resides) to forcefully not get the focus (last tab, "Accept Focus"/"Force"/"No")
If this prevents the problem, the panel is somehow invoking KWindowSystem::forceActiveWindow()
Comment 17 Janet 2013-05-09 17:53:36 UTC
(In reply to comment #16)

> Try to setup a rule for that panel ("kcmshell4 kwinrules", press detect and
> pick the panel where you notifier resides) to forcefully not get the focus

That seems to work...  

Now the active windows only seems to lose the focus when I click on the desktop (shouldn't be either iMHO, it shouldn't be necessary to re-activate the former acitve window after using the desktop context menu) and when I use the pager in the panel to switch desktops (also not desired behaviour - and it doesn't happen when I switch desktops via mousewheel)...
Comment 18 Thomas Lübking 2013-05-09 18:33:41 UTC
(In reply to comment #17)
> (In reply to comment #16)
> 
> > Try to setup a rule for that panel ("kcmshell4 kwinrules", press detect and
> > pick the panel where you notifier resides) to forcefully not get the focus
> 
> That seems to work...  
Ok, then this is likely a forceful client request.
You can probably not use wireshark to inspect the X11 communication, can you? Or inject a patch for debug out?

--------------

OT. in doubt please open a new bug for this:
----
> Now the active windows only seems to lose the focus when I click on the desktop (shouldn't be either iMHO

Generally passing clients clicks w/o activating them is simple but "risky", afaik no WM does that. Could lead clients to crash or just not work.
-> Would be an experimental setting at best, with uncertain impact.

The desktop will need to be focusable for random plasmoids, but you can in theory setup an equal rule to prevent it from being focused.
Alternatively, the desktop can opt-out of general focus handling and fetch the focus on particular buttons only (this works, doing it myself ;-) what would also work with any NETWM windowmanager.

> and it doesn't happen when I switch desktops via mousewheel)
The mousewheel is long time (ever?) passed on w/o focusing the client.
So this is just less problematic.
Comment 19 Janet 2013-05-12 15:35:53 UTC
> You can probably not use wireshark to inspect the X11 communication, can you? Or inject a patch for debug out?

Never did something like that before... Sounds complicated? Maybe if you can explain in very detail.....
Comment 20 Tanja Schulte 2013-05-29 21:48:55 UTC
I wanted to post a bug report about "Windows always lose focus without identifiable cause" and this report appeared in the search results at first position - seems to be related?

I am using KDE SC 4.10.3 and I don't use thunderbird but my windows very often get out of focus, even when I write something in some application window, the window suddenly loses the focus and I type into the big void...

As proposed in comment #16 here I created a non-activation rule for - not the panel - but everything containing the word "plasma" as long as it is no normal window or dialog window. And that seems to eliminate the focus stealing so far...

Focus stealing prevention level is set to "low" (because otherwise new windows don't open on top, I use that level since I use KDE and I never had those problems before 4.10), the dim effect for inactive windows mentioned here is activated.
Comment 21 Janet 2013-05-29 22:13:36 UTC
(In reply to comment #9)

> > problem didn't appear before KDE SC 4.10
> *shrug*
> Altered focus stealing prevention or focus policy?
> Multiscreen issue?
> Different virtual desktops / activities?

No multiscreen, no altered focus stealing prevention ("low" for eons), no changed virtual desktops/activities constellation (5 virtual desktops, only 1 activity), just update to KDE SC 4.10...
Also no changed window rules. 

I have some window rules (had them before without problems) to get login/password dialogs always on top and activated: window class (exact): "kdesu" and window class (exact) "kwalletd kwalletd" + window title (exact) "KDE-Dienst für digitale Brieftasche"... and icedove reminders (window class (exact) "icedove", window title contains "Erinnerung").
Comment 22 Thomas Lübking 2013-05-30 12:28:21 UTC
I assume this is related to the notification plasmoid moving to QML.

@Plasma devs: from grepping sources, this

void PanelView::statusUpdated(Plasma::ItemStatus newStatus)
{
    if (newStatus == Plasma::AcceptingInputStatus) {
        KWindowSystem::forceActiveWindow(winId());
    }
}

looks like the best candidate to cause this.
Unfortunately i was not able to reproduce this, but in general wonder why (if the function does as it suggests) just updating capabilities (is it) should cause a (forced!) focus request.

Reassigning for clarification and because the issue likely needs to be fixed in plasma anyway (::forceActiveWindow() is the "i know better" command and the WM is expected to respect that - it should for that reason be invoked on direct user interaction only)
Comment 23 Martin Flöser 2013-06-06 15:01:58 UTC
*** Bug 314172 has been marked as a duplicate of this bug. ***
Comment 24 Janet 2013-06-08 13:57:58 UTC
Maybe realted: Bug 314651 ?
Comment 25 Gernot Wieprecht 2013-06-08 14:23:42 UTC
*** Bug 320902 has been marked as a duplicate of this bug. ***
Comment 26 Gernot Wieprecht 2013-06-08 14:32:08 UTC
Excuse me, why is this wishlist and not bug? The focus losing really is a problem that affects the workflow and I cannot image that it is intentional, or is it?
Comment 27 Thomas Lübking 2013-06-08 14:41:32 UTC
Started out as "kwin effect to dimm inactive windows should have an option to exclude widget popups", ie. focusing on avoiding a correct result of the unwanted incident.
Comment 28 Sandro Mani 2013-07-16 22:46:59 UTC
FWIW, the simplest reproducer here is to unplug (resp plug in if previously unplugged) the power cable of the laptop. Also happens in other (less predictable) cases though.

I usually manage to prevent these focus changes by adding an "Accept focus: force no" rule for all windows matching "plasma-desktop" (exact match). (However, it seems that after a kwin --replace, the rule has no effect anymore, which is an unrelated issue though).
Comment 29 Thomas Lübking 2014-04-25 15:19:54 UTC
*** Bug 333826 has been marked as a duplicate of this bug. ***
Comment 30 richlv 2014-06-10 17:55:32 UTC
for me a rule of window title "plasma-desktop" + all types except "normal window" seems to help (including normal window prevents alt+f1 menu from getting focus)
Comment 31 Nate Graham 2018-06-08 18:49:47 UTC
Hello!

This bug report was filed for KDE Plasma 4, which reached end-of-support status in August 2015. KDE Plasma 5's desktop shell has been almost completely rewritten for better performance and usability, so it is likely that this bug is already resolved in Plasma 5.

Accordingly, we hope you understand why we must close this bug report. If the issue described  here is still present in KDE Plasma 5.12 or later, please feel free to open a new ticket in the "plasmashell" product after reading https://community.kde.org/Get_Involved/Bug_Reporting

If you would like to get involved in KDE's bug triaging effort so that future mass bug closes like this are less likely, please read https://community.kde.org/Get_Involved#Bug_Triaging

Thanks for your understanding!

Nate Graham