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

View file

@ -1886,9 +1886,18 @@ void OverlayWidget::contentSizeChanged() {
} }
void OverlayWidget::recountSkipTop() { void OverlayWidget::recountSkipTop() {
const auto bottom = (!_streamed || !_streamed->controls) const auto controllerBottomNoFullScreenVideo = _groupThumbs
? height() ? _groupThumbsTop
: (_streamed->controls->y() - st::mediaviewCaptionPadding.bottom()); : 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); const auto skipHeightBottom = (height() - bottom);
_skipTop = _minUsedTop + std::min( _skipTop = _minUsedTop + std::min(
std::max( std::max(
@ -1954,7 +1963,7 @@ void OverlayWidget::resizeContentByScreenSize() {
_h = _height; _h = _height;
} }
_x = (width() - _w) / 2; _x = (width() - _w) / 2;
_y = _skipTop + (_availableHeight - _h) / 2; _y = _skipTop + (useh - _h) / 2;
_geometryAnimation.stop(); _geometryAnimation.stop();
} }
@ -4016,7 +4025,7 @@ void OverlayWidget::refreshClipControllerGeometry() {
st::mediaviewControllerSize.height()); st::mediaviewControllerSize.height());
_streamed->controls->move( _streamed->controls->move(
(width() - controllerWidth) / 2, (width() - controllerWidth) / 2,
(controllerBottom (controllerBottom // Duplicated in recountSkipTop().
- _streamed->controls->height() - _streamed->controls->height()
- st::mediaviewCaptionPadding.bottom())); - st::mediaviewCaptionPadding.bottom()));
Ui::SendPendingMoveResizeEvents(_streamed->controls.get()); Ui::SendPendingMoveResizeEvents(_streamed->controls.get());