summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-10-08 22:10:50 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-10-09 16:22:18 +0300
commit0f9d2dca38049224d555b725d23008f6e1a6467d (patch)
tree9d08b2d06b8eaaeb0c12dc2e178adfc40c421614 /indra/llui
parent625b489f39de5c4881158cf8c960e2316b5ff814 (diff)
viewer#2270 The "More" button does not close the "Choose emoji" floater
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llemojihelper.cpp11
-rw-r--r--indra/llui/llemojihelper.h7
-rw-r--r--indra/llui/lltexteditor.cpp8
-rw-r--r--indra/llui/lltexteditor.h1
4 files changed, 27 insertions, 0 deletions
diff --git a/indra/llui/llemojihelper.cpp b/indra/llui/llemojihelper.cpp
index b9441a9c91..b2c59ce775 100644
--- a/indra/llui/llemojihelper.cpp
+++ b/indra/llui/llemojihelper.cpp
@@ -99,6 +99,7 @@ void LLEmojiHelper::showHelper(LLUICtrl* hostctrl_p, S32 local_x, S32 local_y, c
LLFloater* pHelperFloater = LLFloaterReg::getInstance(DEFAULT_EMOJI_HELPER_FLOATER);
mHelperHandle = pHelperFloater->getHandle();
mHelperCommitConn = pHelperFloater->setCommitCallback(std::bind([&](const LLSD& sdValue) { onCommitEmoji(utf8str_to_wstring(sdValue.asStringRef())[0]); }, std::placeholders::_2));
+ mHelperCloseConn = pHelperFloater->setCloseCallback([this](LLUICtrl* ctrl, const LLSD& param) { onCloseHelper(ctrl, param); });
}
setHostCtrl(hostctrl_p);
mEmojiCommitCb = cb;
@@ -148,6 +149,16 @@ void LLEmojiHelper::onCommitEmoji(llwchar emoji)
}
}
+void LLEmojiHelper::onCloseHelper(LLUICtrl* ctrl, const LLSD& param)
+{
+ mCloseSignal(ctrl, param);
+}
+
+boost::signals2::connection LLEmojiHelper::setCloseCallback(const commit_signal_t::slot_type& cb)
+{
+ return mCloseSignal.connect(cb);
+}
+
void LLEmojiHelper::setHostCtrl(LLUICtrl* hostctrl_p)
{
const LLUICtrl* pCurHostCtrl = mHostHandle.get();
diff --git a/indra/llui/llemojihelper.h b/indra/llui/llemojihelper.h
index 2834b06061..26840eef94 100644
--- a/indra/llui/llemojihelper.h
+++ b/indra/llui/llemojihelper.h
@@ -51,16 +51,23 @@ public:
// Eventing
bool handleKey(const LLUICtrl* ctrl_p, KEY key, MASK mask);
void onCommitEmoji(llwchar emoji);
+ void onCloseHelper(LLUICtrl* ctrl, const LLSD& param);
+
+ typedef boost::signals2::signal<void(LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
+ boost::signals2::connection setCloseCallback(const commit_signal_t::slot_type& cb);
protected:
LLUICtrl* getHostCtrl() const { return mHostHandle.get(); }
void setHostCtrl(LLUICtrl* hostctrl_p);
private:
+ commit_signal_t mCloseSignal;
+
LLHandle<LLUICtrl> mHostHandle;
LLHandle<LLFloater> mHelperHandle;
boost::signals2::connection mHostCtrlFocusLostConn;
boost::signals2::connection mHelperCommitConn;
+ boost::signals2::connection mHelperCloseConn;
std::function<void(llwchar)> mEmojiCommitCb;
bool mIsHideDisabled;
};
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index ecac800def..088fbe2744 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1211,6 +1211,14 @@ void LLTextEditor::showEmojiHelper()
LLEmojiHelper::instance().showHelper(this, cursorRect.mLeft, cursorRect.mTop, LLStringUtil::null, cb);
}
+void LLTextEditor::hideEmojiHelper()
+{
+ if (mShowEmojiHelper)
+ {
+ LLEmojiHelper::instance().hideHelper(this);
+ }
+}
+
void LLTextEditor::tryToShowEmojiHelper()
{
if (mReadOnly || !mShowEmojiHelper)
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index cedb79bf62..32dd95b8ac 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -207,6 +207,7 @@ public:
bool getShowContextMenu() const { return mShowContextMenu; }
void showEmojiHelper();
+ void hideEmojiHelper();
void setShowEmojiHelper(bool show);
bool getShowEmojiHelper() const { return mShowEmojiHelper; }