summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 1f8e7a7..e0881d5 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -719,7 +719,17 @@ void QtChatWindow::handleEmojiClicked(QString emoji) {
void QtChatWindow::handleTextInputReceivedFocus() {
lastLineTracker_.setHasFocus(true);
input_->setFocus();
- onAllMessagesRead();
+ if (focusTimer_) {
+ focusTimer_->stop();
+ }
+ else {
+ focusTimer_ = std::make_unique<QTimer>(this);
+ focusTimer_->setSingleShot(true);
+ focusTimer_->setTimerType(Qt::CoarseTimer);
+ connect(focusTimer_.get(), &QTimer::timeout, this, &QtChatWindow::handleFocusTimerTick);
+ }
+ focusTimer_->setInterval(1000);
+ focusTimer_->start();
}
void QtChatWindow::handleTextInputLostFocus() {
@@ -1029,4 +1039,11 @@ void QtChatWindow::removeChatSecurityMarking() {
securityMarkingLayout_ = nullptr;
}
+void QtChatWindow::handleFocusTimerTick() {
+ if (hasFocus()) {
+ onAllMessagesRead();
+ }
+ focusTimer_.reset();
+}
+
}