* We now store the last window having focus in a separate array, or else the

windows visible on more than one workspace destroy the FFM experience (ie.
  restoring the last window that had focus on a workspace switch).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34207 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-24 15:28:12 +00:00
parent 5472c0c23e
commit 0b63cc935f
2 changed files with 8 additions and 1 deletions

View File

@ -339,6 +339,8 @@ Desktop::Desktop(uid_t userID, const char* targetScreen)
fFront(NULL),
fBack(NULL)
{
memset(fLastWorkspaceFocus, 0, sizeof(fLastWorkspaceFocus));
char name[B_OS_NAME_LENGTH];
Desktop::_GetLooperName(name, sizeof(name));
@ -2656,6 +2658,8 @@ Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
// window is on this workspace, is it anymore?
if (!workspace_in_workspaces(i, newWorkspaces)) {
_Windows(i).RemoveWindow(window);
if (fLastWorkspaceFocus[i] == window)
fLastWorkspaceFocus[i] = NULL;
if (i == CurrentWorkspace()) {
// remove its appearance from the current workspace
@ -3120,6 +3124,8 @@ Desktop::_SetWorkspace(int32 index, bool moveFocusWindow)
movedWindow->Anchor(index).position = movedWindow->Frame().LeftTop();
}
fLastWorkspaceFocus[previousIndex] = FocusWindow();
// build region of windows that are no longer visible in the new workspace
BRegion dirty;
@ -3248,7 +3254,7 @@ Desktop::_SetWorkspace(int32 index, bool moveFocusWindow)
// Set new focus, but keep focus to a floating window if still visible
if (!_Windows(index).HasWindow(FocusWindow())
|| !FocusWindow()->IsFloating())
SetFocusWindow();
SetFocusWindow(fLastWorkspaceFocus[index]);
_WindowChanged(NULL);
MarkDirty(dirty);

View File

@ -327,6 +327,7 @@ private:
WindowList fAllWindows;
WindowList fSubsetWindows;
WindowList fFocusList;
Window* fLastWorkspaceFocus[kMaxWorkspaces];
BObjectList<WorkspacesView> fWorkspacesViews;
BLocker fWorkspacesLock;