From f8c8380275d972dcd3981bde694a329d9d9cee03 Mon Sep 17 00:00:00 2001 From: Malte Starostik Date: Sat, 9 Jun 2001 05:00:46 +0000 Subject: [PATCH] Expose int currentDesktop() const via DCOP and added void nextDesktop() and void previousDesktop(), also available via DCOP. This makes it possible to use KGesture to cycle through desktops :) svn path=/trunk/kdebase/kwin/; revision=101071 --- KWinInterface.h | 4 +++- workspace.cpp | 10 ++++++++++ workspace.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/KWinInterface.h b/KWinInterface.h index e0419ac0fa..2cf828cd59 100644 --- a/KWinInterface.h +++ b/KWinInterface.h @@ -17,7 +17,9 @@ class KWinInterface : virtual public DCOPObject virtual void doNotManage(QString)= 0; virtual void showWindowMenuAt(unsigned long winId, int x, int y)= 0; virtual void setCurrentDesktop(int)= 0; - + virtual int currentDesktop() const = 0; + virtual void nextDesktop() = 0; + virtual void previousDesktop() = 0; }; #endif diff --git a/workspace.cpp b/workspace.cpp index ad5d80ac49..940d8f7c4a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2250,7 +2250,17 @@ void Workspace::setCurrentDesktop( int new_desktop ){ } } +void Workspace::nextDesktop() +{ + int desktop = currentDesktop() + 1; + setCurrentDesktop(desktop > numberOfDesktops() ? 1 : desktop); +} +void Workspace::previousDesktop() +{ + int desktop = currentDesktop() - 1; + setCurrentDesktop(desktop ? desktop : numberOfDesktops()); +} /*! Returns the workspace's desktop widget. The desktop widget is diff --git a/workspace.h b/workspace.h index 852fc8a538..c388ce687f 100644 --- a/workspace.h +++ b/workspace.h @@ -211,6 +211,8 @@ public: void unclutterDesktop(); void doNotManage(QString); void setCurrentDesktop( int new_desktop ); + void nextDesktop(); + void previousDesktop(); QString desktopName( int desk );