* Implemented private functions do_minimize_team(), and do_bring_to_front_team()

used by the Deskbar (for "Hide All" and "Show All"). The latter doesn't work
  correctly yet, though, it just maximizes all windows of that application.
* Added a TODO to ServerWindow AS_MINIMIZE_WINDOW on how to make it work correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16315 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-02-09 18:53:36 +00:00
parent 995ab7b3c6
commit f877af82fe
6 changed files with 74 additions and 8 deletions

View File

@ -36,6 +36,8 @@ enum {
// Desktop definitions
AS_GET_WINDOW_LIST,
AS_GET_WINDOW_INFO,
AS_MINIMIZE_TEAM,
AS_BRING_TEAM_TO_FRONT,
// Application definitions
AS_CREATE_APP,

View File

@ -1055,16 +1055,28 @@ get_token_list(team_id team, int32 *_count)
void
do_bring_to_front_team(BRect zoomRect, team_id app, bool zoom)
do_bring_to_front_team(BRect zoomRect, team_id team, bool zoom)
{
// ToDo: implement me, needed for Deskbar!
BPrivate::AppServerLink link;
link.StartMessage(AS_BRING_TEAM_TO_FRONT);
link.Attach<team_id>(team);
// we don't have any zooming effect
link.Flush();
}
void
do_minimize_team(BRect zoomRect, team_id team, bool zoom)
{
// ToDo: implement me, needed for Deskbar!
BPrivate::AppServerLink link;
link.StartMessage(AS_MINIMIZE_TEAM);
link.Attach<team_id>(team);
// we don't have any zooming effect
link.Flush();
}

View File

@ -1710,6 +1710,40 @@ Desktop::FindWindowLayerByClientToken(int32 token, team_id teamID)
}
void
Desktop::MinimizeApplication(team_id team)
{
BAutolock locker(fWindowLock);
// Just minimize all windows of that application
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
window = window->NextWindow(kAllWindowList)) {
if (window->ServerWindow()->ClientTeam() != team)
continue;
window->ServerWindow()->NotifyMinimize(true);
}
}
void
Desktop::BringApplicationToFront(team_id team)
{
BAutolock locker(fWindowLock);
// TODO: for now, just maximize all windows of that application
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
window = window->NextWindow(kAllWindowList)) {
if (window->ServerWindow()->ClientTeam() != team)
continue;
window->ServerWindow()->NotifyMinimize(false);
}
}
void
Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender)
{

View File

@ -158,6 +158,9 @@ class Desktop : public MessageLooper, public ScreenOwner {
BRegion& BackgroundRegion()
{ return fBackgroundRegion; }
void MinimizeApplication(team_id team);
void BringApplicationToFront(team_id team);
void WriteWindowList(team_id team,
BPrivate::LinkSender& sender);
void WriteWindowInfo(int32 serverToken,

View File

@ -426,18 +426,32 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_GET_WINDOW_LIST:
{
team_id team;
link.Read<team_id>(&team);
fDesktop->WriteWindowList(team, fLink.Sender());
if (link.Read<team_id>(&team) == B_OK)
fDesktop->WriteWindowList(team, fLink.Sender());
break;
}
case AS_GET_WINDOW_INFO:
{
int32 serverToken;
link.Read<int32>(&serverToken);
if (link.Read<int32>(&serverToken) == B_OK)
fDesktop->WriteWindowInfo(serverToken, fLink.Sender());
break;
}
fDesktop->WriteWindowInfo(serverToken, fLink.Sender());
case AS_MINIMIZE_TEAM:
{
team_id team;
if (link.Read<team_id>(&team) == B_OK)
fDesktop->MinimizeApplication(team);
break;
}
case AS_BRING_TEAM_TO_FRONT:
{
team_id team;
if (link.Read<team_id>(&team) == B_OK)
fDesktop->BringApplicationToFront(team);
break;
}

View File

@ -574,6 +574,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
DTRACE(("ServerWindow %s: Message AS_MINIMIZE_WINDOW\n", Title()));
bool minimize;
if (link.Read<bool>(&minimize) == B_OK) {
// TODO: this actually needs to take the window's show/hide counter into account
if (minimize && !fWindowLayer->IsHidden())
Hide();
else if (!minimize && fWindowLayer->IsHidden())