* When changing the workspace of a window, it's workspace position will now be

set to its current position if that is the only workspace it's in.
* This fixes missing windows on other workspaces in the Workspaces app after
  boot, ie. before you had visited that workspace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28204 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-10-17 01:31:44 +00:00
parent 4e59d9c7b4
commit 64ba396fa7
1 changed files with 18 additions and 0 deletions

View File

@ -2013,6 +2013,9 @@ Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
LockAllWindows();
// NOTE: we bypass the anchor-mechanism by intention when switching
// the workspace programmatically.
for (int32 i = 0; i < kMaxWorkspaces; i++) {
if (workspace_in_workspaces(i, oldWorkspaces)) {
// window is on this workspace, is it anymore?
@ -2048,6 +2051,21 @@ Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
}
}
// If the window is visible only on one workspace, we set it's current
// position in that workspace (so that WorkspacesView will find us).
int32 firstWorkspace = -1;
for (int32 i = 0; i < kMaxWorkspaces; i++) {
if ((newWorkspaces & (1L << i)) != 0) {
if (firstWorkspace != -1) {
firstWorkspace = -1;
break;
}
firstWorkspace = i;
}
}
if (firstWorkspace >= 0)
window->Anchor(firstWorkspace).position = window->Frame().LeftTop();
// take care about modals and floating windows
_UpdateSubsetWorkspaces(window);