Fix keyboard shortcuts like ctrl+w for floaters

This commit is contained in:
Siana Gearz
2012-01-12 01:37:13 +01:00
parent a6f36abab0
commit 4eea8624b7
5 changed files with 18 additions and 21 deletions

View File

@@ -1201,7 +1201,6 @@ 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,6 +1209,22 @@ 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))

View File

@@ -197,6 +197,7 @@ 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() {}

View File

@@ -406,22 +406,6 @@ 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();

View File

@@ -51,7 +51,6 @@ 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);

View File

@@ -1776,9 +1776,7 @@ BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
}
}
// May need to call base class LLPanel::handleKeyHere if not handled
// in order to tab between buttons. JNC 1.2.2002
return handled;
return LLFloater::handleKeyHere(key, mask);
}
BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,