FIRE-10908: CTRL-W closes multifloater instead of active child floater

master
Ansariel 2014-03-08 14:08:56 +01:00
parent b877446770
commit cad57f1e23
3 changed files with 62 additions and 38 deletions

View File

@ -387,6 +387,7 @@ void LLMultiFloater::setVisible(BOOL visible)
BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask)
{
// <FS:Ansariel> This won't work - CTRL-W is intercepted by LLFileCloseWindow!
if (key == 'W' && mask == MASK_CONTROL)
{
LLFloater* floater = getActiveFloater();
@ -576,3 +577,58 @@ void LLMultiFloater::computeResizeLimits(S32& new_min_width, S32& new_min_height
}
}
}
// <FS:Ansariel> CTRL-W doesn't work with multifloaters
void LLMultiFloater::closeFloater(bool app_quitting)
{
if (app_quitting)
{
LLFloater::closeFloater(app_quitting);
return;
}
LLFloater* floater = getActiveFloater();
// is user closeable and is system closeable
if (floater && floater->canClose() && floater->isCloseable())
{
floater->closeFloater();
// EXT-5695 (Tabbed IM window loses focus if close any tabs by Ctrl+W)
// bring back focus on tab container if there are any tab left
if(mTabContainer->getTabCount() > 0)
{
mTabContainer->setFocus(TRUE);
}
else
{
// Call closeFloater() here so that focus gets properly handed over
LLFloater::closeFloater();
}
return;
}
// Close multifloater itself if we can't close any hosted floaters
LLFloater::closeFloater();
}
void LLMultiFloater::onClickCloseBtn(bool app_quitting)
{
LLFloater::closeFloater(false);
}
// Ansa: Will be called when toggling view - in that case we want to
// toggle the whole floater instead of the active hosted floater
void LLMultiFloater::closeHostedFloater()
{
// When toggling *visibility*, close the host instead of the floater when hosted
if (getHost())
{
getHost()->closeFloater();
}
else
{
LLFloater::closeFloater(false);
}
}
// <FS:Ansariel>

View File

@ -79,6 +79,12 @@ public:
virtual void updateResizeLimits();
virtual void updateFloaterTitle(LLFloater* floaterp);
// <FS:Ansariel> CTRL-W doesn't work with multifloaters
/*virtual*/ void closeFloater(bool app_quitting = false);
/*virtual*/ void onClickCloseBtn(bool app_quitting = false);
/*virtual*/ void closeHostedFloater();
// </FS:Ansariel>
protected:
struct LLFloaterData
{

View File

@ -675,44 +675,6 @@ class LLFileCloseWindow : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
// If the IM container is focused, try to close the selected tab instead of the container -KC
// <FS:Ansariel> [FS communication UI]
//LLIMFloaterContainer* im_container = LLIMFloaterContainer::getInstance();
FSFloaterIMContainer* im_container = FSFloaterIMContainer::getInstance();
// </FS:Ansariel> [FS communication UI]
if (im_container && im_container->hasFocus())
{
LLFloater* floater = im_container->getActiveFloater();
// is user closeable and is system closeable
if (floater && floater->canClose())
{
if (floater->isCloseable())
{
floater->closeFloater();
// and return focus back to the container
im_container->setFocus(TRUE);
}
else
{
// close the im container if selected tab is not closable (ie. contacts or nerby chat) -KC
im_container->closeFloater();
// if nothing took focus after closing focused floater
// give it to next floater (to allow closing multiple windows via keyboard in rapid succession)
if (gFocusMgr.getKeyboardFocus() == NULL)
{
// HACK: use gFloaterView directly in case we are using Ctrl-W to close snapshot window
// which sits in gSnapshotFloaterView, and needs to pass focus on to normal floater view
gFloaterView->focusFrontFloater();
}
}
return true;
}
}
LLFloater::closeFrontmostFloater();
return true;
}