diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 06781f1bdf3986ce9862e9a06c8b1de4e153d5c4..02ac928dfb5962aa2a4da1c16e4539f80a0be55b 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -554,6 +554,16 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
 	return TRUE;
 }
 
+void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
+{
+	overlay_width = mImageOverlay->getWidth();
+	overlay_height = mImageOverlay->getHeight();
+
+	F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
+	overlay_width = llround((F32)overlay_width * scale_factor);
+	overlay_height = llround((F32)overlay_height * scale_factor);
+}
+
 
 // virtual
 void LLButton::draw()
@@ -781,12 +791,10 @@ void LLButton::draw()
 	if (mImageOverlay.notNull())
 	{
 		// get max width and height (discard level 0)
-		S32 overlay_width = mImageOverlay->getWidth();
-		S32 overlay_height = mImageOverlay->getHeight();
+		S32 overlay_width;
+		S32 overlay_height;
 
-		F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
-		overlay_width = llround((F32)overlay_width * scale_factor);
-		overlay_height = llround((F32)overlay_height * scale_factor);
+		getOverlayImageSize(overlay_width, overlay_height);
 
 		S32 center_x = getLocalRect().getCenterX();
 		S32 center_y = getLocalRect().getCenterY();
@@ -994,11 +1002,15 @@ void LLButton::resize(LLUIString label)
 		S32 min_width = label_width + mLeftHPad + mRightHPad;
 		if (mImageOverlay)
 		{
+			S32 overlay_width = mImageOverlay->getWidth();
+			F32 scale_factor = getRect().getHeight() / (F32)mImageOverlay->getHeight();
+			overlay_width = llround((F32)overlay_width * scale_factor);
+
 			switch(mImageOverlayAlignment)
 			{
 			case LLFontGL::LEFT:
 			case LLFontGL::RIGHT:
-				min_width += mImageOverlay->getWidth() + mImgOverlayLabelSpace;
+				min_width += overlay_width + mImgOverlayLabelSpace;
 				break;
 			case LLFontGL::HCENTER:
 				break;
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index bc5e69fad54f58298d10a8524c653a885bd56882..08b45e01b33e7b3f3d790fc7cacfebb3405e8a84 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -270,6 +270,7 @@ class LLButton
 protected:
 	LLPointer<LLUIImage> getImageUnselected() const	{ return mImageUnselected; }
 	LLPointer<LLUIImage> getImageSelected() const	{ return mImageSelected; }
+	void getOverlayImageSize(S32& overlay_width, S32& overlay_height);
 
 	LLFrameTimer	mMouseDownTimer;
 
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 790025cb2dcd8397e4b9e72f5632208aa2dcd6cc..ab1c87caffeb571417a5c003d1045a3ab26ff841 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -96,9 +96,6 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 		Params();
 	};
 
-	// valid children for LLPanel are stored in this registry
-	typedef LLDefaultChildRegistry child_registry_t;
-
 protected:
 	friend class LLUICtrlFactory;
 	// RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 8249df3e9d961d8208f62051e7288bc2ff58a6f2..677d50a0c75ac8ad19aee9ece65ce103359cdd0d 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -30,6 +30,7 @@
 #include <boost/foreach.hpp>
 #include "lltoolbar.h"
 
+#include "llcommandmanager.h"
 #include "llmenugl.h"
 #include "lltrans.h"
 
@@ -206,8 +207,8 @@ bool LLToolBar::addCommand(const LLCommandId& commandId)
 
 	if (add_command)
 	{
-		mButtonCommands.push_back(commandId);
-		createButtons();
+	mButtonCommands.push_back(commandId);
+	createButtons();
 	}
 
 	return add_command;
@@ -251,7 +252,9 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled)
 
 BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
 {
-	BOOL handle_it_here = !mReadOnly;
+	LLRect button_panel_rect;
+	mButtonPanel->localRectToOtherView(mButtonPanel->getLocalRect(), &button_panel_rect, this);
+	BOOL handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y);
 
 	if (handle_it_here)
 	{
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 7a1b2e4ba047872aee08b9cd79347ddc9f170326..9039366e7e3ab5eb2414c33521666c73bf3e1416 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -95,9 +95,6 @@ class LLViewDrawContext
 	static std::vector<LLViewDrawContext*> sDrawContextStack;
 };
 
-class LLViewWidgetRegistry : public LLChildRegistry<LLViewWidgetRegistry>
-{};
-
 class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement
 {
 public:
@@ -150,7 +147,8 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 		Params();
 	};
 
-	typedef LLViewWidgetRegistry child_registry_t;
+	// most widgets are valid children of LLView
+	typedef LLDefaultChildRegistry child_registry_t;
 
 	void initFromParams(const LLView::Params&);