From b4a7ef835c7355e4bb4427a7c2bc118a011df3d7 Mon Sep 17 00:00:00 2001 From: Hecklezz Date: Mon, 28 Jul 2025 02:27:53 +1000 Subject: [PATCH] Refactored Conversations opacity override and made the callback to override transparency generic --- indra/llui/lluictrl.cpp | 7 +++---- indra/llui/lluictrl.h | 6 +++--- indra/newview/fsfloaterim.cpp | 14 ++++++++++---- indra/newview/fsfloaterim.h | 4 +++- indra/newview/fsfloaternearbychat.cpp | 17 ++++++++++++++++- indra/newview/fsfloaternearbychat.h | 4 ++++ 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 3dfbc508df..5f77c3346f 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -1086,11 +1086,10 @@ F32 LLUICtrl::getCurrentTransparency() } - // [FIRE-35804] Allow the IM floater to have separate transparency - // This is specifically for making the text editors such as chat_editor always active opacity when the IM floater is focused - if (mGetIMOpacityCallback && mTransparencyType != TT_ACTIVE) + // Allow any UICtrl to override the transparency with a callback + if (mTransparencyOverrideCallback) { - return llmin(mGetIMOpacityCallback(), alpha); + return mTransparencyOverrideCallback(mTransparencyType, alpha); } // diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index eeb9296305..0536e9b7ae 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -238,9 +238,9 @@ public: void setTransparencyType(ETypeTransparency type); ETypeTransparency getTransparencyType() const {return mTransparencyType;} - // [FIRE-35804] Allow the IM floater to have separate transparency - boost::function mGetIMOpacityCallback; - void setGetIMOpacityCallback (boost::function cb) { mGetIMOpacityCallback = cb; } + // Allow any UICtrl to override the transparency with a callback + boost::function mTransparencyOverrideCallback; + void setTransparencyOverrideCallback (boost::function cb) { mTransparencyOverrideCallback = cb; } // bool focusNextItem(bool text_entry_only); diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index cf3e58edea..2521526440 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -1011,7 +1011,7 @@ bool FSFloaterIM::postBuild() mInputEditor->enableSingleLineMode(gSavedSettings.getBOOL("FSUseSingleLineChatEntry")); mInputEditor->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL)); // [FIRE-35804] Allow the IM floater to have separate transparency - mInputEditor->setGetIMOpacityCallback(boost::bind(&FSFloaterIM::onGetIMOpacityCallback)); + mInputEditor->setTransparencyOverrideCallback(boost::bind(&FSFloaterIM::onGetChatEditorOpacityCallback, this, _1, _2)); // mEmojiRecentPanelToggleBtn = getChild("emoji_recent_panel_toggle_btn"); @@ -2655,10 +2655,16 @@ uuid_vec_t FSFloaterIM::getSessionParticipants() const } // [FIRE-35804] Allow the IM floater to have separate transparency -// static -F32 FSFloaterIM::onGetIMOpacityCallback() +// This is specifically for making the text editors such as chat_editor always active opacity when the IM floater is focused +// Otherwise if they aren't active, it will use either the IM opacity, or inactive opacity, whatever is smaller +F32 FSFloaterIM::onGetChatEditorOpacityCallback(ETypeTransparency type, F32 alpha) { static LLCachedControl im_opacity(gSavedSettings, "FSIMOpacity", 1.0f); - return im_opacity; + if (type != TT_ACTIVE) + { + return llmin(im_opacity, alpha); + } + + return alpha; } // diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index 3ed36de1db..3d20957063 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -164,7 +164,9 @@ public: uuid_vec_t getSessionParticipants() const; - static F32 onGetIMOpacityCallback(); // [FIRE-35804] Allow the IM floater to have separate transparency + // [FIRE-35804] Allow the IM floater to have separate transparency + F32 onGetChatEditorOpacityCallback(ETypeTransparency type, F32 alpha); + // protected: /* virtual */ diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index ddea2b28ac..51e1d31fad 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -149,7 +149,7 @@ bool FSFloaterNearbyChat::postBuild() mInputEditor->setLabel(getString("chatbox_label")); mInputEditor->enableSingleLineMode(gSavedSettings.getBOOL("FSUseSingleLineChatEntry")); // [FIRE-35804] Allow the IM floater to have separate transparency - mInputEditor->setGetIMOpacityCallback(boost::bind(&FSFloaterIM::onGetIMOpacityCallback)); + mInputEditor->setTransparencyOverrideCallback(boost::bind(&FSFloaterNearbyChat::onGetChatBoxOpacityCallback, this, _1, _2)); // mChatLayoutPanel = getChild("chat_layout_panel"); @@ -1110,3 +1110,18 @@ uuid_vec_t FSFloaterNearbyChat::getSessionParticipants() const return avatarIds; } + +// [FIRE-35804] Allow the IM floater to have separate transparency +// This is specifically for making the text editors such as chat_editor always active opacity when the IM floater is focused +// Otherwise if they aren't active, it will use either the IM opacity, or inactive opacity, whatever is smaller +F32 FSFloaterNearbyChat::onGetChatBoxOpacityCallback(ETypeTransparency type, F32 alpha) +{ + static LLCachedControl im_opacity(gSavedSettings, "FSIMOpacity", 1.0f); + if (type != TT_ACTIVE) + { + return llmin(im_opacity, alpha); + } + + return alpha; +} +// diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 37641a4be3..ee485e5498 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -104,6 +104,10 @@ public: uuid_vec_t getSessionParticipants() const; + // [FIRE-35804] Allow the IM floater to have separate transparency + F32 onGetChatBoxOpacityCallback(ETypeTransparency type, F32 alpha); + // + protected: void onChatBoxKeystroke(); void onChatBoxFocusLost();