diff --git a/kwinbindings.cpp b/kwinbindings.cpp --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -112,14 +112,14 @@ 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Top | QuickTileFlag::Right)); DEF4("Window Quick Tile Bottom Right", I18N_NOOP("Quick Tile Window to the Bottom Right"), 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Bottom | QuickTileFlag::Right)); -DEF2("Switch Window Up", I18N_NOOP("Switch to Window Above"), - Qt::META + Qt::ALT + Qt::Key_Up, slotSwitchWindowUp); -DEF2("Switch Window Down", I18N_NOOP("Switch to Window Below"), - Qt::META + Qt::ALT + Qt::Key_Down, slotSwitchWindowDown); -DEF2("Switch Window Right", I18N_NOOP("Switch to Window to the Right"), - Qt::META + Qt::ALT + Qt::Key_Right, slotSwitchWindowRight); -DEF2("Switch Window Left", I18N_NOOP("Switch to Window to the Left"), - Qt::META + Qt::ALT + Qt::Key_Left, slotSwitchWindowLeft); +DEF4("Switch Window Up", I18N_NOOP("Switch to Window Above"), + Qt::META + Qt::ALT + Qt::Key_Up, std::bind(static_cast(&Workspace::switchWindow), this, DirectionNorth)); +DEF4("Switch Window Down", I18N_NOOP("Switch to Window Below"), + Qt::META + Qt::ALT + Qt::Key_Down, std::bind(static_cast(&Workspace::switchWindow), this, DirectionSouth)); +DEF4("Switch Window Right", I18N_NOOP("Switch to Window to the Right"), + Qt::META + Qt::ALT + Qt::Key_Right, std::bind(static_cast(&Workspace::switchWindow), this, DirectionEast)); +DEF4("Switch Window Left", I18N_NOOP("Switch to Window to the Left"), + Qt::META + Qt::ALT + Qt::Key_Left, std::bind(static_cast(&Workspace::switchWindow), this, DirectionWest)); DEF2("Increase Opacity", I18N_NOOP("Increase Opacity of Active Window by 5 %"), 0, slotIncreaseWindowOpacity); DEF2("Decrease Opacity", I18N_NOOP("Decrease Opacity of Active Window by 5 %"), diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -150,11 +150,6 @@ SLOTWRAPPER(slotWindowShrinkHorizontal) SLOTWRAPPER(slotWindowShrinkVertical) -SLOTWRAPPER(slotSwitchWindowUp) -SLOTWRAPPER(slotSwitchWindowDown) -SLOTWRAPPER(slotSwitchWindowRight) -SLOTWRAPPER(slotSwitchWindowLeft) - SLOTWRAPPER(slotIncreaseWindowOpacity) SLOTWRAPPER(slotLowerWindowOpacity) @@ -194,6 +189,18 @@ #undef SLOTWRAPPER #define SLOTWRAPPER(name,direction) \ +void WorkspaceWrapper::name() { \ + Workspace::self()->switchWindow(Workspace::direction); \ +} + +SLOTWRAPPER(slotSwitchWindowUp, DirectionNorth) +SLOTWRAPPER(slotSwitchWindowDown, DirectionSouth) +SLOTWRAPPER(slotSwitchWindowRight, DirectionEast) +SLOTWRAPPER(slotSwitchWindowLeft, DirectionWest) + +#undef SLOTWRAPPER + +#define SLOTWRAPPER(name,direction) \ void WorkspaceWrapper::name( ) { \ VirtualDesktopManager::self()->moveTo(options->isRollOverDesktops()); \ } diff --git a/useractions.cpp b/useractions.cpp --- a/useractions.cpp +++ b/useractions.cpp @@ -1658,38 +1658,6 @@ } /*! - Switches to upper window - */ -void Workspace::slotSwitchWindowUp() -{ - switchWindow(DirectionNorth); -} - -/*! - Switches to lower window - */ -void Workspace::slotSwitchWindowDown() -{ - switchWindow(DirectionSouth); -} - -/*! - Switches to window on the right - */ -void Workspace::slotSwitchWindowRight() -{ - switchWindow(DirectionEast); -} - -/*! - Switches to window on the left - */ -void Workspace::slotSwitchWindowLeft() -{ - switchWindow(DirectionWest); -} - -/*! Shows the window operations popup menu for the activeClient() */ void Workspace::slotWindowOperations() diff --git a/workspace.h b/workspace.h --- a/workspace.h +++ b/workspace.h @@ -371,6 +371,14 @@ void quickTileWindow(QuickTileMode mode); + enum Direction { + DirectionNorth, + DirectionEast, + DirectionSouth, + DirectionWest + }; + void switchWindow(Direction direction); + public Q_SLOTS: void performWindowOperation(KWin::AbstractClient* c, Options::WindowOperation op); // Keybindings @@ -404,11 +412,6 @@ void slotWindowShrinkHorizontal(); void slotWindowShrinkVertical(); - void slotSwitchWindowUp(); - void slotSwitchWindowDown(); - void slotSwitchWindowRight(); - void slotSwitchWindowLeft(); - void slotIncreaseWindowOpacity(); void slotLowerWindowOpacity(); @@ -496,13 +499,6 @@ void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, Slot slot, const QVariant &data = QVariant()); void setupWindowShortcut(AbstractClient* c); - enum Direction { - DirectionNorth, - DirectionEast, - DirectionSouth, - DirectionWest - }; - void switchWindow(Direction direction); bool switchWindow(AbstractClient *c, Direction direction, QPoint curPos, int desktop); void propagateClients(bool propagate_new_clients); // Called only from updateStackingOrder