diff --git a/Telegram/SourceFiles/calls/calls_group_call.cpp b/Telegram/SourceFiles/calls/calls_group_call.cpp index f4a71eafde..5ee1626872 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/calls_group_call.cpp @@ -828,21 +828,26 @@ void GroupCall::applyGlobalShortcutChanges() { } _pushToTalk = shortcut; _shortcutManager->startWatching(_pushToTalk, [=](bool pressed) { - const auto delay = Core::App().settings().groupCallPushToTalkDelay(); - if (muted() == MuteState::ForceMuted - || muted() == MuteState::Active) { - return; - } else if (pressed) { - _pushToTalkCancelTimer.cancel(); - setMuted(MuteState::PushToTalk); - } else if (delay) { - _pushToTalkCancelTimer.callOnce(delay); - } else { - pushToTalkCancel(); - } + pushToTalk( + pressed, + Core::App().settings().groupCallPushToTalkDelay()); }); } +void GroupCall::pushToTalk(bool pressed, crl::time delay) { + if (muted() == MuteState::ForceMuted + || muted() == MuteState::Active) { + return; + } else if (pressed) { + _pushToTalkCancelTimer.cancel(); + setMuted(MuteState::PushToTalk); + } else if (delay) { + _pushToTalkCancelTimer.callOnce(delay); + } else { + pushToTalkCancel(); + } +} + void GroupCall::pushToTalkCancel() { _pushToTalkCancelTimer.cancel(); if (muted() == MuteState::PushToTalk) { diff --git a/Telegram/SourceFiles/calls/calls_group_call.h b/Telegram/SourceFiles/calls/calls_group_call.h index 9a507b5e89..0ad338c410 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.h +++ b/Telegram/SourceFiles/calls/calls_group_call.h @@ -126,6 +126,8 @@ public: std::shared_ptr ensureGlobalShortcutManager(); void applyGlobalShortcutChanges(); + void pushToTalk(bool pressed, crl::time delay); + [[nodiscard]] rpl::lifetime &lifetime() { return _lifetime; } diff --git a/Telegram/SourceFiles/calls/calls_group_panel.cpp b/Telegram/SourceFiles/calls/calls_group_panel.cpp index 8b139398e1..57e2899917 100644 --- a/Telegram/SourceFiles/calls/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_group_panel.cpp @@ -45,6 +45,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Calls { namespace { +constexpr auto kSpacePushToTalkDelay = crl::time(250); + class InviteController final : public ParticipantsBoxController { public: InviteController( @@ -280,6 +282,15 @@ void GroupPanel::initWindow() { if (e->type() == QEvent::Close && handleClose()) { e->ignore(); return base::EventFilterResult::Cancel; + } else if (e->type() == QEvent::KeyPress + || e->type() == QEvent::KeyRelease) { + if (static_cast(e.get())->key() == Qt::Key_Space) { + if (_call) { + _call->pushToTalk( + e->type() == QEvent::KeyPress, + kSpacePushToTalkDelay); + } + } } return base::EventFilterResult::Continue; }); diff --git a/Telegram/ThirdParty/tgcalls b/Telegram/ThirdParty/tgcalls index b892eb58bc..905ed863c1 160000 --- a/Telegram/ThirdParty/tgcalls +++ b/Telegram/ThirdParty/tgcalls @@ -1 +1 @@ -Subproject commit b892eb58bc941a4a1a67303439df8ffd379d6051 +Subproject commit 905ed863c19bc39b04b3b1c070b39195fedfef1e