[haiku-commits] r36369 - in haiku/trunk: headers/os/interface src/kits/interface

  • From: stefano.ceccherini@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 20 Apr 2010 14:37:08 +0200 (CEST)

Author: jackburton
Date: 2010-04-20 14:37:08 +0200 (Tue, 20 Apr 2010)
New Revision: 36369
Changeset: http://dev.haiku-os.org/changeset/36369/haiku
Ticket: http://dev.haiku-os.org/ticket/5717
Ticket: http://dev.haiku-os.org/ticket/3103

Modified:
   haiku/trunk/headers/os/interface/Menu.h
   haiku/trunk/src/kits/interface/Menu.cpp
Log:
Partially revert r35962, since the cure is worse than the sickness.
Should fix #5717 (but probably reopens #3103)


Modified: haiku/trunk/headers/os/interface/Menu.h
===================================================================
--- haiku/trunk/headers/os/interface/Menu.h     2010-04-20 08:17:07 UTC (rev 
36368)
+++ haiku/trunk/headers/os/interface/Menu.h     2010-04-20 12:37:08 UTC (rev 
36369)
@@ -245,7 +245,7 @@
                        bool                            _ChooseTrigger(const 
char* title, int32& index,
                                                                        uint32& 
trigger,
                                                                        
BPrivate::TriggerList& triggers);
-                       void                            _UpdateWindowViewSize();
+                       void                            
_UpdateWindowViewSize(const bool &updatePosition);
                        bool                            _OkToProceed(BMenuItem* 
item);
 
                        bool                            
_CustomTrackingWantsToQuit();

Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp     2010-04-20 08:17:07 UTC (rev 
36368)
+++ haiku/trunk/src/kits/interface/Menu.cpp     2010-04-20 12:37:08 UTC (rev 
36369)
@@ -398,7 +398,7 @@
        if (!fAttachAborted) {
                _CacheFontInfo();
                _LayoutItems(0);
-               _UpdateWindowViewSize();
+               _UpdateWindowViewSize(false);
        }
 }
 
@@ -705,7 +705,7 @@
        if (LockLooper()) {
                if (!Window()->IsHidden()) {
                        _LayoutItems(index);
-                       _UpdateWindowViewSize();
+                       _UpdateWindowViewSize(false);
                        Invalidate();
                }
                UnlockLooper();
@@ -826,7 +826,7 @@
        if (locked && Window() != NULL && !Window()->IsHidden()) {
                // Make sure we update the layout if needed.
                _LayoutItems(index);
-               _UpdateWindowViewSize();
+               _UpdateWindowViewSize(false);
                Invalidate();
        }
 
@@ -1508,7 +1508,7 @@
                        return false;
                }
 
-               _UpdateWindowViewSize();
+               _UpdateWindowViewSize(true);
                window->Show();
 
                if (selectFirstItem)
@@ -1990,7 +1990,7 @@
                InvalidateLayout();
                if (locked && window != NULL) {
                        _LayoutItems(0);
-                       _UpdateWindowViewSize();
+                       _UpdateWindowViewSize(false);
                        Invalidate();
                }
        }
@@ -2300,7 +2300,7 @@
        if (!scroll) {
                // basically, if this returns false, it means
                // that the menu frame won't fit completely inside the screen
-               // TODO: Scrolling, will currently only work up/down,
+               // TODO: Scrolling will currently only work up/down,
                // not left/right
                scroll = screenFrame.Height() < frame.Height();
        }
@@ -2684,7 +2684,7 @@
 
 
 void
-BMenu::_UpdateWindowViewSize()
+BMenu::_UpdateWindowViewSize(const bool &move)
 {
        BMenuWindow* window = static_cast<BMenuWindow*>(Window());
        if (window == NULL)
@@ -2697,7 +2697,7 @@
                return;
 
        bool scroll = false;
-       const BPoint screenLocation = ScreenLocation();
+       const BPoint screenLocation = move ? ScreenLocation() : 
window->Frame().LeftTop();
        BRect frame = _CalcFrame(screenLocation, &scroll);
        ResizeTo(frame.Width(), frame.Height());
 
@@ -2728,7 +2728,8 @@
                        fFontHeight + fPad.top + fPad.bottom);
        }
 
-       window->MoveTo(frame.LeftTop());
+       if (move)
+               window->MoveTo(frame.LeftTop());
 }
 
 


Other related posts: