From 2a5c1f12b9c0452aa1c701e235d0d745285f827a Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 25 Feb 2013 11:57:18 -0500 Subject: [PATCH] Fix #9469 again in a better way. Pass fTime into the IsHidden() method to check the hidden state from the point of view of fTime which will ignore the hidden state. of the window. Remove the Hide(), Show(), and IsHidden() overrides in TimeView as they are no longer needed. Thanks Stippi and Axel. --- src/apps/deskbar/StatusView.cpp | 7 +++++-- src/apps/deskbar/TimeView.cpp | 22 ---------------------- src/apps/deskbar/TimeView.h | 3 --- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 947773f531..b25c7af420 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -433,7 +433,9 @@ TReplicantTray::ShowHideTime() if (fTime == NULL) return; - if (fTime->IsHidden()) + // Check from the point of view of fTime because we need to ignore + // whether or not the parent window is hidden. + if (fTime->IsHidden(fTime)) fTime->Show(); else fTime->Hide(); @@ -441,7 +443,8 @@ TReplicantTray::ShowHideTime() RealignReplicants(); AdjustPlacement(); - bool showClock = !fTime->IsHidden(); + // Check from the point of view of fTime ignoring parent's state. + bool showClock = !fTime->IsHidden(fTime); // Update showClock setting that gets saved to disk on quit ((TBarApp*)be_app)->Settings()->showClock = showClock; diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index 02e7162017..18217ebbe5 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -187,17 +187,6 @@ TTimeView::GetPreferredSize(float* width, float* height) } -void -TTimeView::Hide() -{ - // Prevent overflow - if (fShowLevel < INT16_MAX) - ++fShowLevel; - - BView::Hide(); -} - - void TTimeView::MessageReceived(BMessage* message) { @@ -307,17 +296,6 @@ TTimeView::ResizeToPreferred() } -void -TTimeView::Show() -{ - // Prevent underflow - if (fShowLevel > INT16_MIN) - --fShowLevel; - - BView::Show(); -} - - // # pragma mark - Public methods diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h index 9f28a1ca04..ba823dda06 100644 --- a/src/apps/deskbar/TimeView.h +++ b/src/apps/deskbar/TimeView.h @@ -88,13 +88,10 @@ public: void Draw(BRect update); void FrameMoved(BPoint); void GetPreferredSize(float* width, float* height); - void Hide(); - bool IsHidden() const { return fShowLevel > 0; }; void MessageReceived(BMessage*); void MouseDown(BPoint where); void Pulse(); void ResizeToPreferred(); - void Show(); bool Orientation() const; void SetOrientation(bool o);