diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index b3308c4099..9d45a3525a 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -453,7 +453,7 @@ TBarApp::MessageReceived(BMessage* message) fSettings.trackerAlwaysFirst = !fSettings.trackerAlwaysFirst; fBarWindow->Lock(); - BarView()->UpdatePlacement(); + BarView()->PlaceApplicationBar(); fBarWindow->Unlock(); break; @@ -461,7 +461,7 @@ TBarApp::MessageReceived(BMessage* message) fSettings.sortRunningApps = !fSettings.sortRunningApps; fBarWindow->Lock(); - BarView()->UpdatePlacement(); + BarView()->PlaceApplicationBar(); fBarWindow->Unlock(); break; @@ -477,7 +477,7 @@ TBarApp::MessageReceived(BMessage* message) fSettings.superExpando = !fSettings.superExpando; fBarWindow->Lock(); - BarView()->UpdatePlacement(); + BarView()->PlaceApplicationBar(); fBarWindow->Unlock(); break; @@ -485,7 +485,7 @@ TBarApp::MessageReceived(BMessage* message) fSettings.expandNewTeams = !fSettings.expandNewTeams; fBarWindow->Lock(); - BarView()->UpdatePlacement(); + BarView()->PlaceApplicationBar(); fBarWindow->Unlock(); break; @@ -493,7 +493,7 @@ TBarApp::MessageReceived(BMessage* message) fSettings.hideLabels = !fSettings.hideLabels; fBarWindow->Lock(); - BarView()->UpdatePlacement(); + BarView()->PlaceApplicationBar(); fBarWindow->Unlock(); break; @@ -514,7 +514,7 @@ TBarApp::MessageReceived(BMessage* message) ResizeTeamIcons(); fBarWindow->Lock(); - BarView()->UpdatePlacement(); + BarView()->PlaceApplicationBar(); fBarWindow->Unlock(); break; } @@ -759,6 +759,7 @@ TBarApp::ResizeTeamIcons() BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i); if ((barInfo->flags & B_BACKGROUND_APP) == 0 && strcasecmp(barInfo->sig, kDeskbarSignature) != 0) { + delete barInfo->icon; barInfo->icon = new BBitmap(IconRect(), kIconFormat); FetchAppIcon(barInfo->sig, barInfo->icon); } diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index c588b2c0b2..b15e384656 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -315,7 +315,7 @@ TBarView::PlaceDeskbarMenu() void -TBarView::PlaceTray(bool, bool, BRect screenFrame) +TBarView::PlaceTray(bool vertSwap, bool leftSwap) { BPoint statusLoc; if (fState == kFullState) { @@ -346,6 +346,7 @@ TBarView::PlaceTray(bool, bool, BRect screenFrame) else fReplicantTray->MoveTo(2, 2); } else { + BRect screenFrame = (BScreen(Window())).Frame(); statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width(); statusLoc.y = -1; } @@ -356,15 +357,23 @@ TBarView::PlaceTray(bool, bool, BRect screenFrame) void -TBarView::PlaceApplicationBar(BRect screenFrame) +TBarView::PlaceApplicationBar() { if (fExpando != NULL) { + SaveExpandedItems(); fExpando->RemoveSelf(); delete fExpando; fExpando = NULL; } - if (fState == kMiniState) + + BRect screenFrame = (BScreen(Window())).Frame(); + if (fState == kMiniState) { + SizeWindow(screenFrame); + PositionWindow(screenFrame); + Window()->UpdateIfNeeded(); + Invalidate(); return; + } BRect expandoFrame(0, 0, 0, 0); if (fVertical) { @@ -395,6 +404,14 @@ TBarView::PlaceApplicationBar(BRect screenFrame) fExpando = new TExpandoMenuBar(this, expandoFrame, "ExpandoMenuBar", fVertical, !hideLabels && fState != kFullState); AddChild(fExpando); + + if (fVertical) + ExpandItems(); + + SizeWindow(screenFrame); + PositionWindow(screenFrame); + Window()->UpdateIfNeeded(); + Invalidate(); } @@ -531,22 +548,9 @@ TBarView::ChangeState(int32 state, bool vertical, bool left, bool top) if (stateChanged || vertSwap) be_app->PostMessage(kStateChanged); - BRect screenFrame = (BScreen(Window())).Frame(); - PlaceDeskbarMenu(); - PlaceTray(vertSwap, leftSwap, screenFrame); - - // Keep track of which apps are expanded - SaveExpandedItems(); - - PlaceApplicationBar(screenFrame); - SizeWindow(screenFrame); - PositionWindow(screenFrame); - Window()->UpdateIfNeeded(); - - // Re-expand apps - ExpandItems(); - Invalidate(); + PlaceTray(vertSwap, leftSwap); + PlaceApplicationBar(); } diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index f222c18877..d81d1aa7a5 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -146,14 +146,15 @@ class TBarView : public BView { TReplicantTray* ReplicantTray() const { return fReplicantTray; } private: + friend class TBarApp; friend class TDeskbarMenu; friend class PreferencesWindow; status_t SendDragMessage(const char* signature, entry_ref* ref = NULL); void PlaceDeskbarMenu(); - void PlaceTray(bool vertSwap, bool leftSwap, BRect screenFrame); - void PlaceApplicationBar(BRect screenFrame); + void PlaceTray(bool vertSwap, bool leftSwap); + void PlaceApplicationBar(); void SaveExpandedItems(); void RemoveExpandedItems(); void ExpandItems();