From 08d92916672b9c6c4274547f9366485dce31330e Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 7 Dec 2006 11:25:24 +0000 Subject: [PATCH] removed now unneded extra Draw() call used as a workaround to broken scrolling. Menu attached to menubars now use scrolling if they are opened near the bottom of the screen (just like in beos). I'm not sure if this is so nice, though, so it could be reverted. Patch contributed by Lucasz Zemczak git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19442 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 23 ++++++++++++++++++----- src/kits/interface/MenuWindow.cpp | 7 ------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 687154a390..d600b84271 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1712,8 +1712,15 @@ BMenu::CalcFrame(BPoint where, bool *scrollOn) if (frame.bottom > screenFrame.bottom) frame.OffsetBy(0, screenFrame.bottom - frame.bottom); } else { - if (frame.bottom > screenFrame.bottom) - frame.OffsetBy(0, -superItem->Frame().Height() - frame.Height() - 3); + if (frame.bottom > screenFrame.bottom) { + if (scrollOn != NULL && superMenu != NULL && + dynamic_cast(superMenu) != NULL && + frame.top < (screenFrame.bottom - 80)) { + *scrollOn = true; + } else { + frame.OffsetBy(0, -superItem->Frame().Height() - frame.Height() - 3); + } + } if (frame.right > screenFrame.right) frame.OffsetBy(screenFrame.right - frame.right, 0); @@ -2094,11 +2101,17 @@ BMenu::UpdateWindowViewSize(bool upWind) // If we need scrolling, resize the window to fit the screen and // attach scrollers to our cached MenuWindow. - window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom - 10); + if (dynamic_cast(Supermenu()) == NULL) { + window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom - 10); + frame.top = 0; + } + else { + // Or, in case our parent was a BMenuBar enable scrolling with + // normal size. + window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom - frame.top); + } static_cast(window)->AttachScrollers(); - - frame.top = 0; } } else { CacheFontInfo(); diff --git a/src/kits/interface/MenuWindow.cpp b/src/kits/interface/MenuWindow.cpp index 53d706dbbe..ccfe87e349 100644 --- a/src/kits/interface/MenuWindow.cpp +++ b/src/kits/interface/MenuWindow.cpp @@ -129,13 +129,6 @@ BMenuScroller::Pulse() fMenu->ScrollBy(0, -kScrollStep); fValue -= kScrollStep; } - - // In this case, we need to redraw the lower button because of a - // probable bug in ScrollBy handling. The scrolled view is drawing below - // its bounds, dirtying our button in this process. - // Redrawing it everytime makes scrolling a little slower. - // TODO: Try to find why and fix this. - Draw(fLowerButton); } }