From f29fab5f73fc6dc0eefd0a623c69640abdcba3e8 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Mon, 17 Jun 2013 20:14:56 +0300
Subject: [PATCH] CHUI-506 FIXED Don't change dropdown position if items are
 unchanged.

---
 indra/newview/llfavoritesbar.cpp | 7 ++++++-
 indra/newview/llfavoritesbar.h   | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 6d90667194f..b35ef3a9617 100755
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -400,6 +400,8 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p)
 	mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this));
 	addChild(mMoreTextBox);
 
+	mDropDownItemsCount = 0;
+
 	LLTextBox::Params label_param(p.label);
 	mBarLabel = LLUICtrlFactory::create<LLTextBox> (label_param);
 	addChild(mBarLabel);
@@ -820,11 +822,13 @@ void LLFavoritesBarCtrl::updateButtons()
 		}
 		// Update overflow menu
 		LLToggleableMenu* overflow_menu = static_cast <LLToggleableMenu*> (mOverflowMenuHandle.get());
-		if (overflow_menu && overflow_menu->getVisible())
+		if (overflow_menu && overflow_menu->getVisible() && (overflow_menu->getItemCount() != mDropDownItemsCount))
 		{
 			overflow_menu->setVisible(FALSE);
 			if (mUpdateDropDownItems)
+			{
 				showDropDownMenu();
+			}
 		}
 	}
 	else
@@ -940,6 +944,7 @@ void LLFavoritesBarCtrl::showDropDownMenu()
 		menu->updateParent(LLMenuGL::sMenuContainer);
 		menu->setButtonRect(mMoreTextBox->getRect(), this);
 		positionAndShowMenu(menu);
+		mDropDownItemsCount = menu->getItemCount();
 	}
 }
 
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index f06e9b9b645..211d3c4ce35 100755
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -101,6 +101,7 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver
 	LLUUID mFavoriteFolderId;
 	const LLFontGL *mFont;
 	S32 mFirstDropDownItem;
+	S32 mDropDownItemsCount;
 	bool mUpdateDropDownItems;
 	bool mRestoreOverflowMenu;
 
-- 
GitLab