Unbreaking Ctrl+W the right way
This commit is contained in:
@@ -1202,6 +1202,7 @@ BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
|
||||
return LLPanel::handleMiddleMouseDown( x, y, mask );
|
||||
}
|
||||
|
||||
|
||||
// virtual
|
||||
BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
@@ -1210,22 +1211,6 @@ BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask)
|
||||
return was_minimized || LLPanel::handleDoubleClick(x, y, mask);
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLFloater::handleKeyHere(KEY key, MASK mask)
|
||||
{
|
||||
if (key == 'W' && mask == MASK_CONTROL)
|
||||
{
|
||||
if (canClose() && isCloseable())
|
||||
{
|
||||
close();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return LLPanel::handleKeyHere(key, mask);
|
||||
}
|
||||
|
||||
|
||||
void LLFloater::bringToFront( S32 x, S32 y )
|
||||
{
|
||||
if (getVisible() && pointInView(x, y))
|
||||
@@ -1352,21 +1337,10 @@ void LLFloater::onClickEdit(void *userdata)
|
||||
// static
|
||||
LLFloater* LLFloater::getClosableFloaterFromFocus()
|
||||
{
|
||||
LLFloater* focused_floater = NULL;
|
||||
LLFloater* focused_floater = gFloaterView->getFocusedFloater();
|
||||
|
||||
handle_map_iter_t iter;
|
||||
for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
|
||||
if (!focused_floater)
|
||||
{
|
||||
focused_floater = iter->second;
|
||||
if (focused_floater->hasFocus())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iter == sFloaterMap.end())
|
||||
{
|
||||
// nothing found, return
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1374,7 +1348,7 @@ LLFloater* LLFloater::getClosableFloaterFromFocus()
|
||||
// Find and close a parental floater that is closeable, if any.
|
||||
LLFloater* previous_floater = NULL; // Guard against endless loop, because getParentFloater(x) can return x!
|
||||
for(LLFloater* floater_to_close = focused_floater;
|
||||
NULL != floater_to_close && floater_to_close != gFloaterView->getParentFloater(floater_to_close);
|
||||
NULL != floater_to_close;
|
||||
floater_to_close = gFloaterView->getParentFloater(floater_to_close))
|
||||
{
|
||||
if(floater_to_close == previous_floater)
|
||||
|
||||
@@ -197,7 +197,6 @@ public:
|
||||
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
|
||||
virtual void draw();
|
||||
|
||||
virtual void onOpen() {}
|
||||
|
||||
@@ -406,6 +406,22 @@ void LLMultiFloater::setVisible(BOOL visible)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask)
|
||||
{
|
||||
if (key == 'W' && mask == MASK_CONTROL)
|
||||
{
|
||||
LLFloater* floater = getActiveFloater();
|
||||
// is user closeable and is system closeable
|
||||
if (floater && floater->canClose() && floater->isCloseable())
|
||||
{
|
||||
floater->close();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return LLFloater::handleKeyHere(key, mask);
|
||||
}
|
||||
|
||||
LLFloater* LLMultiFloater::getActiveFloater()
|
||||
{
|
||||
return (LLFloater*)mTabContainer->getCurrentPanel();
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
/*virtual*/ void onClose(bool app_quitting);
|
||||
/*virtual*/ void draw();
|
||||
/*virtual*/ void setVisible(BOOL visible);
|
||||
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
|
||||
|
||||
virtual void setCanResize(BOOL can_resize);
|
||||
virtual void growToFit(S32 content_width, S32 content_height);
|
||||
|
||||
@@ -1788,7 +1788,9 @@ BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
|
||||
}
|
||||
}
|
||||
|
||||
return handled || LLFloater::handleKeyHere(key, mask);
|
||||
// May need to call base class LLPanel::handleKeyHere if not handled
|
||||
// in order to tab between buttons. JNC 1.2.2002
|
||||
return handled;
|
||||
}
|
||||
|
||||
BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
||||
|
||||
Reference in New Issue
Block a user