* _ActivateApp() did not lock the window list while traversing it.
* It will now first iterate through the windows on the current workspace to choose the topmost window of this team (for this, it would be nice to have a sorted list over all windows/workspaces). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26950 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -667,10 +667,26 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
status_t
|
status_t
|
||||||
Desktop::_ActivateApp(team_id team)
|
Desktop::_ActivateApp(team_id team)
|
||||||
{
|
{
|
||||||
status_t status = B_BAD_TEAM_ID;
|
// search for an unhidden window in the current workspace
|
||||||
|
|
||||||
|
LockSingleWindow();
|
||||||
|
|
||||||
|
for (Window* window = _CurrentWindows().LastWindow(); window != NULL;
|
||||||
|
window = window->PreviousWindow(fCurrentWorkspace)) {
|
||||||
|
if (!window->IsHidden() && window->IsNormal()
|
||||||
|
&& window->ServerWindow()->ClientTeam() == team) {
|
||||||
|
ActivateWindow(window);
|
||||||
|
UnlockSingleWindow();
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnlockSingleWindow();
|
||||||
|
|
||||||
// search for an unhidden window to give focus to
|
// search for an unhidden window to give focus to
|
||||||
|
|
||||||
|
AutoWriteLocker locker(fWindowLock);
|
||||||
|
|
||||||
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
// if window is a normal window of the team, and not hidden,
|
// if window is a normal window of the team, and not hidden,
|
||||||
@@ -682,7 +698,7 @@ Desktop::_ActivateApp(team_id team)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user