Bug 479628 - The active window loses focus after triggering "Overview" or "Present Windows" then cancel immediately
Summary: The active window loses focus after triggering "Overview" or "Present Windows...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: git master
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-01-11 02:38 UTC by Jin Liu
Modified: 2024-01-12 11:41 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jin Liu 2024-01-11 02:38:45 UTC
STEPS TO REPRODUCE
1. Open KWrite.
2. Trigger "Overview" or "Present Windows".
3. Press `ESC`.
4. KWrite loses keyboard focus. The text cursor stops blinking.
5. Press any key and KWrite regains focus.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.7.0
Kernel Version: 6.6.10-1-lts (64-bit)
Graphics Platform: offscreen
Processors: 12 × AMD Ryzen 5 5600H with Radeon Graphics
Memory: 13.5 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Comment 1 Doug 2024-01-11 05:10:20 UTC
The cursor does stop blinking or even disappears, which is a bit confusing, but is the window really losing focus if you can type into it immediately?
Comment 2 fanzhuyifan 2024-01-11 05:23:35 UTC
Can't reproduce on wayland -- the cursor keeps blinking
Comment 3 fanzhuyifan 2024-01-11 05:24:08 UTC
Are you on X11 or wayland?
Comment 4 Doug 2024-01-11 05:25:16 UTC
(In reply to fanzhuyifan from comment #3)
> Are you on X11 or wayland?

I am on Wayland.
Comment 5 fanzhuyifan 2024-01-11 05:29:34 UTC
(In reply to fanzhuyifan from comment #2)
> Can't reproduce on wayland -- the cursor keeps blinking

Sorry, CAN reproduce on wayland following the STEPS TO REPRODUCE. I was repressing the shortcut instead of pressing escape.

This also seems to show up when toggling grid view and then pressing escape.
Comment 6 Jin Liu 2024-01-11 05:32:05 UTC
(In reply to fanzhuyifan from comment #5)
> Sorry, CAN reproduce on wayland following the STEPS TO REPRODUCE. I was
> repressing the shortcut instead of pressing escape.
> 
> This also seems to show up when toggling grid view and then pressing escape.

Probably it's in any effect that grabs keyboard then doesn't activate a new window.
Comment 7 Jin Liu 2024-01-11 05:38:20 UTC
(In reply to fanzhuyifan from comment #5)
> (In reply to fanzhuyifan from comment #2)
> > Can't reproduce on wayland -- the cursor keeps blinking
> 
> Sorry, CAN reproduce on wayland following the STEPS TO REPRODUCE. I was
> repressing the shortcut instead of pressing escape.
> 
> This also seems to show up when toggling grid view and then pressing escape.

And probably pressing the shortcut works because it's a two-key action, so when you release the second key (the modifier), the app regains focus.

You can try pressing both keys simultaneously and quick. It triggers the bug.
Comment 8 fanzhuyifan 2024-01-11 05:40:27 UTC
(In reply to Jin Liu from comment #7) 
> And probably pressing the shortcut works because it's a two-key action, so
> when you release the second key (the modifier), the app regains focus.
> 
> You can try pressing both keys simultaneously and quick. It triggers the bug.

Yeah, if I do that I can sometimes trigger this.
Comment 9 Bug Janitor Service 2024-01-11 08:41:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4873
Comment 10 Jin Liu 2024-01-11 09:04:34 UTC
Git commit 18ba622c407564ecd84235fe8161cc37b691340e by Jin Liu.
Committed on 11/01/2024 at 09:40.
Pushed by genericity into branch 'master'.

Update keyboard focus when exiting from a keyboard-grabbing effect

M  +2    -0    src/effect/effecthandler.cpp

https://invent.kde.org/plasma/kwin/-/commit/18ba622c407564ecd84235fe8161cc37b691340e
Comment 11 Jin Liu 2024-01-11 14:46:05 UTC
Nate, I think it will be cherry-picked into 6.0?

https://invent.kde.org/plasma/kwin/-/merge_requests/4876
Comment 12 Nate Graham 2024-01-11 15:01:46 UTC
Yep, I missed it. Changing the Fixed In version.
Comment 13 Vlad Zahorodnii 2024-01-12 11:41:44 UTC
Git commit a5437f9af759fe1f6540e796528afaf6960a86ab by Vlad Zahorodnii, on behalf of Jin Liu.
Committed on 12/01/2024 at 12:32.
Pushed by vladz into branch 'Plasma/6.0'.

Update keyboard focus when exiting from a keyboard-grabbing effect


(cherry picked from commit 18ba622c407564ecd84235fe8161cc37b691340e)

M  +2    -0    src/effect/effecthandler.cpp

https://invent.kde.org/plasma/kwin/-/commit/a5437f9af759fe1f6540e796528afaf6960a86ab