From 92f0358800de38da88413c9dfdc4cd9133978dd7 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 25 Jan 2024 13:43:30 +0300 Subject: [PATCH] Fixed text insertion from menu bar on macOS when input field is hidden. --- Telegram/SourceFiles/history/history_widget.cpp | 8 ++++++++ .../view/controls/history_view_compose_controls.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 4255a7e10..e14148752 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -337,6 +337,14 @@ HistoryWidget::HistoryWidget( ) | rpl::start_with_next([=] { fieldChanged(); }, _field->lifetime()); +#ifdef Q_OS_MAC + // Removed an ability to insert text from the menu bar + // when the field is hidden. + _field->shownValue( + ) | rpl::start_with_next([=](bool shown) { + _field->setEnabled(shown); + }, _field->lifetime()); +#endif // Q_OS_MAC connect( controller->widget()->windowHandle(), &QWindow::visibleChanged, diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index ac7735953..05675a2fe 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -1558,6 +1558,14 @@ void ComposeControls::initField() { ) | rpl::start_with_next([=] { fieldChanged(); }, _field->lifetime()); +#ifdef Q_OS_MAC + // Removed an ability to insert text from the menu bar + // when the field is hidden. + _field->shownValue( + ) | rpl::start_with_next([=](bool shown) { + _field->setEnabled(shown); + }, _field->lifetime()); +#endif // Q_OS_MAC InitMessageField(_show, _field, [=](not_null emoji) { if (_history && Data::AllowEmojiWithoutPremium(_history->peer)) { return true;