From 260723f2a4036bf237cefe8571bbf1dcb529c0b9 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 10 Oct 2013 02:49:02 -0400 Subject: [PATCH] [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. --- indra/newview/llimpanel.cpp | 25 +++++++++++++++---------- indra/newview/llimview.cpp | 8 +++----- indra/newview/llimview.h | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index a28d04be0..71e1ec865 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -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, diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index efd86ff9e..0538918c5 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -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); } // diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index f5e59990a..b2786cab9 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -143,7 +143,7 @@ public: // good connection. void disconnectAllSessions(); - static void toggle(void*); + void toggle(); BOOL hasSession(const LLUUID& session_id);