Replace delegate slots for window shortcut by std::bind expressions
Summary: Client had a slot to delay a call when setting up a global shortcut for the Client. This can be simplified by using a std::bind expression. Similar the action was connected to a one line lambda which can be expressed through a std::bind expression as well. Test Plan: New added auto test still passes Reviewers: #kwin, #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D6801
This commit is contained in:
parent
c8c15f0057
commit
150a0357b4
2 changed files with 2 additions and 14 deletions
3
client.h
3
client.h
|
@ -392,9 +392,6 @@ protected:
|
||||||
QSize resizeIncrements() const override;
|
QSize resizeIncrements() const override;
|
||||||
bool acceptsFocus() const override;
|
bool acceptsFocus() const override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void delayedSetShortcut();
|
|
||||||
|
|
||||||
//Signals for the scripting interface
|
//Signals for the scripting interface
|
||||||
//Signals make an excellent way for communication
|
//Signals make an excellent way for communication
|
||||||
//in between objects as compared to simple function
|
//in between objects as compared to simple function
|
||||||
|
|
|
@ -1055,11 +1055,7 @@ void Workspace::clientShortcutUpdated(AbstractClient* c)
|
||||||
action->setProperty("componentName", QStringLiteral(KWIN_NAME));
|
action->setProperty("componentName", QStringLiteral(KWIN_NAME));
|
||||||
action->setObjectName(key);
|
action->setObjectName(key);
|
||||||
action->setText(i18n("Activate Window (%1)", c->caption()));
|
action->setText(i18n("Activate Window (%1)", c->caption()));
|
||||||
connect(action, &QAction::triggered, c,
|
connect(action, &QAction::triggered, c, std::bind(&Workspace::activateClient, this, c, true));
|
||||||
[c]() {
|
|
||||||
workspace()->activateClient(c, true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no autoloading, since it's configured explicitly here and is not meant to be reused
|
// no autoloading, since it's configured explicitly here and is not meant to be reused
|
||||||
|
@ -1842,15 +1838,10 @@ void Client::setShortcutInternal()
|
||||||
// Workaround for kwin<->kglobalaccel deadlock, when KWin has X grab and the kded
|
// Workaround for kwin<->kglobalaccel deadlock, when KWin has X grab and the kded
|
||||||
// kglobalaccel module tries to create the key grab. KWin should preferably grab
|
// kglobalaccel module tries to create the key grab. KWin should preferably grab
|
||||||
// they keys itself anyway :(.
|
// they keys itself anyway :(.
|
||||||
QTimer::singleShot(0, this, SLOT(delayedSetShortcut()));
|
QTimer::singleShot(0, this, std::bind(&Workspace::clientShortcutUpdated, workspace(), this));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::delayedSetShortcut()
|
|
||||||
{
|
|
||||||
workspace()->clientShortcutUpdated(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Workspace::shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore) const
|
bool Workspace::shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore) const
|
||||||
{
|
{
|
||||||
if (ignore && cut == ignore->shortcut())
|
if (ignore && cut == ignore->shortcut())
|
||||||
|
|
Loading…
Reference in a new issue