Bug 453166 - Opening and closing Panel widgets with keyboard shortcuts fails to return focus to the previously-focused window
Summary: Opening and closing Panel widgets with keyboard shortcuts fails to return foc...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Panel (show other bugs)
Version: 5.24.90
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 454327 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-04-28 23:56 UTC by Nate Graham
Modified: 2023-11-23 17:34 UTC (History)
6 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 Nate Graham 2022-04-28 23:56:48 UTC
This started happening with the work to make panels keyboard-navigable, but I have been too lazy to report it until now. :(

To reproduce the issue, activate a Panel widget with a keyboard shortcut. e.g. Meta key or Alt+F1 for Kickoff, or any other Panel widget using a custom shortcut, then close it by hitting that shortcut again.

Afterwards, the window that previously had focus does not regain focus. As a result, any keyboard keys typed get handed to the now-closed widget, instead of the window. This is frequently mildly annoying.

This works properly when KRunner itself is activated and closed using a keyboard shortcut.
Comment 1 Nate Graham 2022-05-24 16:59:38 UTC
*** Bug 454327 has been marked as a duplicate of this bug. ***
Comment 3 Bug Janitor Service 2022-05-26 15:59:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/960
Comment 4 Bug Janitor Service 2022-05-26 16:04:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1771
Comment 5 Nate Graham 2022-05-30 13:26:51 UTC
Git commit bad07cde1386575fa88bfd50a3ec2fa3dd2b1ee7 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:17.
Pushed by ngraham into branch 'master'.

shell: move keyboard focus code from frontend to backend

It makes the code easier to be maintained across different platforms.
Related: bug 352476

M  +10   -10   shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/bad07cde1386575fa88bfd50a3ec2fa3dd2b1ee7
Comment 6 Nate Graham 2022-05-30 13:27:16 UTC
Git commit 3a16cbe7b01622ca1f6e045ddde7c7a61708f990 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:17.
Pushed by ngraham into branch 'master'.

shell/panelview: unfocus on the panel when clicking outside

When the panel is focused, clicking outside should make the panel
unfocused.
Related: bug 352476

M  +7    -0    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/3a16cbe7b01622ca1f6e045ddde7c7a61708f990
Comment 7 Nate Graham 2022-05-30 13:27:24 UTC
Git commit d2057d7174975c4379266f48f987fbac967e8ef3 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:17.
Pushed by ngraham into branch 'master'.

shell/panelview: press shortcut to unfocus on the panel when it's in focused state

The second time pressing Meta+Alt+P, the panel should be unfocused.
Related: bug 352476

M  +3    -0    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/d2057d7174975c4379266f48f987fbac967e8ef3
Comment 8 Nate Graham 2022-05-30 13:27:48 UTC
Git commit c89fb19673e35fc50a42a114ad3e52a503c05098 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:17.
Pushed by ngraham into branch 'master'.

desktoppackage: don't focus on panel when pressing applet shortcuts

The panel focus shortcut is Meta+Alt+P. This keeps the old behavior.
Related: bug 352476
FIXED-IN: 5.25

M  +0    -20   desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/commit/c89fb19673e35fc50a42a114ad3e52a503c05098
Comment 9 Nate Graham 2022-05-30 13:28:04 UTC
Git commit 6eac53b6d0b19e46c28018434ff416ba144d0c1a by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:17.
Pushed by ngraham into branch 'master'.

shell/panelview: set passive status when pressing Escape key
Related: bug 352476

M  +8    -0    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/6eac53b6d0b19e46c28018434ff416ba144d0c1a
Comment 10 Nate Graham 2022-05-30 13:28:12 UTC
Git commit 53fdac77ec442aa384f1df2be75934c76bb828ff by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:17.
Pushed by ngraham into branch 'master'.

shell/panelview: restore old window focus when panel loses focus
Related: bug 352476

M  +21   -0    shell/panelview.cpp
M  +10   -0    shell/panelview.h
M  +9    -0    shell/shellcorona.cpp
M  +4    -0    shell/shellcorona.h

https://invent.kde.org/plasma/plasma-workspace/commit/53fdac77ec442aa384f1df2be75934c76bb828ff
Comment 11 Nate Graham 2022-05-30 13:36:11 UTC
Git commit e315dcd8cd6631a5d7030f437380e0ef6f51b6b6 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:36.
Pushed by ngraham into branch 'Plasma/5.25'.

desktoppackage: don't focus on panel when pressing applet shortcuts

The panel focus shortcut is Meta+Alt+P. This keeps the old behavior.
Related: bug 352476
FIXED-IN: 5.25


(cherry picked from commit c89fb19673e35fc50a42a114ad3e52a503c05098)

M  +0    -20   desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/commit/e315dcd8cd6631a5d7030f437380e0ef6f51b6b6
Comment 12 Nate Graham 2022-05-30 13:37:53 UTC
Git commit 4eeb953bd7ceca4b3b76728abd8dffda2671ab36 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:37.
Pushed by ngraham into branch 'Plasma/5.25'.

shell/panelview: unfocus on the panel when clicking outside

When the panel is focused, clicking outside should make the panel
unfocused.
Related: bug 352476
(cherry picked from commit 3a16cbe7b01622ca1f6e045ddde7c7a61708f990)

M  +7    -0    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/4eeb953bd7ceca4b3b76728abd8dffda2671ab36
Comment 13 Nate Graham 2022-05-30 13:37:58 UTC
Git commit 7df9ad19f9b17e13febf07050e7dc54c85a2773b by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:37.
Pushed by ngraham into branch 'Plasma/5.25'.

shell/panelview: restore old window focus when panel loses focus
Related: bug 352476
(cherry picked from commit 53fdac77ec442aa384f1df2be75934c76bb828ff)

M  +21   -0    shell/panelview.cpp
M  +10   -0    shell/panelview.h
M  +9    -0    shell/shellcorona.cpp
M  +4    -0    shell/shellcorona.h

https://invent.kde.org/plasma/plasma-workspace/commit/7df9ad19f9b17e13febf07050e7dc54c85a2773b
Comment 14 Nate Graham 2022-05-30 13:38:00 UTC
Git commit 18cfb226fc8b56346d66eb51d84c1ed7fbdc53d3 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:37.
Pushed by ngraham into branch 'Plasma/5.25'.

shell: move keyboard focus code from frontend to backend

It makes the code easier to be maintained across different platforms.
Related: bug 352476
(cherry picked from commit bad07cde1386575fa88bfd50a3ec2fa3dd2b1ee7)

M  +10   -10   shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/18cfb226fc8b56346d66eb51d84c1ed7fbdc53d3
Comment 15 Nate Graham 2022-05-30 13:38:08 UTC
Git commit 74f54bced881b917f71189565ecc3aaab3cefe11 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:37.
Pushed by ngraham into branch 'Plasma/5.25'.

shell/panelview: set passive status when pressing Escape key
Related: bug 352476
(cherry picked from commit 6eac53b6d0b19e46c28018434ff416ba144d0c1a)

M  +8    -0    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/74f54bced881b917f71189565ecc3aaab3cefe11
Comment 16 Nate Graham 2022-05-30 13:38:32 UTC
Git commit 9e1cbb8ff214f8277a308c20760d03cf151667e1 by Nate Graham, on behalf of Fushan Wen.
Committed on 30/05/2022 at 13:37.
Pushed by ngraham into branch 'Plasma/5.25'.

shell/panelview: press shortcut to unfocus on the panel when it's in focused state

The second time pressing Meta+Alt+P, the panel should be unfocused.
Related: bug 352476
(cherry picked from commit d2057d7174975c4379266f48f987fbac967e8ef3)

M  +3    -0    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/9e1cbb8ff214f8277a308c20760d03cf151667e1
Comment 17 Bug Janitor Service 2022-07-30 05:40:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1983
Comment 18 Fushan Wen 2022-08-20 04:42:43 UTC
Git commit 07efee1095edfb2e27e06952ab83d9ddbe30098b by Fushan Wen.
Committed on 20/08/2022 at 04:34.
Pushed by fusionfuture into branch 'master'.

shell: allow to cycle through multiple panels

This adds `m_blockRestorePreviousWindow` to avoid restoring focus to the
panel, and replace QHash with QMap to save panel orders.
Related: bug 352476

M  +1    -16   shell/panelview.cpp
M  +0    -7    shell/panelview.h
M  +94   -27   shell/shellcorona.cpp
M  +18   -2    shell/shellcorona.h

https://invent.kde.org/plasma/plasma-workspace/commit/07efee1095edfb2e27e06952ab83d9ddbe30098b
Comment 19 Bug Janitor Service 2022-09-17 11:38:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2133
Comment 20 Bug Janitor Service 2022-09-17 11:38:57 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1152
Comment 21 Fushan Wen 2023-07-21 19:01:57 UTC
Git commit 55a9eeba7595548e4e748d95a103813359639dff by Fushan Wen.
Committed on 21/07/2023 at 18:12.
Pushed by fusionfuture into branch 'master'.

desktoppackage: activate panel on "Activate Panel Widget" shortcut pressed

This partially reverts c89fb19673e35fc50a42a114ad3e52a503c05098 to bring
back onActivated signal required by the global shortcut.
Related: bug 455398, bug 352476
FIXED-IN: 5.26

M  +11   -0    desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/55a9eeba7595548e4e748d95a103813359639dff
Comment 22 Fushan Wen 2023-07-21 19:04:17 UTC
Git commit 648e10cea66926e93b52b9a7e0cc65b4055448e6 by Fushan Wen.
Committed on 21/07/2023 at 19:03.
Pushed by fusionfuture into branch 'Plasma/5.27'.

desktoppackage: activate panel on "Activate Panel Widget" shortcut pressed

This partially reverts c89fb196 to bring
back onActivated signal required by the global shortcut.
Related: bug 455398, bug 352476
FIXED-IN: 5.27

(cherry picked from commit 55a9eeba7595548e4e748d95a103813359639dff)

M  +12   -1    desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/648e10cea66926e93b52b9a7e0cc65b4055448e6
Comment 23 Fushan Wen 2023-07-21 19:06:37 UTC
Git commit 2ae02766f8784fee5dcf33bfc6ae973e367beef1 by Fushan Wen.
Committed on 21/07/2023 at 18:50.
Pushed by fusionfuture into branch 'master'.

shell: move `forceActiveFocus` to `PanelView`

This allows to focus on the first child widget in a panel by setting
containment status directly.

This adds `savePreviousWindow()` to save the previously focused window,
to be called in `PanelView::refreshStatus`. When the previous window is
not reset, calling savePreviousWindow() will not do anything, so when
there are more than one panel, it will not incorrectly save the wrong
window (panel).
Related: bug 455398, bug 352476

M  +9    -0    shell/panelview.cpp
M  +14   -22   shell/shellcorona.cpp
M  +1    -0    shell/shellcorona.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/2ae02766f8784fee5dcf33bfc6ae973e367beef1
Comment 24 Fushan Wen 2023-07-21 19:07:35 UTC
Git commit 6f0cd573dcc3634a453c8bb6b504013dc8372a95 by Fushan Wen.
Committed on 21/07/2023 at 19:06.
Pushed by fusionfuture into branch 'Plasma/5.27'.

shell: move `forceActiveFocus` to `PanelView`

This allows to focus on the first child widget in a panel by setting
containment status directly.

This adds `savePreviousWindow()` to save the previously focused window,
to be called in `PanelView::refreshStatus`. When the previous window is
not reset, calling savePreviousWindow() will not do anything, so when
there are more than one panel, it will not incorrectly save the wrong
window (panel).
Related: bug 455398, bug 352476

(cherry picked from commit 2ae02766f8784fee5dcf33bfc6ae973e367beef1)

M  +9    -0    shell/panelview.cpp
M  +14   -22   shell/shellcorona.cpp
M  +1    -0    shell/shellcorona.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/6f0cd573dcc3634a453c8bb6b504013dc8372a95
Comment 25 Akseli Lahtinen 2023-11-23 14:00:02 UTC
Git commit 4509c349ad1a5a1f1c193d6b818f2cc6924747d2 by Akseli Lahtinen.
Committed on 23/11/2023 at 14:59.
Pushed by akselmo into branch 'master'.

Show panel on wayland when focusing different panels

When toggling focus between panels on wayland with Meta+Alt+P, it would break 
if one of the panels was hidden. 
Related: bug 473000

M  +7    -3    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/4509c349ad1a5a1f1c193d6b818f2cc6924747d2