Fix a logic hole that would result in hidden teams being visible in switcher (sans icon) on ctrl+~. Fixes #4290.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2010-08-23 04:11:55 +00:00
parent c7dfa2ce78
commit f1684e3466
2 changed files with 28 additions and 14 deletions

View File

@ -308,7 +308,7 @@ OKToUse(const TTeamGroup* teamGroup)
if ((teamGroup->Flags() & B_BACKGROUND_APP) != 0)
return false;
// skip the Deakbar itself
// skip the Deskbar itself
if (strcasecmp(teamGroup->Signature(), kDeskbarSignature) == 0)
return false;
@ -856,6 +856,23 @@ TSwitchManager::CycleWindow(bool forward, bool wrap)
void
TSwitchManager::CycleApp(bool forward, bool activateNow)
{
int32 startIndex = fCurrentIndex;
if (_FindNextValidApp(forward)) {
// if we're here then we found a good one
SwitchToApp(startIndex, fCurrentIndex, forward);
if (!activateNow)
return;
ActivateApp(false, false);
}
}
bool
TSwitchManager::_FindNextValidApp(bool forward)
{
int32 startIndex = fCurrentIndex;
int32 max = fGroupList.CountItems();
@ -873,23 +890,15 @@ TSwitchManager::CycleApp(bool forward, bool activateNow)
if (fCurrentIndex == startIndex) {
// we've gone completely through the list without finding
// a good app. Oh well.
return;
break;
}
if (!OKToUse((TTeamGroup*)fGroupList.ItemAt(fCurrentIndex)))
continue;
// if we're here then we found a good one
SwitchToApp(startIndex, fCurrentIndex, forward);
if (!activateNow)
break;
if (ActivateApp(false, false))
break;
if (OKToUse((TTeamGroup*)fGroupList.ItemAt(fCurrentIndex)))
return true;
}
}
return false;
}
void
TSwitchManager::SwitchToApp(int32 previousIndex, int32 newIndex, bool forward)
@ -897,6 +906,9 @@ TSwitchManager::SwitchToApp(int32 previousIndex, int32 newIndex, bool forward)
int32 previousSlot = fCurrentSlot;
fCurrentIndex = newIndex;
if (!OKToUse((TTeamGroup *)fGroupList.ItemAt(fCurrentIndex)))
_FindNextValidApp(forward);
fCurrentSlot = fWindow->SlotOf(fCurrentIndex);
fCurrentWindow = 0;

View File

@ -85,6 +85,8 @@ private:
bool allowWorkspaceSwitch);
void ActivateWindow(int32 windowID = -1);
void _SortApps();
bool _FindNextValidApp(bool forward);
TSwitcherWindow* fWindow;
sem_id fMainMonitor;