From 60be4b32be4eef408e6ea163ad75b607715016c5 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 1 Mar 2022 09:49:20 +0300 Subject: [PATCH] Improved design of context menu from top button in RTMP boxes. --- Telegram/SourceFiles/calls/calls.style | 1 - .../SourceFiles/calls/group/calls_group_rtmp.cpp | 12 ++++++++---- .../calls/group/calls_group_settings.cpp | 13 +++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls.style b/Telegram/SourceFiles/calls/calls.style index 21a90ad49..4e1c07c8c 100644 --- a/Telegram/SourceFiles/calls/calls.style +++ b/Telegram/SourceFiles/calls/calls.style @@ -1401,4 +1401,3 @@ groupCallRtmpShowButtonPosition: point(21px, -5px); groupCallRtmpKeyLabel: FlatLabel(boxLabel) { minWidth: 230px; } -groupCallRtmpTopBarMenuPosition: point(-2px, -15px); diff --git a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp index 2827ae70a..27fc38df0 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp @@ -78,12 +78,16 @@ void StartWithBox( tr::lng_group_invite_context_revoke(tr::now), revoke, &st::menuIconRemove); - state->menu->moveToRight( - st::groupCallRtmpTopBarMenuPosition.x(), - st::groupCallRtmpTopBarMenuPosition.y()); state->menu->setForcedOrigin( Ui::PanelAnimation::Origin::TopRight); - state->menu->popup(QCursor::pos()); + top->setForceRippled(true); + const auto raw = state->menu.get(); + raw->setDestroyedCallback([=] { + if ((state->menu == raw) && top) { + top->setForceRippled(false); + } + }); + state->menu->popup(top->mapToGlobal(top->rect().center())); return true; }); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp index 36abc89ca..a929f73d1 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp @@ -683,12 +683,17 @@ void SettingsBox( state->menu->addAction( tr::lng_group_call_rtmp_revoke(tr::now), revoke); - state->menu->moveToRight( - st::groupCallRtmpTopBarMenuPosition.x(), - st::groupCallRtmpTopBarMenuPosition.y()); state->menu->setForcedOrigin( Ui::PanelAnimation::Origin::TopRight); - state->menu->popup(QCursor::pos()); + top->setForceRippled(true); + const auto raw = state->menu.get(); + raw->setDestroyedCallback([=] { + if ((state->menu == raw) && top) { + top->setForceRippled(false); + } + }); + state->menu->popup( + top->mapToGlobal(QPoint(top->width() / 2, top->height()))); return true; });