summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimsessiontab.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-10-22 14:46:15 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-10-22 14:46:15 -0400
commitbfe759584f63c0587a2dc6a0086ad9d5b6c63a56 (patch)
tree84653a1211908c7dd2ce5bc4877e79f8e6515099 /indra/newview/llfloaterimsessiontab.cpp
parent62fc3ceaf5251458239f91192a05edc64bedf33b (diff)
parent394f7b37f2ec05c7cfb32c350432886f1c493c85 (diff)
Merge branch 'develop' into marchcat/xcode-16
Diffstat (limited to 'indra/newview/llfloaterimsessiontab.cpp')
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp57
1 files changed, 53 insertions, 4 deletions
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index b2f2984c65..0855a628fb 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -39,6 +39,7 @@
#include "llchicletbar.h"
#include "lldraghandle.h"
#include "llemojidictionary.h"
+#include "llemojihelper.h"
#include "llfloaterreg.h"
#include "llfloateremojipicker.h"
#include "llfloaterimsession.h"
@@ -298,6 +299,8 @@ bool LLFloaterIMSessionTab::postBuild()
mEmojiPickerShowBtn = getChild<LLButton>("emoji_picker_show_btn");
mEmojiPickerShowBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerShowBtnClicked(); });
+ mEmojiPickerShowBtn->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerShowBtnDown(); });
+ mEmojiCloseConn = LLEmojiHelper::instance().setCloseCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerClosed(); });
mGearBtn = getChild<LLButton>("gear_btn");
mAddBtn = getChild<LLButton>("add_btn");
@@ -526,8 +529,43 @@ void LLFloaterIMSessionTab::onEmojiRecentPanelToggleBtnClicked()
void LLFloaterIMSessionTab::onEmojiPickerShowBtnClicked()
{
- mInputEditor->setFocus(true);
- mInputEditor->showEmojiHelper();
+ if (!mEmojiPickerShowBtn->getToggleState())
+ {
+ mInputEditor->hideEmojiHelper();
+ mInputEditor->setFocus(true);
+ mInputEditor->showEmojiHelper();
+ mEmojiPickerShowBtn->setToggleState(true); // in case hideEmojiHelper closed a visible instance
+ }
+ else
+ {
+ mInputEditor->hideEmojiHelper();
+ mEmojiPickerShowBtn->setToggleState(false);
+ }
+}
+
+void LLFloaterIMSessionTab::onEmojiPickerShowBtnDown()
+{
+ if (mEmojiHelperLastCallbackFrame == LLFrameTimer::getFrameCount())
+ {
+ // Helper gets closed by focus lost event on Down before before onEmojiPickerShowBtnDown
+ // triggers.
+ // If this condition is true, user pressed button and it was 'toggled' during press,
+ // restore 'toggled' state so that button will not reopen helper.
+ mEmojiPickerShowBtn->setToggleState(true);
+ }
+}
+
+void LLFloaterIMSessionTab::onEmojiPickerClosed()
+{
+ if (mEmojiPickerShowBtn->getToggleState())
+ {
+ mEmojiPickerShowBtn->setToggleState(false);
+ // Helper gets closed by focus lost event on Down before onEmojiPickerShowBtnDown
+ // triggers. If mEmojiHelperLastCallbackFrame is set and matches Down, means close
+ // was triggered by user's press.
+ // A bit hacky, but I can't think of a better way to handle this without rewriting helper.
+ mEmojiHelperLastCallbackFrame = LLFrameTimer::getFrameCount();
+ }
}
void LLFloaterIMSessionTab::initEmojiRecentPanel()
@@ -591,8 +629,19 @@ void LLFloaterIMSessionTab::deleteAllChildren()
std::string LLFloaterIMSessionTab::appendTime()
{
- std::string timeStr = "[" + LLTrans::getString("TimeHour") + "]:"
- "[" + LLTrans::getString("TimeMin") + "]";
+ std::string timeStr;
+ static bool use_24h = gSavedSettings.getBOOL("Use24HourClock");
+ if (use_24h)
+ {
+ timeStr = "[" + LLTrans::getString("TimeHour") + "]:"
+ "[" + LLTrans::getString("TimeMin") + "]";
+ }
+ else
+ {
+ timeStr = "[" + LLTrans::getString("TimeHour12") + "]:"
+ "[" + LLTrans::getString("TimeMin") + "] ["
+ + LLTrans::getString("TimeAMPM") + "]";
+ }
LLSD substitution;
substitution["datetime"] = (S32)time_corrected();