[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,

View File

@@ -349,14 +349,12 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
// gSavedSettings.setBOOL( "PinTalkViewOpen", !state );
//}
// static
void LLIMMgr::toggle(void*)
void LLIMMgr::toggle()
{
static BOOL return_to_mouselook = FALSE;
// Hide the button and show the floater or vice versa.
llassert( gIMMgr );
BOOL old_state = gIMMgr->getFloaterOpen();
bool old_state = getFloaterOpen();
// If we're in mouselook and we triggered the Talk View, we want to talk.
if( gAgentCamera.cameraMouselook() && old_state )
@@ -387,7 +385,7 @@ void LLIMMgr::toggle(void*)
return_to_mouselook = FALSE;
}
gIMMgr->setFloaterOpen( new_state );
setFloaterOpen(new_state);
}
//

View File

@@ -143,7 +143,7 @@ public:
// good connection.
void disconnectAllSessions();
static void toggle(void*);
void toggle();
BOOL hasSession(const LLUUID& session_id);