* Added the BeOS feature that Command-~ (with American keymap) will switch

workspaces between this and the previous one.
* Note that this is mapped to a specific key on the keyboard (key 17), so
  it will differ with the keymap, but will usually be the key below the escape
  key.
* This closes ticket #2766.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28282 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-22 12:02:49 +00:00
parent 89b1afd16c
commit 4932bc5ea8
2 changed files with 10 additions and 2 deletions
+9 -2
View File
@@ -173,6 +173,9 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
fDesktop->SetWorkspaceAsync(key - 2); fDesktop->SetWorkspaceAsync(key - 2);
return B_SKIP_MESSAGE; 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"), fApplicationsLock("application list"),
fShutdownSemaphore(-1), fShutdownSemaphore(-1),
fCurrentWorkspace(0), fCurrentWorkspace(0),
fPreviousWorkspace(0),
fAllWindows(kAllWindowList), fAllWindows(kAllWindowList),
fSubsetWindows(kSubsetList), fSubsetWindows(kSubsetList),
fFocusList(kFocusList), fFocusList(kFocusList),
@@ -633,6 +637,9 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
int32 index; int32 index;
link.Read<int32>(&index); link.Read<int32>(&index);
if (index == -1)
index = fPreviousWorkspace;
SetWorkspace(index); SetWorkspace(index);
break; 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. You must hold the all window lock when calling this method.
*/ */
void void
@@ -946,6 +952,7 @@ Desktop::_SetWorkspace(int32 index)
window->SetCurrentWorkspace(-1); window->SetCurrentWorkspace(-1);
} }
fPreviousWorkspace = fCurrentWorkspace;
fCurrentWorkspace = index; fCurrentWorkspace = index;
// show windows, and include them in the changed region - but only // show windows, and include them in the changed region - but only
+1
View File
@@ -279,6 +279,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
::Workspace::Private fWorkspaces[kMaxWorkspaces]; ::Workspace::Private fWorkspaces[kMaxWorkspaces];
int32 fCurrentWorkspace; int32 fCurrentWorkspace;
int32 fPreviousWorkspace;
WindowList fAllWindows; WindowList fAllWindows;
WindowList fSubsetWindows; WindowList fSubsetWindows;