Refactored Conversations opacity override and made the callback to override transparency generic

master
Hecklezz 2025-07-28 02:27:53 +10:00
parent 88545c5ae7
commit b4a7ef835c
6 changed files with 39 additions and 13 deletions

View File

@ -1086,11 +1086,10 @@ F32 LLUICtrl::getCurrentTransparency()
}
// <FS:TJ> [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)
// <FS:TJ> Allow any UICtrl to override the transparency with a callback
if (mTransparencyOverrideCallback)
{
return llmin(mGetIMOpacityCallback(), alpha);
return mTransparencyOverrideCallback(mTransparencyType, alpha);
}
// </FS:TJ>

View File

@ -238,9 +238,9 @@ public:
void setTransparencyType(ETypeTransparency type);
ETypeTransparency getTransparencyType() const {return mTransparencyType;}
// <FS:TJ> [FIRE-35804] Allow the IM floater to have separate transparency
boost::function<F32()> mGetIMOpacityCallback;
void setGetIMOpacityCallback (boost::function<F32()> cb) { mGetIMOpacityCallback = cb; }
// <FS:TJ> Allow any UICtrl to override the transparency with a callback
boost::function<F32(ETypeTransparency, F32)> mTransparencyOverrideCallback;
void setTransparencyOverrideCallback (boost::function<F32(ETypeTransparency, F32)> cb) { mTransparencyOverrideCallback = cb; }
// </FS:TJ>
bool focusNextItem(bool text_entry_only);

View File

@ -1011,7 +1011,7 @@ bool FSFloaterIM::postBuild()
mInputEditor->enableSingleLineMode(gSavedSettings.getBOOL("FSUseSingleLineChatEntry"));
mInputEditor->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL));
// <FS:TJ> [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));
// </FS:TJ>
mEmojiRecentPanelToggleBtn = getChild<LLButton>("emoji_recent_panel_toggle_btn");
@ -2655,10 +2655,16 @@ uuid_vec_t FSFloaterIM::getSessionParticipants() const
}
// <FS:TJ> [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<F32> im_opacity(gSavedSettings, "FSIMOpacity", 1.0f);
return im_opacity;
if (type != TT_ACTIVE)
{
return llmin(im_opacity, alpha);
}
return alpha;
}
// </FS:TJ>

View File

@ -164,7 +164,9 @@ public:
uuid_vec_t getSessionParticipants() const;
static F32 onGetIMOpacityCallback(); // <FS:TJ/> [FIRE-35804] Allow the IM floater to have separate transparency
// <FS:TJ> [FIRE-35804] Allow the IM floater to have separate transparency
F32 onGetChatEditorOpacityCallback(ETypeTransparency type, F32 alpha);
// </FS:TJ>
protected:
/* virtual */

View File

@ -149,7 +149,7 @@ bool FSFloaterNearbyChat::postBuild()
mInputEditor->setLabel(getString("chatbox_label"));
mInputEditor->enableSingleLineMode(gSavedSettings.getBOOL("FSUseSingleLineChatEntry"));
// <FS:TJ> [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));
// </FS:TJ>
mChatLayoutPanel = getChild<LLLayoutPanel>("chat_layout_panel");
@ -1110,3 +1110,18 @@ uuid_vec_t FSFloaterNearbyChat::getSessionParticipants() const
return avatarIds;
}
// <FS:TJ> [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<F32> im_opacity(gSavedSettings, "FSIMOpacity", 1.0f);
if (type != TT_ACTIVE)
{
return llmin(im_opacity, alpha);
}
return alpha;
}
// </FS:TJ>

View File

@ -104,6 +104,10 @@ public:
uuid_vec_t getSessionParticipants() const;
// <FS:TJ> [FIRE-35804] Allow the IM floater to have separate transparency
F32 onGetChatBoxOpacityCallback(ETypeTransparency type, F32 alpha);
// </FS:TJ>
protected:
void onChatBoxKeystroke();
void onChatBoxFocusLost();