From deb50ee5284b6719d615529b5083ac0ec8732d8b Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 6 Jun 2024 22:08:10 +0400 Subject: [PATCH] Fix video full-window toggle in windowed mode. --- .../media/view/media_view_overlay_widget.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 836887e8cd..6d7e8d73b9 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -1886,9 +1886,18 @@ void OverlayWidget::contentSizeChanged() { } void OverlayWidget::recountSkipTop() { - const auto bottom = (!_streamed || !_streamed->controls) - ? height() - : (_streamed->controls->y() - st::mediaviewCaptionPadding.bottom()); + const auto controllerBottomNoFullScreenVideo = _groupThumbs + ? _groupThumbsTop + : height(); + // We need the bottom in case of non-full-screen-video mode + // to count correct _availableHeight in non-full-screen-video mode. + // + // Originally this is controls->y() - padding.bottom(). + const auto bottom = (_streamed && _streamed->controls) + ? (controllerBottomNoFullScreenVideo + - _streamed->controls->height() + - 2 * st::mediaviewCaptionPadding.bottom()) + : height(); const auto skipHeightBottom = (height() - bottom); _skipTop = _minUsedTop + std::min( std::max( @@ -1954,7 +1963,7 @@ void OverlayWidget::resizeContentByScreenSize() { _h = _height; } _x = (width() - _w) / 2; - _y = _skipTop + (_availableHeight - _h) / 2; + _y = _skipTop + (useh - _h) / 2; _geometryAnimation.stop(); } @@ -4016,7 +4025,7 @@ void OverlayWidget::refreshClipControllerGeometry() { st::mediaviewControllerSize.height()); _streamed->controls->move( (width() - controllerWidth) / 2, - (controllerBottom + (controllerBottom // Duplicated in recountSkipTop(). - _streamed->controls->height() - st::mediaviewCaptionPadding.bottom())); Ui::SendPendingMoveResizeEvents(_streamed->controls.get());