diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 68d8a84ac1..593bb52e8d 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -173,6 +173,9 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target, fDesktop->SetWorkspaceAsync(key - 2); return B_SKIP_MESSAGE; } + } if (key == 0x11 && (modifiers & B_COMMAND_KEY) != 0) { + // switch to previous workspace + fDesktop->SetWorkspaceAsync(-1); } } @@ -296,6 +299,7 @@ Desktop::Desktop(uid_t userID) fApplicationsLock("application list"), fShutdownSemaphore(-1), fCurrentWorkspace(0), + fPreviousWorkspace(0), fAllWindows(kAllWindowList), fSubsetWindows(kSubsetList), fFocusList(kFocusList), @@ -633,6 +637,9 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) int32 index; link.Read(&index); + if (index == -1) + index = fPreviousWorkspace; + SetWorkspace(index); break; } @@ -885,8 +892,7 @@ Desktop::SetWorkspace(int32 index) } -/*! - Changes the current workspace to the one specified by \a index. +/*! Changes the current workspace to the one specified by \a index. You must hold the all window lock when calling this method. */ void @@ -946,6 +952,7 @@ Desktop::_SetWorkspace(int32 index) window->SetCurrentWorkspace(-1); } + fPreviousWorkspace = fCurrentWorkspace; fCurrentWorkspace = index; // show windows, and include them in the changed region - but only diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index 7009962617..710bdda189 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -279,6 +279,7 @@ class Desktop : public MessageLooper, public ScreenOwner { ::Workspace::Private fWorkspaces[kMaxWorkspaces]; int32 fCurrentWorkspace; + int32 fPreviousWorkspace; WindowList fAllWindows; WindowList fSubsetWindows;