Skip to content

Commit

Permalink
Fix video full-window toggle in windowed mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jun 6, 2024
1 parent 14909ae commit deb50ee
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit deb50ee

Please sign in to comment.