Changeset View
Changeset View
Standalone View
Standalone View
useractions.cpp
Show First 20 Lines • Show All 1049 Lines • ▼ Show 20 Line(s) | 1048 | { | |||
---|---|---|---|---|---|
1050 | QAction* action = findChild<QAction*>(key); | 1050 | QAction* action = findChild<QAction*>(key); | ||
1051 | if (!c->shortcut().isEmpty()) { | 1051 | if (!c->shortcut().isEmpty()) { | ||
1052 | if (action == NULL) { // new shortcut | 1052 | if (action == NULL) { // new shortcut | ||
1053 | action = new QAction(this); | 1053 | action = new QAction(this); | ||
1054 | kwinApp()->platform()->setupActionForGlobalAccel(action); | 1054 | kwinApp()->platform()->setupActionForGlobalAccel(action); | ||
1055 | action->setProperty("componentName", QStringLiteral(KWIN_NAME)); | 1055 | action->setProperty("componentName", QStringLiteral(KWIN_NAME)); | ||
1056 | action->setObjectName(key); | 1056 | action->setObjectName(key); | ||
1057 | action->setText(i18n("Activate Window (%1)", c->caption())); | 1057 | action->setText(i18n("Activate Window (%1)", c->caption())); | ||
1058 | connect(action, &QAction::triggered, c, | 1058 | connect(action, &QAction::triggered, c, std::bind(&Workspace::activateClient, this, c, true)); | ||
1059 | [c]() { | | |||
1060 | workspace()->activateClient(c, true); | | |||
1061 | } | | |||
1062 | ); | | |||
1063 | } | 1059 | } | ||
1064 | 1060 | | |||
1065 | // no autoloading, since it's configured explicitly here and is not meant to be reused | 1061 | // no autoloading, since it's configured explicitly here and is not meant to be reused | ||
1066 | // (the key is the window id anyway, which is kind of random) | 1062 | // (the key is the window id anyway, which is kind of random) | ||
1067 | KGlobalAccel::self()->setShortcut(action, QList<QKeySequence>() << c->shortcut(), | 1063 | KGlobalAccel::self()->setShortcut(action, QList<QKeySequence>() << c->shortcut(), | ||
1068 | KGlobalAccel::NoAutoloading); | 1064 | KGlobalAccel::NoAutoloading); | ||
1069 | action->setEnabled(true); | 1065 | action->setEnabled(true); | ||
1070 | } else { | 1066 | } else { | ||
▲ Show 20 Lines • Show All 766 Lines • ▼ Show 20 Line(s) | |||||
1837 | { | 1833 | { | ||
1838 | updateCaption(); | 1834 | updateCaption(); | ||
1839 | #if 0 | 1835 | #if 0 | ||
1840 | workspace()->clientShortcutUpdated(this); | 1836 | workspace()->clientShortcutUpdated(this); | ||
1841 | #else | 1837 | #else | ||
1842 | // Workaround for kwin<->kglobalaccel deadlock, when KWin has X grab and the kded | 1838 | // Workaround for kwin<->kglobalaccel deadlock, when KWin has X grab and the kded | ||
1843 | // kglobalaccel module tries to create the key grab. KWin should preferably grab | 1839 | // kglobalaccel module tries to create the key grab. KWin should preferably grab | ||
1844 | // they keys itself anyway :(. | 1840 | // they keys itself anyway :(. | ||
1845 | QTimer::singleShot(0, this, SLOT(delayedSetShortcut())); | 1841 | QTimer::singleShot(0, this, std::bind(&Workspace::clientShortcutUpdated, workspace(), this)); | ||
1846 | #endif | 1842 | #endif | ||
1847 | } | 1843 | } | ||
1848 | 1844 | | |||
1849 | void Client::delayedSetShortcut() | | |||
1850 | { | | |||
1851 | workspace()->clientShortcutUpdated(this); | | |||
1852 | } | | |||
1853 | | ||||
1854 | bool Workspace::shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore) const | 1845 | bool Workspace::shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore) const | ||
1855 | { | 1846 | { | ||
1856 | if (ignore && cut == ignore->shortcut()) | 1847 | if (ignore && cut == ignore->shortcut()) | ||
1857 | return true; | 1848 | return true; | ||
1858 | 1849 | | |||
1859 | if (!KGlobalAccel::getGlobalShortcutsByKey(cut).isEmpty()) { | 1850 | if (!KGlobalAccel::getGlobalShortcutsByKey(cut).isEmpty()) { | ||
1860 | return false; | 1851 | return false; | ||
1861 | } | 1852 | } | ||
Show All 10 Lines |