[haiku-commits] haiku: hrev51421 - src/apps/deskbar

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 14 Sep 2017 00:32:02 +0200 (CEST)

hrev51421 adds 2 changesets to branch 'master'
old head: e03db9304f2a14cf9222d6da84068092e9ca21c1
new head: 6d7890478b78265f4670978a58384fb438de0007
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=6d7890478b78+%5Ee03db9304f2a

----------------------------------------------------------------------------

ff8f17e7efe5: Deskbar: minor style fix
  
  minor whitespace fix in ExpandoMenuBar

6d7890478b78: Deskbar: eliminate infinite loop bug
  
  TBarWindow::FrameResized() calls TBarView::UpdatePlacement() to
  resize the ExpandoMenuBar, however, UpdatePlacement() as part of its
  work also resizes the window, which calls TBarWindow::FrameResized()
  which in turn calls TBarView::UpdatePlacement() and so on.
  
  To get out of this mess remove TBarView::UpdatePlacement() from
  TBarWindow::FrameResized() but that leaves ExpandoMenuBar the
  wrong size initially.
  
  To fix this call SizeWindow() on AllAttached() which resizes
  ExpandoMenuBar along with the rest of the window, but, just once not in
  an infinite loop. Use AllAttached() rather than AttachedToWindow() so that
  we are assured that ExpandoMenuBar and all of its children have been
  attached thus avoiding the potential for an embarrasing Deskbar crash.
  
  Fixes #13706

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 12 insertions(+), 4 deletions(-)
src/apps/deskbar/BarApp.cpp         |  4 ++--
src/apps/deskbar/BarWindow.cpp      |  1 -
src/apps/deskbar/ExpandoMenuBar.cpp | 10 +++++++++-
src/apps/deskbar/ExpandoMenuBar.h   |  1 +

############################################################################

Commit:      ff8f17e7efe59ce3e7e3a9125d3819ec0a3c36c1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ff8f17e7efe5
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Wed Sep 13 01:42:17 2017 UTC

Deskbar: minor style fix

minor whitespace fix in ExpandoMenuBar

----------------------------------------------------------------------------

diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 0034179..daad133 100644
--- a/src/apps/deskbar/BarApp.cpp
+++ b/src/apps/deskbar/BarApp.cpp
@@ -480,8 +480,8 @@ TBarApp::MessageReceived(BMessage* message)
                        break;
 
                case kAutoRaise:
-                       fSettings.autoRaise = fSettings.alwaysOnTop ? false :
-                               !fSettings.autoRaise;
+                       fSettings.autoRaise = fSettings.alwaysOnTop ? false
+                               : !fSettings.autoRaise;
 
                        if (fPreferencesWindow != NULL)
                                
fPreferencesWindow->PostMessage(kUpdatePreferences);
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp 
b/src/apps/deskbar/ExpandoMenuBar.cpp
index eb7f8f1..1e2850c 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -504,7 +504,6 @@ TExpandoMenuBar::BuildItems()
 
                        if (fFirstBuild && fVertical && 
settings->expandNewTeams)
                                item->ToggleExpandState(true);
-
                } else {
                        // existing team, update info and add it
                        TTeamMenuItem* item = iter->second;

############################################################################

Revision:    hrev51421
Commit:      6d7890478b78265f4670978a58384fb438de0007
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6d7890478b78
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Wed Sep 13 22:19:33 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/13706

Deskbar: eliminate infinite loop bug

TBarWindow::FrameResized() calls TBarView::UpdatePlacement() to
resize the ExpandoMenuBar, however, UpdatePlacement() as part of its
work also resizes the window, which calls TBarWindow::FrameResized()
which in turn calls TBarView::UpdatePlacement() and so on.

To get out of this mess remove TBarView::UpdatePlacement() from
TBarWindow::FrameResized() but that leaves ExpandoMenuBar the
wrong size initially.

To fix this call SizeWindow() on AllAttached() which resizes
ExpandoMenuBar along with the rest of the window, but, just once not in
an infinite loop. Use AllAttached() rather than AttachedToWindow() so that
we are assured that ExpandoMenuBar and all of its children have been
attached thus avoiding the potential for an embarrasing Deskbar crash.

Fixes #13706

----------------------------------------------------------------------------

diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp
index e57c4e2..db38219 100644
--- a/src/apps/deskbar/BarWindow.cpp
+++ b/src/apps/deskbar/BarWindow.cpp
@@ -252,7 +252,6 @@ TBarWindow::FrameResized(float width, float height)
                if (fBarView->Vertical() && fBarView->ExpandoState())
                        fBarView->ExpandoMenuBar()->SetMaxContentWidth(width);
 
-               fBarView->UpdatePlacement();
                Unlock();
        }
 }
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp 
b/src/apps/deskbar/ExpandoMenuBar.cpp
index 1e2850c..643d013 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -114,6 +114,15 @@ TExpandoMenuBar::TExpandoMenuBar(TBarView* barView, bool 
vertical)
 
 
 void
+TExpandoMenuBar::AllAttached()
+{
+       BMenuBar::AllAttached();
+
+       SizeWindow(0);
+}
+
+
+void
 TExpandoMenuBar::AttachedToWindow()
 {
        BMenuBar::AttachedToWindow();
diff --git a/src/apps/deskbar/ExpandoMenuBar.h 
b/src/apps/deskbar/ExpandoMenuBar.h
index 5f338c5..1aa2e86 100644
--- a/src/apps/deskbar/ExpandoMenuBar.h
+++ b/src/apps/deskbar/ExpandoMenuBar.h
@@ -63,6 +63,7 @@ class TExpandoMenuBar : public BMenuBar {
 public:
                                                        
TExpandoMenuBar(TBarView* barView, bool vertical);
 
+       virtual void                    AllAttached();
        virtual void                    AttachedToWindow();
        virtual void                    DetachedFromWindow();
 


Other related posts:

  • » [haiku-commits] haiku: hrev51421 - src/apps/deskbar - jscipione