Bug 415155

Summary: Closing window from Present Windows effect sometimes causes the new frontmost window to lose focus and be unable to regain it
Product: [Plasma] kwin Reporter: Nate Graham <nate>
Component: effects-present-windowsAssignee: KWin default assignee <kwin-bugs-null>
Severity: major CC: ae, kde, michal.dybczak
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.18.1
Sentry Crash Report:

Description Nate Graham 2019-12-13 21:38:12 UTC
KWin and everything else KDE-related from git master.

1. Open two windows
2. Engage Present Windows
3. Click on the close button for a window

The effect ends and whatever window comes to the front does not have focus and cannot be given focus. Clicking on the titlebar does not give it focus. You can click and drag on the titlebar to move it around. The Task Switcher does not appear on Alt+Tab. Various other odd window-focus related oddities occur. Restarting KWin fixes everything.

None of that weird stuff happens

This is quite reproducible for me, though not to the level of 100%. I have not been able to nail down why it only sometimes happens when I perform the above-mentioned steps to reproduce.
Comment 1 Nate Graham 2020-02-11 20:21:06 UTC
Got confirmation from a user that this is affecting them too in Plasma 5.18.
Comment 2 Komorebi 2020-02-11 20:23:49 UTC
Also affected
Operating System: KDE neon 5.18
KDE Plasma Version: 5.18.0
KDE Frameworks Version: 5.67.0
Qt Version: 5.13.2
Kernel Version: 5.3.0-28-generic
OS Type: 64-bit
Processors: 4 × Intel® Xeon® CPU E3-1225 V2 @ 3.20GHz
Memory: 23,4 GiB of RAM

Please let me know if you need some additional info.
Comment 3 David Edmundson 2020-02-11 20:53:39 UTC
Also can reproduce.

Cause seems to be Kwins visual stacking order gets out of sync with X's.
Comment 4 David Edmundson 2020-02-11 21:29:39 UTC
Comment 5 Vlad Zahorodnii 2020-02-11 22:37:42 UTC
Okay, I can reproduce it. Here's what I do

- Open two konsole windows
- Open sublime text by clicking on an icon in the task manager

- trigger pw and close the sublime text window

- Open sublime text again (after this step, the stacking order is messed up)
Comment 6 David Edmundson 2020-02-12 08:03:54 UTC
Git commit 3dbfa6a32545c9afd27bf8c1e86cba516b71d2a6 by David Edmundson.
Committed on 12/02/2020 at 08:03.
Pushed by davidedmundson into branch 'Plasma/5.18'.

Return early if close button accepts input event

Otherwise we close the effect whenever the close is pressed which is a
behavioural change.

That in turn leads to bigger bugs

Test Plan:
Ran effect
Clicked on the "Whitespace" of the dash
Clicked on the close

Now matches desktopgrid code

Reviewers: #kwin, zzag, ngraham

Reviewed By: #kwin, zzag, ngraham

Subscribers: ngraham, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27333

M  +4    -0    effects/presentwindows/presentwindows.cpp

Comment 7 David Edmundson 2020-02-16 18:16:16 UTC
*** Bug 417715 has been marked as a duplicate of this bug. ***
Comment 8 David Edmundson 2020-02-18 19:38:28 UTC
*** Bug 417840 has been marked as a duplicate of this bug. ***