Fix video full-window toggle in windowed mode.

This commit is contained in:
John Preston 2024-06-06 22:08:10 +04:00
parent 14909ae913
commit deb50ee528
1 changed files with 14 additions and 5 deletions

View File

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