Bug 423010

Summary: KWin sometimes does not emit client.windowShown when OpenGL is used as rendering backend
Product: [Plasma] kwin Reporter: serviceskde
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: kdenis, sjkingo88
Priority: NOR    
Version: 5.22.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description serviceskde 2020-06-15 12:33:01 UTC
SUMMARY

When compositor's rendering backend is set to OpenGL (either 2.0 or 3.1), KWin sometimes does not emit windowShown events. This breaks various tiling scripts such as https://github.com/esjeon/krohnkite

There are two observed workarounds:

* Switch rendering backend to XRender (this works but it causes tearing)
* Open compoistor settings, change any setting (such as Scale Method), Apply, revert previous change, Apply. After this, events will work until next reboot.

STEPS TO REPRODUCE
1. Install https://github.com/esjeon/krohnkite KWin script 
2. Open two windows

OBSERVED RESULT

Windows are not tiled.

EXPECTED RESULT

Windows should be tiled.


SOFTWARE/OS VERSIONS

Linux/KDE Plasma: 5.6.15-1-MANJARO 64-bit
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version:  5.70.0
Qt Version: 5.15.0

It also happens with 5.19.0 (I don't have machine with that version at hand right now though, so I cannot report proper versions)

ADDITIONAL INFORMATION

See following thread for more info: https://github.com/esjeon/krohnkite/issues/46
Comment 1 Denis Kurz 2021-07-14 12:47:29 UTC
I can consistently reproduce this issue on Gentoo, KWin version 5.22.3: New windows are still not managed tiled by Kröhnkite, but tiling kicks in after switching to another virtual desktop.
Comment 2 Denis Kurz 2021-07-14 12:55:05 UTC
Switching from OpenGL 2.0 compositor to OpenGL 3.1 just fixed it for me. Interestingly, this comment [1] claims that switching from 3.1 to 2.0 fixed it. Maybe Something (tm) is reset after changing the compositor?
Comment 3 Vlad Zahorodnii 2021-07-19 08:44:06 UTC
That's right. If you switch from OpenGL 3.1 to OpenGL 2.0, compositing will be restarted.

As for the issue itself, I recommend avoid using the windowShown signal. KWin may decide not to emit it in some cases even if the window is effectively hidden.

The alternative is to check whether a particular window is on the current activity/virtual desktop + minimized state.
Comment 4 Vlad Zahorodnii 2021-07-19 08:44:47 UTC
(In reply to Denis Kurz from comment #1)
> I can consistently reproduce this issue on Gentoo, KWin version 5.22.3: New
> windows are still not managed tiled by Kröhnkite, but tiling kicks in after
> switching to another virtual desktop.

KWin will emit the windowShown and the windowHidden in that case.
Comment 5 David Edmundson 2023-09-06 10:38:07 UTC
This bug was reported against an outdated version of KWin. We have made many changes since the. 
If the issue persists in newer versions can you reopen the bug report updating the version number.