* When switching to a workspace a window is on in ActivateWindow(), only

consider the workspaces in the configured count.
* If the window is not on the current workspace after the workspace check,
  always move it to the current instead. This lets windows on workspaces
  outside of the ones currently configured show up on the current workspace
  as if they had the B_NOT_ANCHORED_ON_ACTIVATE flag set.
* This fixes bug #3003.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28549 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-11-07 11:36:22 +00:00
parent d2057da780
commit c73be1e843

View File

@ -1489,7 +1489,7 @@ Desktop::SetFocusLocked(const Window* window)
fLockedFocusWindow = window; fLockedFocusWindow = window;
} }
void void
Desktop::_BringWindowsToFront(WindowList& windows, int32 list, Desktop::_BringWindowsToFront(WindowList& windows, int32 list,
@ -1559,13 +1559,13 @@ Desktop::ActivateWindow(Window* window)
return; return;
bool windowOnOtherWorkspace = !window->InWorkspace(fCurrentWorkspace); bool windowOnOtherWorkspace = !window->InWorkspace(fCurrentWorkspace);
if (windowOnOtherWorkspace) { if (windowOnOtherWorkspace
if ((window->Flags() & B_NO_WORKSPACE_ACTIVATION) == 0 && (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) {
&& (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) { if ((window->Flags() & B_NO_WORKSPACE_ACTIVATION) == 0) {
// switch to the workspace on which this window is // Switch to the workspace on which this window is
// (we'll take the first one that the window is on) // (we'll take the first one that the window is on)
uint32 workspaces = window->Workspaces(); uint32 workspaces = window->Workspaces();
for (int32 i = 0; i < 32; i++) { for (int32 i = 0; i < fSettings->WorkspacesCount(); i++) {
uint32 workspace = workspace_to_workspaces(i); uint32 workspace = workspace_to_workspaces(i);
if (workspaces & workspace) { if (workspaces & workspace) {
SetWorkspace(i); SetWorkspace(i);
@ -1573,15 +1573,14 @@ Desktop::ActivateWindow(Window* window)
break; break;
} }
} }
} else if ((window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) { } else {
UnlockAllWindows(); UnlockAllWindows();
return; return;
} }
} }
if (windowOnOtherWorkspace if (windowOnOtherWorkspace) {
&& (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) != 0) { // Bring the window to the current workspace
// bring the window to the current workspace
// TODO: what if this window is on multiple workspaces?!? // TODO: what if this window is on multiple workspaces?!?
uint32 workspaces = workspace_to_workspaces(fCurrentWorkspace); uint32 workspaces = workspace_to_workspaces(fCurrentWorkspace);
SetWindowWorkspaces(window, workspaces); SetWindowWorkspaces(window, workspaces);