filter_result
MinimizeAllInputFilter::Filter(BMessage* message, BList* _list)
{
	switch (message->what) {
		case B_KEY_DOWN:
		{
			const char* bytes;
			if (message->FindString("bytes", &bytes) != B_OK)
				break;

			int32 modifiers;
			if (message->FindInt32("modifiers", &modifiers) != B_OK)
				break;

			int32 modifiersHeld = modifiers & (B_COMMAND_KEY
				| B_CONTROL_KEY | B_OPTION_KEY | B_MENU_KEY | B_SHIFT_KEY);

			bool minimize;
			if (modifiersHeld == (B_COMMAND_KEY | B_CONTROL_KEY))
				minimize = true;
			else if (modifiersHeld
					== (B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY)) {
				minimize = false;
			} else
				break;

			int32 cookie = 0;
			team_info teamInfo;
			while (get_next_team_info(&cookie, &teamInfo) == B_OK) {
				app_info appInfo;
				be_roster->GetRunningAppInfo(teamInfo.team, &appInfo);
				team_id team = appInfo.team;
				be_roster->ActivateApp(team);

				if (be_roster->GetActiveAppInfo(&appInfo) == B_OK
					&& (appInfo.flags & B_BACKGROUND_APP) == 0
					&& strcasecmp(appInfo.signature, kDeskbarSignature) != 0) {
					BRect zoomRect;
					if (minimize)
						do_minimize_team(zoomRect, team, false);
					else
						do_bring_to_front_team(zoomRect, team, false);
				}
			}

			return B_SKIP_MESSAGE;
		}
	}

	return B_DISPATCH_MESSAGE;
}
status_t 
TShowHideMenuItem::TeamShowHideCommon(int32 action, const BList *teamList, 
	BRect zoomRect, bool doZoom)
{
	if (teamList == NULL)
		return B_BAD_VALUE;

	int32 count = teamList->CountItems();
	for (int32 index = 0; index < count; index++) {
		team_id team = (team_id)teamList->ItemAt(index);

		switch (action) {
			case B_MINIMIZE_WINDOW:
				do_minimize_team(zoomRect, team, doZoom && index == 0);
				break;

			case B_BRING_TO_FRONT:
				do_bring_to_front_team(zoomRect, team, doZoom && index == 0);
				break;

			case B_QUIT_REQUESTED:
				{
					BMessenger messenger((char *)NULL, team);
					uint32 command = B_QUIT_REQUESTED;
					app_info aInfo;
					be_roster->GetRunningAppInfo(team, &aInfo);
	
					if (strcasecmp(aInfo.signature, kTrackerSignature) == 0)
						command = 'Tall';
					
					messenger.SendMessage(command);
					break;
				}
		}
	}

	return B_OK;
}