diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index c6949f90a2..03ff77069d 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -660,6 +660,7 @@ TBarApp::MessageReceived(BMessage* message) } // fall-through + case kRealignReplicants: case kShowHideTime: case kShowSeconds: case kShowDayOfWeek: diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h index 362b62db0b..d85763848d 100644 --- a/src/apps/deskbar/BarApp.h +++ b/src/apps/deskbar/BarApp.h @@ -76,6 +76,9 @@ const int32 kIconCacheCount = (kMaximumIconSize - kMinimumIconSize) // update preferences message constant const uint32 kUpdatePreferences = 'Pref'; +// realign replicants message constant +const uint32 kRealignReplicants = 'Algn'; + /* --------------------------------------------- */ class BBitmap; diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 64f478d6e7..22b0aaa7c6 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -251,6 +251,7 @@ TBarView::MessageReceived(BMessage* message) { switch (message->what) { case B_LOCALE_CHANGED: + case kRealignReplicants: case kShowHideTime: case kShowSeconds: case kShowDayOfWeek: diff --git a/src/apps/deskbar/DeskbarMenu.cpp b/src/apps/deskbar/DeskbarMenu.cpp index 144b1bc5a7..ac4a288085 100644 --- a/src/apps/deskbar/DeskbarMenu.cpp +++ b/src/apps/deskbar/DeskbarMenu.cpp @@ -379,6 +379,7 @@ TDeskbarMenu::ResetTargets() case kRebootSystem: case kSuspendSystem: case kShutdownSystem: + case kRealignReplicants: case kShowHideTime: case kShowSeconds: case kShowDayOfWeek: diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 6d720fa7e2..7321ac6475 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -276,11 +276,8 @@ TReplicantTray::MessageReceived(BMessage* message) return; fTime->Update(); - // time string reformat -> realign - RealignReplicants(); - AdjustPlacement(); - break; + goto realignReplicants; case kShowHideTime: // from context menu in clock and in this view @@ -294,9 +291,7 @@ TReplicantTray::MessageReceived(BMessage* message) fTime->SetShowSeconds(!fTime->ShowSeconds()); // time string reformat -> realign - RealignReplicants(); - AdjustPlacement(); - break; + goto realignReplicants; case kShowDayOfWeek: if (fTime == NULL) @@ -305,9 +300,7 @@ TReplicantTray::MessageReceived(BMessage* message) fTime->SetShowDayOfWeek(!fTime->ShowDayOfWeek()); // time string reformat -> realign - RealignReplicants(); - AdjustPlacement(); - break; + goto realignReplicants; case kShowTimeZone: if (fTime == NULL) @@ -316,9 +309,7 @@ TReplicantTray::MessageReceived(BMessage* message) fTime->SetShowTimeZone(!fTime->ShowTimeZone()); // time string reformat -> realign - RealignReplicants(); - AdjustPlacement(); - break; + goto realignReplicants; case kGetClockSettings: { @@ -345,6 +336,12 @@ TReplicantTray::MessageReceived(BMessage* message) break; #endif + case kRealignReplicants: +realignReplicants: + RealignReplicants(); + AdjustPlacement(); + break; + default: BView::MessageReceived(message); break; diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index 8539a24554..a13edc3375 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -440,8 +440,20 @@ PowerStatusView::Update(bool force) width = 8; } - if (width != Bounds().Width()) + if (width != Bounds().Width()) { ResizeTo(width, Bounds().Height()); + + // inform Deskbar that it needs to realign its replicants + BWindow* window = Window(); + if (window != NULL) { + BView* view = window->FindView("Status"); + if (view != NULL) { + BMessenger target((BHandler*)view); + BMessage realignReplicants('Algn'); + target.SendMessage(&realignReplicants); + } + } + } } if (force || wasOnline != fOnline