Fix cleanup of forced window shortcuts
XdgToplevelWindow doesn't call finishWindowRules(). It creates a problem for Workspace::removeWindow() because it calls setShortcut() to release the window shortcut. While one way to fix the bug would be to add a finishWindowRules() call in XdgToplevelWindow, it would perhaps be not the best one because it would change the appearance of decoration when the window is closed. Instead, this change makes the workspace release the shortcut when the window is closed. It has a couple of advantages: the appearance of the decoration won't change, shortcut cleanup is better encapsulated. BUG: 478647
This commit is contained in:
parent
4f8c941bff
commit
b98607c689
2 changed files with 5 additions and 4 deletions
|
@ -1131,6 +1131,11 @@ void Workspace::windowShortcutUpdated(Window *window)
|
|||
if (!window->shortcut().isEmpty()) {
|
||||
if (action == nullptr) { // new shortcut
|
||||
action = new QAction(this);
|
||||
connect(window, &Window::closed, action, [action]() {
|
||||
KGlobalAccel::self()->removeAllShortcuts(action);
|
||||
delete action;
|
||||
});
|
||||
|
||||
action->setProperty("componentName", QStringLiteral("kwin"));
|
||||
action->setObjectName(key);
|
||||
action->setText(i18n("Activate Window (%1)", window->caption()));
|
||||
|
|
|
@ -836,10 +836,6 @@ void Workspace::removeWindow(Window *window)
|
|||
if (m_windowKeysWindow == window) {
|
||||
setupWindowShortcutDone(false);
|
||||
}
|
||||
if (!window->shortcut().isEmpty()) {
|
||||
window->setShortcut(QString()); // Remove from client_keys
|
||||
windowShortcutUpdated(window); // Needed, since this is otherwise delayed by setShortcut() and wouldn't run
|
||||
}
|
||||
if (window->hasStrut()) {
|
||||
updateClientArea();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue