Revert part of r43092.
* Caching of CountItems() to avoid calling it at each loop iteration * Use of strcasecmp when comparing strings for exact equality
This commit is contained in:
@@ -787,7 +787,7 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
|
|||||||
((1 << current_workspace())
|
((1 << current_workspace())
|
||||||
& wInfo->workspaces) != 0);
|
& wInfo->workspaces) != 0);
|
||||||
|
|
||||||
if (strcasecmp(wInfo->name,
|
if (strcmp(wInfo->name,
|
||||||
item->FullTitle()) != 0)
|
item->FullTitle()) != 0)
|
||||||
item->SetLabel(wInfo->name);
|
item->SetLabel(wInfo->name);
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ TWindowMenu::AttachedToWindow()
|
|||||||
|
|
||||||
int32 parentMenuItems = 0;
|
int32 parentMenuItems = 0;
|
||||||
|
|
||||||
for (int32 i = 0; i < fTeam->CountItems(); i++) {
|
int32 teamCount = fTeam->CountItems();
|
||||||
|
for (int32 i = 0; i < teamCount; i++) {
|
||||||
team_id theTeam = (team_id)fTeam->ItemAt(i);
|
team_id theTeam = (team_id)fTeam->ItemAt(i);
|
||||||
int32 tokenCount = 0;
|
int32 tokenCount = 0;
|
||||||
int32* tokens = get_token_list(theTeam, &tokenCount);
|
int32* tokens = get_token_list(theTeam, &tokenCount);
|
||||||
@@ -130,7 +131,11 @@ TWindowMenu::AttachedToWindow()
|
|||||||
&& (wInfo->show_hide_level <= 0 || wInfo->is_mini)) {
|
&& (wInfo->show_hide_level <= 0 || wInfo->is_mini)) {
|
||||||
// Don't add new items if we're expanded. We've already done
|
// Don't add new items if we're expanded. We've already done
|
||||||
// this, they've just been moved.
|
// this, they've just been moved.
|
||||||
for (int32 addIndex = 0; addIndex < CountItems(); addIndex++) {
|
int32 numItems = CountItems();
|
||||||
|
|
||||||
|
// Find first item that sorts alphabetically after this window,
|
||||||
|
// so we know where to put it
|
||||||
|
for (int32 addIndex = 0; addIndex < numItems; addIndex++) {
|
||||||
TWindowMenuItem* item
|
TWindowMenuItem* item
|
||||||
= static_cast<TWindowMenuItem*>(ItemAt(addIndex));
|
= static_cast<TWindowMenuItem*>(ItemAt(addIndex));
|
||||||
if (item != NULL
|
if (item != NULL
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ TWindowMenuItem::SetLabel(const char* string)
|
|||||||
Frame().Width() - contLoc.x - 3.0f);
|
Frame().Width() - contLoc.x - 3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp(Label(), truncatedTitle.String()) != 0)
|
if (strcmp(Label(), truncatedTitle.String()) != 0)
|
||||||
BMenuItem::SetLabel(truncatedTitle.String());
|
BMenuItem::SetLabel(truncatedTitle.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,18 +149,13 @@ TWindowMenuItem::FullTitle() const
|
|||||||
TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
|
TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
|
||||||
TWindowMenuItem* newItem)
|
TWindowMenuItem* newItem)
|
||||||
{
|
{
|
||||||
int32 index = 0;
|
for (int32 index = startIndex;; index++) {
|
||||||
|
|
||||||
for (index = startIndex;; index++) {
|
|
||||||
TWindowMenuItem* item
|
TWindowMenuItem* item
|
||||||
= dynamic_cast<TWindowMenuItem*>(menu->ItemAt(index));
|
= dynamic_cast<TWindowMenuItem*>(menu->ItemAt(index));
|
||||||
if (item == NULL || NaturalCompare(item->FullTitle(),
|
if (item == NULL || NaturalCompare(item->FullTitle(),
|
||||||
newItem->FullTitle()) > 0)
|
newItem->FullTitle()) > 0)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we should never get here
|
|
||||||
return index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user