From 3366ddf0ebeb8792d8b2705e6c90ceadad32b875 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 30 Dec 2025 13:05:10 +0300 Subject: [PATCH] Removed focus handler for emoji toggle in edit contact box. --- .../boxes/peers/edit_contact_box.cpp | 3 +- .../chat_helpers/chat_helpers.style | 1 + .../ui/controls/emoji_button_factory.cpp | 33 ++++++++++--------- .../ui/controls/emoji_button_factory.h | 3 +- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp index 9e81cff414..ddd6e61b22 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp @@ -440,7 +440,8 @@ void Controller::setupNotesField() { _box, _window, _emojiPanel.get(), - st::sendGifWithCaptionEmojiPosition); + st::sendGifWithCaptionEmojiPosition, + false); emojiButton->show(); using Limit = HistoryView::Controls::CharactersLimitLabel; diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 813fca972d..0b26a6fdc2 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -1248,6 +1248,7 @@ historyAttachEmoji: EmojiButton { lineFgOver: historyEmojiCircleFgOver; } boxAttachEmoji: EmojiButton(historyAttachEmoji) { + bg: transparent; inner: IconButton(historyAttachEmojiInner) { width: 30px; height: 30px; diff --git a/Telegram/SourceFiles/ui/controls/emoji_button_factory.cpp b/Telegram/SourceFiles/ui/controls/emoji_button_factory.cpp index 7a8f59e932..ff58a750fc 100644 --- a/Telegram/SourceFiles/ui/controls/emoji_button_factory.cpp +++ b/Telegram/SourceFiles/ui/controls/emoji_button_factory.cpp @@ -28,7 +28,8 @@ namespace Ui { not_null box, not_null controller, not_null emojiPanel, - QPoint shift) { + QPoint shift, + bool fadeOnFocusChange) { const auto emojiToggle = Ui::CreateChild( field->parentWidget(), st::defaultComposeFiles.emoji); @@ -47,20 +48,22 @@ namespace Ui { } fade->paint(p); }, fadeTarget->lifetime()); - rpl::single(false) | rpl::then( - field->focusedChanges() - ) | rpl::on_next([=](bool shown) { - crl::on_main(emojiToggle, [=] { - if (!emojiToggle->isVisible()) { - return; - } - if (shown) { - fade->fadeIn(st::universalDuration); - } else { - fade->fadeOut(st::universalDuration); - } - }); - }, emojiToggle->lifetime()); + if (fadeOnFocusChange) { + rpl::single(false) | rpl::then( + field->focusedChanges() + ) | rpl::on_next([=](bool shown) { + crl::on_main(emojiToggle, [=] { + if (!emojiToggle->isVisible()) { + return; + } + if (shown) { + fade->fadeIn(st::universalDuration); + } else { + fade->fadeOut(st::universalDuration); + } + }); + }, emojiToggle->lifetime()); + } fade->fadeOut(1); fade->finish(); } diff --git a/Telegram/SourceFiles/ui/controls/emoji_button_factory.h b/Telegram/SourceFiles/ui/controls/emoji_button_factory.h index 3fa3dc728c..18eb6347f5 100644 --- a/Telegram/SourceFiles/ui/controls/emoji_button_factory.h +++ b/Telegram/SourceFiles/ui/controls/emoji_button_factory.h @@ -26,6 +26,7 @@ class InputField; not_null box, not_null controller, not_null emojiPanel, - QPoint shift); + QPoint shift, + bool fadeOnFocusChange = true); } // namespace Ui