Use std::bind expression for Workspace::slotWindowtoDesktop
Summary: This way we don't need the sender() hack to get the value set on the QAction. Test Plan: New autotest in master still passes Reviewers: #kwin, #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D6811
This commit is contained in:
parent
7d3517060f
commit
c8c15f0057
3 changed files with 6 additions and 4 deletions
|
@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define DEF4( name, descr, key, functor ) \
|
||||
initShortcut(QStringLiteral(name), i18n(descr), key, functor);
|
||||
|
||||
#define DEF5( name, key, functor, value ) \
|
||||
initShortcut(QStringLiteral(name).arg(value), i18n(name, value), key, functor, value);
|
||||
|
||||
|
||||
DEF(I18N_NOOP("Walk Through Window Tabs"), 0, slotActivateNextTab);
|
||||
DEF(I18N_NOOP("Walk Through Window Tabs (Reverse)"), 0, slotActivatePrevTab);
|
||||
|
@ -129,7 +132,7 @@ DEF2("Window On All Desktops", I18N_NOOP("Keep Window on All Desktops"),
|
|||
0, slotWindowOnAllDesktops);
|
||||
|
||||
for (int i = 1; i < 21; ++i) {
|
||||
DEF3(I18N_NOOP("Window to Desktop %1"), 0, slotWindowToDesktop, i);
|
||||
DEF5(I18N_NOOP("Window to Desktop %1"), 0, std::bind(&Workspace::slotWindowToDesktop, this, i), i);
|
||||
}
|
||||
DEF(I18N_NOOP("Window to Next Desktop"), 0, slotWindowToNextDesktop);
|
||||
DEF(I18N_NOOP("Window to Previous Desktop"), 0, slotWindowToPreviousDesktop);
|
||||
|
|
|
@ -1247,10 +1247,9 @@ static uint senderValue(QObject *sender)
|
|||
|
||||
#define USABLE_ACTIVE_CLIENT (active_client && !(active_client->isDesktop() || active_client->isDock()))
|
||||
|
||||
void Workspace::slotWindowToDesktop()
|
||||
void Workspace::slotWindowToDesktop(uint i)
|
||||
{
|
||||
if (USABLE_ACTIVE_CLIENT) {
|
||||
const uint i = senderValue(sender());
|
||||
if (i < 1)
|
||||
return;
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ public Q_SLOTS:
|
|||
void performWindowOperation(KWin::AbstractClient* c, Options::WindowOperation op);
|
||||
// Keybindings
|
||||
//void slotSwitchToWindow( int );
|
||||
void slotWindowToDesktop();
|
||||
void slotWindowToDesktop(uint i);
|
||||
|
||||
//void slotWindowToListPosition( int );
|
||||
void slotSwitchToScreen();
|
||||
|
|
Loading…
Reference in a new issue