From d36315104ea6d23a670ef515621e47f5d947dc7e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 4 Mar 2022 16:31:04 +0400 Subject: [PATCH] Improve full screen RTMP streams. --- Telegram/SourceFiles/calls/group/calls_group_panel.cpp | 10 ++++++---- .../SourceFiles/calls/group/calls_group_viewport.cpp | 8 ++++++-- .../SourceFiles/calls/group/calls_group_viewport.h | 3 ++- .../calls/group/calls_group_viewport_opengl.cpp | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index 87178dec64..738841d190 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -92,7 +92,7 @@ Panel::Panel(not_null call) #ifndef Q_OS_MAC , _controls(Ui::Platform::SetupSeparateTitleControls( window(), - st::groupCallTitle)) + st::callTitle)) #endif // !Q_OS_MAC , _powerSaveBlocker(std::make_unique( base::PowerSaveBlockType::PreventDisplaySleep, @@ -1163,6 +1163,7 @@ void Panel::createPinOnTop() { _hideControlsTimerLifetime.destroy(); _hideControlsTimer.cancel(); } + updateMembersGeometry(); }, _pinOnTop->lifetime()); _pinOnTop->setClickedCallback([=] { @@ -2220,9 +2221,10 @@ void Panel::updateMembersGeometry() { _members->setVisible(!_call->rtmp()); const auto desiredHeight = _members->desiredHeight(); if (mode() == PanelMode::Wide) { - const auto skip = st::groupCallNarrowSkip; + const auto full = _fullScreenOrMaximized.current(); + const auto skip = full ? 0 : st::groupCallNarrowSkip; const auto membersWidth = st::groupCallNarrowMembersWidth; - const auto top = st::groupCallWideVideoTop; + const auto top = full ? 0 : st::groupCallWideVideoTop; _members->setGeometry( widget()->width() - skip - membersWidth, top, @@ -2231,7 +2233,7 @@ void Panel::updateMembersGeometry() { const auto viewportSkip = _call->rtmp() ? 0 : (skip + membersWidth); - _viewport->setGeometry({ + _viewport->setGeometry(full, { skip, top, widget()->width() - viewportSkip - 2 * skip, diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp index 2e01e14afa..a1c8550eb4 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp @@ -104,13 +104,17 @@ void Viewport::setup() { }, lifetime()); } -void Viewport::setGeometry(QRect geometry) { +void Viewport::setGeometry(bool fullscreen, QRect geometry) { Expects(wide()); + const auto changed = (_fullscreen != fullscreen); + if (changed) { + _fullscreen = fullscreen; + } if (widget()->geometry() != geometry) { _geometryStaleAfterModeChange = false; widget()->setGeometry(geometry); - } else if (_geometryStaleAfterModeChange) { + } else if (_geometryStaleAfterModeChange || changed) { _geometryStaleAfterModeChange = false; updateTilesGeometry(); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport.h b/Telegram/SourceFiles/calls/group/calls_group_viewport.h index a26e0a8116..e99361a4d6 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport.h +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport.h @@ -71,7 +71,7 @@ public: void setMode(PanelMode mode, not_null parent); void setControlsShown(float64 shown); - void setGeometry(QRect geometry); + void setGeometry(bool fullscreen, QRect geometry); void resizeToWidth(int newWidth); void setScrollTop(int scrollTop); @@ -175,6 +175,7 @@ private: std::vector> _tilesForOrder; rpl::variable _fullHeight = 0; bool _hasTwoOrMore = false; + bool _fullscreen = false; int _scrollTop = 0; QImage _shadow; rpl::event_stream _clicks; diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp index b11829140a..ca4547f639 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp @@ -498,6 +498,7 @@ void Viewport::RendererGL::paintTile( const auto height = geometry.height(); const auto &st = st::groupCallVideoTile; const auto shown = _owner->_controlsShownRatio; + const auto fullscreen = _owner->_fullscreen; const auto fullNameShift = st.namePosition.y() + st::normalFont->height; const auto nameShift = anim::interpolate(fullNameShift, 0, shown); const auto row = tile->row(); @@ -781,7 +782,7 @@ void Viewport::RendererGL::paintTile( program->setUniformValue("viewport", uniformViewport); program->setUniformValue("frameBg", st::groupCallBg->c); program->setUniformValue("radiusOutline", QVector2D( - GLfloat(st::roundRadiusLarge * _factor), + GLfloat(st::roundRadiusLarge * _factor * (fullscreen ? 0. : 1.)), (outline > 0) ? (st::groupCallOutline * _factor) : 0.f)); program->setUniformValue("roundRect", Uniform(rect)); program->setUniformValue("roundBg", st::groupCallBg->c);