summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelnearbymedia.cpp9
-rw-r--r--indra/newview/llpanelnearbymedia.h1
-rw-r--r--indra/newview/llpanelvolumepulldown.cpp14
-rw-r--r--indra/newview/llpanelvolumepulldown.h2
-rw-r--r--indra/newview/llpopupview.cpp18
-rw-r--r--indra/newview/llpopupview.h4
-rw-r--r--indra/newview/llstatusbar.cpp33
-rw-r--r--indra/newview/llviewerwindow.cpp27
8 files changed, 76 insertions, 32 deletions
diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp
index 41e37a9b1b..4bbecc4799 100644
--- a/indra/newview/llpanelnearbymedia.cpp
+++ b/indra/newview/llpanelnearbymedia.cpp
@@ -82,6 +82,8 @@ LLPanelNearByMedia::LLPanelNearByMedia()
mParcelMediaItem(NULL),
mParcelAudioItem(NULL)
{
+ mHoverTimer.stop();
+
mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay");
@@ -188,6 +190,13 @@ void LLPanelNearByMedia::onMouseLeave(S32 x, S32 y, MASK mask)
}
/*virtual*/
+void LLPanelNearByMedia::onTopLost()
+{
+ setVisible(FALSE);
+}
+
+
+/*virtual*/
void LLPanelNearByMedia::handleVisibilityChange ( BOOL new_visibility )
{
if (new_visibility)
diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h
index 809a8d81a1..af4659365f 100644
--- a/indra/newview/llpanelnearbymedia.h
+++ b/indra/newview/llpanelnearbymedia.h
@@ -53,6 +53,7 @@ public:
/*virtual*/ void draw();
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onTopLost();
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp
index 559997254e..ae52bd3703 100644
--- a/indra/newview/llpanelvolumepulldown.cpp
+++ b/indra/newview/llpanelvolumepulldown.cpp
@@ -56,6 +56,8 @@
// Default constructor
LLPanelVolumePulldown::LLPanelVolumePulldown()
{
+ mHoverTimer.stop();
+
mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2));
mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, this, _2));
LLUICtrlFactory::instance().buildPanel(this, "panel_volume_pulldown.xml");
@@ -77,6 +79,11 @@ void LLPanelVolumePulldown::onMouseEnter(S32 x, S32 y, MASK mask)
LLPanel::onMouseEnter(x,y,mask);
}
+/*virtual*/
+void LLPanelVolumePulldown::onTopLost()
+{
+ setVisible(FALSE);
+}
/*virtual*/
void LLPanelVolumePulldown::onMouseLeave(S32 x, S32 y, MASK mask)
@@ -95,13 +102,8 @@ void LLPanelVolumePulldown::handleVisibilityChange ( BOOL new_visibility )
else
{
mHoverTimer.stop();
- }
-}
-/*virtual*/
-void LLPanelVolumePulldown::onTopLost()
-{
- setVisible(FALSE);
+ }
}
void LLPanelVolumePulldown::onAdvancedButtonClick(const LLSD& user_data)
diff --git a/indra/newview/llpanelvolumepulldown.h b/indra/newview/llpanelvolumepulldown.h
index 9f20caa1a8..7fb025f329 100644
--- a/indra/newview/llpanelvolumepulldown.h
+++ b/indra/newview/llpanelvolumepulldown.h
@@ -47,8 +47,8 @@ class LLPanelVolumePulldown : public LLPanel
/*virtual*/ void draw();
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
- /*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
/*virtual*/ void onTopLost();
+ /*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
/*virtual*/ BOOL postBuild();
private:
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index 964ca4d361..eb750a87e2 100644
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -100,7 +100,7 @@ BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func
S32 popup_x, popup_y;
if (localPointToOtherView(x, y, &popup_x, &popup_y, popup)
- && popup->getRect().pointInRect(popup_x, popup_y))
+ && popup->pointInView(popup_x, popup_y))
{
if (func(popup, popup_x, popup_y))
{
@@ -180,9 +180,9 @@ BOOL LLPopupView::handleToolTip(S32 x, S32 y, MASK mask)
void LLPopupView::addPopup(LLView* popup)
{
- removePopup(popup);
if (popup)
{
+ mPopups.erase(std::find(mPopups.begin(), mPopups.end(), popup->getHandle()));
mPopups.push_back(popup->getHandle());
}
}
@@ -191,12 +191,26 @@ void LLPopupView::removePopup(LLView* popup)
{
if (popup)
{
+ if (gFocusMgr.childHasKeyboardFocus(popup))
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+ popup->onTopLost();
mPopups.erase(std::find(mPopups.begin(), mPopups.end(), popup->getHandle()));
}
}
void LLPopupView::clearPopups()
{
+ for (popup_list_t::iterator popup_it = mPopups.begin();
+ popup_it != mPopups.end();)
+ {
+ LLView* popup = popup_it->get();
+ ++popup_it;
+
+ if (popup) popup->onTopLost();
+ }
+
mPopups.clear();
}
diff --git a/indra/newview/llpopupview.h b/indra/newview/llpopupview.h
index 591e033161..c5dbb94c4c 100644
--- a/indra/newview/llpopupview.h
+++ b/indra/newview/llpopupview.h
@@ -56,9 +56,11 @@ public:
void removePopup(LLView* popup);
void clearPopups();
+ typedef std::list<LLHandle<LLView> > popup_list_t;
+ popup_list_t getCurrentPopups() { return mPopups; }
+
private:
BOOL handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)>, boost::function<bool(LLView*)>, S32 x, S32 y);
- typedef std::list<LLHandle<LLView> > popup_list_t;
popup_list_t mPopups;
};
#endif //LL_LLROOTVIEW_H
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 732c23982b..2ed0718e41 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -239,20 +239,16 @@ BOOL LLStatusBar::postBuild()
childSetActionTextbox("stat_btn", onClickStatGraph);
- LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
-
mPanelVolumePulldown = new LLPanelVolumePulldown();
- popup_holder->addChild(mPanelVolumePulldown);
+ addChild(mPanelVolumePulldown);
+ mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelVolumePulldown->setVisible(FALSE);
mPanelNearByMedia = new LLPanelNearByMedia();
- popup_holder->addChild(mPanelNearByMedia);
- gViewerWindow->getRootView()->addMouseDownCallback(boost::bind(&LLStatusBar::onClickScreen, this, _1, _2));
+ addChild(mPanelNearByMedia);
mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
mPanelNearByMedia->setVisible(FALSE);
- mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
- mPanelVolumePulldown->setVisible(FALSE);
-
return TRUE;
}
@@ -538,8 +534,10 @@ void LLStatusBar::onMouseEnterVolume()
// show the master volume pull-down
- mPanelVolumePulldown->setVisible(TRUE);
+ LLUI::clearPopups();
+ LLUI::addPopup(mPanelVolumePulldown);
mPanelNearByMedia->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(TRUE);
}
void LLStatusBar::onMouseEnterNearbyMedia()
@@ -558,8 +556,11 @@ void LLStatusBar::onMouseEnterNearbyMedia()
// show the master volume pull-down
mPanelNearByMedia->setShape(nearby_media_rect);
- mPanelNearByMedia->setVisible(TRUE);
+ LLUI::clearPopups();
+ LLUI::addPopup(mPanelNearByMedia);
+
mPanelVolumePulldown->setVisible(FALSE);
+ mPanelNearByMedia->setVisible(TRUE);
}
@@ -648,18 +649,6 @@ void LLStatusBar::onClickStatGraph(void* data)
LLFloaterReg::showInstance("lagmeter");
}
-void LLStatusBar::onClickScreen(S32 x, S32 y)
-{
- if (mPanelNearByMedia->getVisible())
- {
- LLRect screen_rect = mPanelNearByMedia->calcScreenRect();
- if (!screen_rect.pointInRect(x, y))
- {
- mPanelNearByMedia->setVisible(FALSE);
- }
- }
-}
-
BOOL can_afford_transaction(S32 cost)
{
return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 5bd79c67c3..1304a66397 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2590,6 +2590,33 @@ void LLViewerWindow::updateUI()
}
// aggregate visible views that contain mouse cursor in display order
+ LLPopupView::popup_list_t popups = mPopupView->getCurrentPopups();
+
+ for(LLPopupView::popup_list_t::iterator popup_it = popups.begin(); popup_it != popups.end(); ++popup_it)
+ {
+ LLView* popup = popup_it->get();
+ if (popup && popup->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // iterator over contents of top_ctrl, and throw into mouse_hover_set
+ for (LLView::tree_iterator_t it = popup->beginTreeDFS();
+ it != popup->endTreeDFS();
+ ++it)
+ {
+ LLView* viewp = *it;
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
+ }
+ }
+ }
// while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events
if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y))