From 10baa96bc7af6973b867a198f99832dbf83e25b8 Mon Sep 17 00:00:00 2001 From: Henrik Johnson Date: Fri, 11 May 2001 21:38:00 +0000 Subject: [PATCH] Add key bindings to move current window to next/previous desktop svn path=/trunk/kdebase/kwin/; revision=96538 --- kwinbindings.cpp | 2 ++ workspace.cpp | 25 +++++++++++++++++++++++++ workspace.h | 3 +++ 3 files changed, 30 insertions(+) diff --git a/kwinbindings.cpp b/kwinbindings.cpp index 9987433a36..8a5f4e9f94 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -33,6 +33,8 @@ keys->insertItem(i18n("Window raise"),"Window raise", ""); keys->insertItem(i18n("Window lower"),"Window lower", ""); keys->insertItem(i18n("Window raise-or-lower"), "Toggle raise and lower", ""); + keys->insertItem(i18n("Window to next desktop"),"Window to next desktop", ""); + keys->insertItem(i18n("Window to previous desktop"),"Window to previous desktop", ""); keys->insertItem(i18n("Walk through desktops"),"Walk through desktops", "CTRL+Tab"); keys->insertItem(i18n("Walk back through desktops"),"Walk back through desktops", "SHIFT+CTRL+Tab"); diff --git a/workspace.cpp b/workspace.cpp index e4de1c592c..740f1b219f 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2388,6 +2388,8 @@ void Workspace::createKeybindings(){ keys->connectItem( "Window raise", this, SLOT( slotWindowRaise() ) ); keys->connectItem( "Window lower", this, SLOT( slotWindowLower() ) ); keys->connectItem( "Toggle raise and lower", this, SLOT( slotWindowRaiseOrLower() ) ); + keys->connectItem( "Window to next desktop", this, SLOT( slotWindowNextDesktop() ) ); + keys->connectItem( "Window to previous desktop", this, SLOT( slotWindowPreviousDesktop() ) ); keys->connectItem( "Walk through desktops", this, SLOT( slotWalkThroughDesktops())); keys->connectItem( "Walk back through desktops", this, SLOT( slotWalkBackThroughDesktops())); @@ -2568,6 +2570,29 @@ void Workspace::slotWindowRaiseOrLower() raiseOrLowerClient( popup_client ); } +/*! + Move window to next desktop + */ +void Workspace::slotWindowNextDesktop(){ + int d = currentDesktop() + 1; + if ( d > numberOfDesktops() ) + d = 1; + if (popup_client) + sendClientToDesktop(popup_client,d); + setCurrentDesktop(d); +} + +/*! + Move window to previous desktop + */ +void Workspace::slotWindowPreviousDesktop(){ + int d = currentDesktop() - 1; + if ( d <= 0 ) + d = numberOfDesktops(); + if (popup_client) + sendClientToDesktop(popup_client,d); + setCurrentDesktop(d); +} /*! Invokes keyboard mouse emulation diff --git a/workspace.h b/workspace.h index 56aae3b4f3..aa9b03fc40 100644 --- a/workspace.h +++ b/workspace.h @@ -250,6 +250,9 @@ public slots: void slotWindowMove(); void slotWindowResize(); + void slotWindowNextDesktop(); + void slotWindowPreviousDesktop(); + void slotMouseEmulation(); void slotResetAllClientsDelayed();