[LLIMMgr/LLIMPanel Revision] Fix PinTalkViewOpen=false mechanics

If the user is holding a modifier key with enter, it bypasses the unpinned setting
If a chat is popped out, this setting now only minimizes that chat, not toggles the main communications floater.
LLIMPanel::closeIfNotPinned() now condenses the logic.

Also makes LLIMMgr::toggle() non-static and requiring no args.
This commit is contained in:
Inusaito Sayori
2013-10-10 02:49:02 -04:00
parent 9e312a3808
commit 260723f2a4
3 changed files with 19 additions and 16 deletions

View File

@@ -903,17 +903,15 @@ void LLFloaterIMPanel::setInputFocus( BOOL b )
BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
{
BOOL handled = FALSE;
if( KEY_RETURN == key && mask == MASK_NONE)
if (KEY_RETURN == key)
{
onSendMsg();
handled = TRUE;
// Close talk panels on hitting return
// but not shift-return or control-return
if ( !gSavedSettings.getBOOL("PinTalkViewOpen") && !(mask & MASK_CONTROL) && !(mask & MASK_SHIFT) )
{
gIMMgr->toggle(NULL);
}
// without holding a modifier key
if (mask == MASK_NONE)
closeIfNotPinned();
}
else if (KEY_ESCAPE == key && mask == MASK_NONE)
{
@@ -921,10 +919,7 @@ BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
gFocusMgr.setKeyboardFocus(NULL);
// Close talk panel with escape
if( !gSavedSettings.getBOOL("PinTalkViewOpen") )
{
gIMMgr->toggle(NULL);
}
closeIfNotPinned();
}
// May need to call base class LLPanel::handleKeyHere if not handled
@@ -932,6 +927,16 @@ BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
return handled;
}
void LLFloaterIMPanel::closeIfNotPinned()
{
if (gSavedSettings.getBOOL("PinTalkViewOpen")) return;
if (getParent() == gFloaterView) // Just minimize, if popped out
setMinimized(true);
else
gIMMgr->toggle();
}
BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,