From b0c54dfd3e2ecc8d4f875276397a55cef40a3d9a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 19 Oct 2012 17:47:28 -0700 Subject: CHUI-433: Problem: Toasts were not being displayed due to incorrect tracking of the current conversation with focus. Resolution: Now when a conversation gains focus it will set a flag to ignore toasts. And when a conversation loses focus it will set a flag to re-enable toasts. --- indra/newview/llimconversation.cpp | 13 ++++--------- indra/newview/llimview.cpp | 5 ++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index bd2a2419a8..f4b8d39cd0 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -202,16 +202,10 @@ void LLIMConversation::onFocusReceived() { setBackgroundOpaque(true); - if (mSessionID.notNull()) + if (mSessionID.notNull() && isInVisibleChain()) { - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true); - - if (getVisible()) - { - // suppress corresponding toast only if this floater is visible and have focus - LLIMModel::getInstance()->setActiveSessionID(mSessionID); - LLIMModel::instance().sendNoUnreadMessages(mSessionID); - } + LLIMModel::getInstance()->setActiveSessionID(mSessionID); + LLIMModel::instance().sendNoUnreadMessages(mSessionID); } LLTransientDockableFloater::onFocusReceived(); @@ -219,6 +213,7 @@ void LLIMConversation::onFocusReceived() void LLIMConversation::onFocusLost() { + LLIMModel::getInstance()->resetActiveSessionID(); setBackgroundOpaque(false); LLTransientDockableFloater::onFocusLost(); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 115da54ec8..572f36ff7d 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -119,8 +119,7 @@ void toast_callback(const LLSD& msg){ } // check whether incoming IM belongs to an active session or not - if (LLIMModel::getInstance()->getActiveSessionID().notNull() - && LLIMModel::getInstance()->getActiveSessionID() == msg["session_id"]) + if (LLIMModel::getInstance()->getActiveSessionID() == msg["session_id"]) { return; } @@ -147,7 +146,7 @@ void toast_callback(const LLSD& msg){ // Skip toasting if we have open window of IM with this session id LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]); - if (open_im_floater && open_im_floater->getVisible()) + if (open_im_floater && open_im_floater->isInVisibleChain() && open_im_floater->hasFocus()) { return; } -- cgit v1.2.3 From 23d58c0c0906bd5434611cc73da9437ec7a5b830 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 22 Oct 2012 17:31:51 -0700 Subject: CHUI-433: Implemented an alternate solution to the problem. The original solution was ambiguous and incomplete and also preserved an existing hack. The new solution removes a hack/deprecated code (setActiveSession/getActiveSession functions). Basically, a toast message is not displayed if the user already has the conversation in focus. When the conversation floater loses focus toasts message will be displayed for that conversation. --- indra/newview/llimconversation.cpp | 2 -- indra/newview/llimview.cpp | 30 ++++++----------------------- indra/newview/llimview.h | 7 ------- indra/newview/llnotificationhandlerutil.cpp | 17 ---------------- 4 files changed, 6 insertions(+), 50 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index f4b8d39cd0..74bf8cb6fe 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -204,7 +204,6 @@ void LLIMConversation::onFocusReceived() if (mSessionID.notNull() && isInVisibleChain()) { - LLIMModel::getInstance()->setActiveSessionID(mSessionID); LLIMModel::instance().sendNoUnreadMessages(mSessionID); } @@ -213,7 +212,6 @@ void LLIMConversation::onFocusReceived() void LLIMConversation::onFocusLost() { - LLIMModel::getInstance()->resetActiveSessionID(); setBackgroundOpaque(false); LLTransientDockableFloater::onFocusLost(); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 572f36ff7d..4c5631d5e1 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -118,11 +118,12 @@ void toast_callback(const LLSD& msg){ return; } - // check whether incoming IM belongs to an active session or not - if (LLIMModel::getInstance()->getActiveSessionID() == msg["session_id"]) - { - return; - } + // Skip toasting if we have open window of IM with this session id + LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]); + if (open_im_floater && open_im_floater->isInVisibleChain() && open_im_floater->hasFocus()) + { + return; + } // Skip toasting for system messages if (msg["from_id"].asUUID() == LLUUID::null) @@ -144,30 +145,11 @@ void toast_callback(const LLSD& msg){ return; } - // Skip toasting if we have open window of IM with this session id - LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]); - if (open_im_floater && open_im_floater->isInVisibleChain() && open_im_floater->hasFocus()) - { - return; - } - LLAvatarNameCache::get(msg["from_id"].asUUID(), boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); } -void LLIMModel::setActiveSessionID(const LLUUID& session_id) -{ - // check if such an ID really exists - if (!findIMSession(session_id)) - { - llwarns << "Trying to set as active a non-existent session!" << llendl; - return; - } - - mActiveSessionID = session_id; -} - LLIMModel::LLIMModel() { addNewMsgCallback(boost::bind(&LLIMFloater::newIMCallback, _1)); diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 00b67f520c..054388bc6c 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -147,13 +147,6 @@ public: LLIMModel(); - - //we should control the currently active session - LLUUID mActiveSessionID; - void setActiveSessionID(const LLUUID& session_id); - void resetActiveSessionID() { mActiveSessionID.setNull(); } - LLUUID getActiveSessionID() { return mActiveSessionID; } - /** Session id to session object */ std::map mId2SessionMap; diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 9fd73746e8..b4e8927879 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -93,13 +93,6 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, } else { - // store active session id - const LLUUID & active_session_id = - LLIMModel::instance().getActiveSessionID(); - - // set searched session as active to avoid IM toast popup - LLIMModel::instance().setActiveSessionID(session_id); - S32 unread = session->mNumUnread; S32 participant_unread = session->mParticipantUnreadMessageCount; LLIMModel::instance().addMessageSilently(session_id, from, from_id, @@ -110,16 +103,6 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, // update IM floater messages updateIMFLoaterMesages(session_id); - - // restore active session id - if (active_session_id.isNull()) - { - LLIMModel::instance().resetActiveSessionID(); - } - else - { - LLIMModel::instance().setActiveSessionID(active_session_id); - } } } -- cgit v1.2.3 From a780eb1a92811c2531c2fc1d211e8e5dd03da103 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 23 Oct 2012 13:20:53 +0300 Subject: CHUI-418 FIXED Check that mViewModelItem is not NULL --- indra/llui/llfolderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index c8b8bcae48..c31a832141 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -505,7 +505,7 @@ void LLFolderView::sanitizeSelection() // ensure that each ancestor is open and potentially passes filtering BOOL visible = false; - if(item->getViewModelItem()) + if(item->getViewModelItem() != NULL) { visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item } -- cgit v1.2.3