mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improve fullscreen RTMP streams.
This commit is contained in:
parent
b087688349
commit
bde3da53b6
7 changed files with 58 additions and 17 deletions
|
@ -92,7 +92,9 @@ Panel::Panel(not_null<GroupCall*> call)
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
, _controls(Ui::Platform::SetupSeparateTitleControls(
|
, _controls(Ui::Platform::SetupSeparateTitleControls(
|
||||||
window(),
|
window(),
|
||||||
st::callTitle))
|
st::groupCallTitle,
|
||||||
|
nullptr,
|
||||||
|
_controlsTop.value()))
|
||||||
#endif // !Q_OS_MAC
|
#endif // !Q_OS_MAC
|
||||||
, _powerSaveBlocker(std::make_unique<base::PowerSaveBlocker>(
|
, _powerSaveBlocker(std::make_unique<base::PowerSaveBlocker>(
|
||||||
base::PowerSaveBlockType::PreventDisplaySleep,
|
base::PowerSaveBlockType::PreventDisplaySleep,
|
||||||
|
@ -802,7 +804,9 @@ void Panel::setupMembers() {
|
||||||
setupVideo(_viewport.get());
|
setupVideo(_viewport.get());
|
||||||
setupVideo(_members->viewport());
|
setupVideo(_members->viewport());
|
||||||
_viewport->mouseInsideValue(
|
_viewport->mouseInsideValue(
|
||||||
) | rpl::start_with_next([=](bool inside) {
|
) | rpl::filter([=] {
|
||||||
|
return !_fullScreenOrMaximized.current();
|
||||||
|
}) | rpl::start_with_next([=](bool inside) {
|
||||||
toggleWideControls(inside);
|
toggleWideControls(inside);
|
||||||
}, _viewport->lifetime());
|
}, _viewport->lifetime());
|
||||||
|
|
||||||
|
@ -1027,6 +1031,7 @@ void Panel::updateWideControlsVisibility() {
|
||||||
if (_wideControlsShown == shown) {
|
if (_wideControlsShown == shown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_viewport->setCursorShown(!_fullScreenOrMaximized.current() || shown);
|
||||||
_wideControlsShown = shown;
|
_wideControlsShown = shown;
|
||||||
_wideControlsAnimation.start(
|
_wideControlsAnimation.start(
|
||||||
[=] { updateButtonsGeometry(); },
|
[=] { updateButtonsGeometry(); },
|
||||||
|
@ -1168,6 +1173,12 @@ void Panel::createPinOnTop() {
|
||||||
};
|
};
|
||||||
_fullScreenOrMaximized.value(
|
_fullScreenOrMaximized.value(
|
||||||
) | rpl::start_with_next([=](bool fullScreenOrMaximized) {
|
) | rpl::start_with_next([=](bool fullScreenOrMaximized) {
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
_controls->controls.setStyle(fullScreenOrMaximized
|
||||||
|
? st::callTitle
|
||||||
|
: st::groupCallTitle);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
_pinOnTop->setVisible(!fullScreenOrMaximized);
|
_pinOnTop->setVisible(!fullScreenOrMaximized);
|
||||||
if (fullScreenOrMaximized) {
|
if (fullScreenOrMaximized) {
|
||||||
pin(false);
|
pin(false);
|
||||||
|
@ -1853,7 +1864,9 @@ void Panel::trackControl(Ui::RpWidget *widget, rpl::lifetime &lifetime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::trackControlOver(not_null<Ui::RpWidget*> control, bool over) {
|
void Panel::trackControlOver(not_null<Ui::RpWidget*> control, bool over) {
|
||||||
if (_stickedTooltipClose) {
|
if (_fullScreenOrMaximized.current()) {
|
||||||
|
return;
|
||||||
|
} else if (_stickedTooltipClose) {
|
||||||
if (!over) {
|
if (!over) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2428,13 +2441,14 @@ void Panel::refreshTitleGeometry() {
|
||||||
? st::groupCallTitleTop
|
? st::groupCallTitleTop
|
||||||
: (st::groupCallWideVideoTop
|
: (st::groupCallWideVideoTop
|
||||||
- st::groupCallTitleLabel.style.font->height) / 2;
|
- st::groupCallTitleLabel.style.font->height) / 2;
|
||||||
|
const auto shown = _fullScreenOrMaximized.current()
|
||||||
|
? _wideControlsAnimation.value(
|
||||||
|
_wideControlsShown ? 1. : 0.)
|
||||||
|
: 1.;
|
||||||
const auto top = anim::interpolate(
|
const auto top = anim::interpolate(
|
||||||
-_title->height() - st::boxRadius,
|
-_title->height() - st::boxRadius,
|
||||||
shownTop,
|
shownTop,
|
||||||
(_fullScreenOrMaximized.current()
|
shown);
|
||||||
? _wideControlsAnimation.value(
|
|
||||||
_wideControlsShown ? 1. : 0.)
|
|
||||||
: 1.));
|
|
||||||
const auto left = titleRect.x();
|
const auto left = titleRect.x();
|
||||||
|
|
||||||
const auto notEnough = std::max(0, best - titleRect.width());
|
const auto notEnough = std::max(0, best - titleRect.width());
|
||||||
|
@ -2493,6 +2507,10 @@ void Panel::refreshTitleGeometry() {
|
||||||
} else {
|
} else {
|
||||||
layout(left + titleRect.width() - best);
|
layout(left + titleRect.width() - best);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
_controlsTop = anim::interpolate(-_controls->wrap.height(), 0, shown);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::refreshTitleColors() {
|
void Panel::refreshTitleColors() {
|
||||||
|
|
|
@ -204,6 +204,7 @@ private:
|
||||||
rpl::variable<bool> _fullScreenOrMaximized = false;
|
rpl::variable<bool> _fullScreenOrMaximized = false;
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
|
rpl::variable<int> _controlsTop = 0;
|
||||||
const std::unique_ptr<Ui::Platform::SeparateTitleControls> _controls;
|
const std::unique_ptr<Ui::Platform::SeparateTitleControls> _controls;
|
||||||
#endif // !Q_OS_MAC
|
#endif // !Q_OS_MAC
|
||||||
|
|
||||||
|
|
|
@ -226,6 +226,13 @@ void Viewport::setControlsShown(float64 shown) {
|
||||||
widget()->update();
|
widget()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewport::setCursorShown(bool shown) {
|
||||||
|
if (_cursorHidden == shown) {
|
||||||
|
_cursorHidden = !shown;
|
||||||
|
updateCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Viewport::add(
|
void Viewport::add(
|
||||||
const VideoEndpoint &endpoint,
|
const VideoEndpoint &endpoint,
|
||||||
VideoTileTrack track,
|
VideoTileTrack track,
|
||||||
|
@ -798,7 +805,11 @@ void Viewport::setSelected(Selection value) {
|
||||||
|
|
||||||
void Viewport::updateCursor() {
|
void Viewport::updateCursor() {
|
||||||
const auto pointer = _selected.tile && (!wide() || _hasTwoOrMore);
|
const auto pointer = _selected.tile && (!wide() || _hasTwoOrMore);
|
||||||
widget()->setCursor(pointer ? style::cur_pointer : style::cur_default);
|
widget()->setCursor(_cursorHidden
|
||||||
|
? Qt::BlankCursor
|
||||||
|
: pointer
|
||||||
|
? style::cur_pointer
|
||||||
|
: style::cur_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewport::setPressed(Selection value) {
|
void Viewport::setPressed(Selection value) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
|
|
||||||
void setMode(PanelMode mode, not_null<QWidget*> parent);
|
void setMode(PanelMode mode, not_null<QWidget*> parent);
|
||||||
void setControlsShown(float64 shown);
|
void setControlsShown(float64 shown);
|
||||||
|
void setCursorShown(bool shown);
|
||||||
void setGeometry(bool fullscreen, QRect geometry);
|
void setGeometry(bool fullscreen, QRect geometry);
|
||||||
void resizeToWidth(int newWidth);
|
void resizeToWidth(int newWidth);
|
||||||
void setScrollTop(int scrollTop);
|
void setScrollTop(int scrollTop);
|
||||||
|
@ -176,6 +177,7 @@ private:
|
||||||
rpl::variable<int> _fullHeight = 0;
|
rpl::variable<int> _fullHeight = 0;
|
||||||
bool _hasTwoOrMore = false;
|
bool _hasTwoOrMore = false;
|
||||||
bool _fullscreen = false;
|
bool _fullscreen = false;
|
||||||
|
bool _cursorHidden = false;
|
||||||
int _scrollTop = 0;
|
int _scrollTop = 0;
|
||||||
QImage _shadow;
|
QImage _shadow;
|
||||||
rpl::event_stream<VideoEndpoint> _clicks;
|
rpl::event_stream<VideoEndpoint> _clicks;
|
||||||
|
|
|
@ -185,12 +185,11 @@ uniform sampler2D n_texture;
|
||||||
return {
|
return {
|
||||||
.header = R"(
|
.header = R"(
|
||||||
uniform vec4 frameBg;
|
uniform vec4 frameBg;
|
||||||
uniform vec3 shadow; // fullHeight, shown, maxOpacity
|
uniform vec4 shadow; // fullHeight, shown, maxOpacity, blur opacity
|
||||||
uniform float paused; // 0. <-> 1.
|
uniform float paused; // 0. <-> 1.
|
||||||
|
|
||||||
)" + blur.header + round.header + noise.header + R"(
|
)" + blur.header + round.header + noise.header + R"(
|
||||||
|
|
||||||
const float backgroundOpacity = )" + QString::number(kBlurOpacity) + R"(;
|
|
||||||
const float noiseGrain = )" + QString::number(kDitherNoiseAmount) + R"(;
|
const float noiseGrain = )" + QString::number(kDitherNoiseAmount) + R"(;
|
||||||
|
|
||||||
float insideTexture() {
|
float insideTexture() {
|
||||||
|
@ -211,6 +210,7 @@ vec4 background() {
|
||||||
)",
|
)",
|
||||||
.body = R"(
|
.body = R"(
|
||||||
float inside = insideTexture() * (1. - paused);
|
float inside = insideTexture() * (1. - paused);
|
||||||
|
float backgroundOpacity = shadow.w;
|
||||||
result = result * inside
|
result = result * inside
|
||||||
+ (1. - inside) * (backgroundOpacity * background()
|
+ (1. - inside) * (backgroundOpacity * background()
|
||||||
+ (1. - backgroundOpacity) * frameBg);
|
+ (1. - backgroundOpacity) * frameBg);
|
||||||
|
@ -780,7 +780,9 @@ void Viewport::RendererGL::paintTile(
|
||||||
const auto uniformViewport = QSizeF(_viewport * _factor);
|
const auto uniformViewport = QSizeF(_viewport * _factor);
|
||||||
|
|
||||||
program->setUniformValue("viewport", uniformViewport);
|
program->setUniformValue("viewport", uniformViewport);
|
||||||
program->setUniformValue("frameBg", st::groupCallBg->c);
|
program->setUniformValue(
|
||||||
|
"frameBg",
|
||||||
|
fullscreen ? QColor(0, 0, 0) : st::groupCallBg->c);
|
||||||
program->setUniformValue("radiusOutline", QVector2D(
|
program->setUniformValue("radiusOutline", QVector2D(
|
||||||
GLfloat(st::roundRadiusLarge * _factor * (fullscreen ? 0. : 1.)),
|
GLfloat(st::roundRadiusLarge * _factor * (fullscreen ? 0. : 1.)),
|
||||||
(outline > 0) ? (st::groupCallOutline * _factor) : 0.f));
|
(outline > 0) ? (st::groupCallOutline * _factor) : 0.f));
|
||||||
|
@ -794,9 +796,11 @@ void Viewport::RendererGL::paintTile(
|
||||||
|
|
||||||
const auto shadowHeight = st.shadowHeight * _factor;
|
const auto shadowHeight = st.shadowHeight * _factor;
|
||||||
const auto shadowAlpha = kShadowMaxAlpha / 255.f;
|
const auto shadowAlpha = kShadowMaxAlpha / 255.f;
|
||||||
program->setUniformValue(
|
program->setUniformValue("shadow", QVector4D(
|
||||||
"shadow",
|
shadowHeight,
|
||||||
QVector3D(shadowHeight, shown, shadowAlpha));
|
shown,
|
||||||
|
shadowAlpha,
|
||||||
|
fullscreen ? 0. : kBlurOpacity));
|
||||||
program->setUniformValue("paused", GLfloat(paused));
|
program->setUniformValue("paused", GLfloat(paused));
|
||||||
|
|
||||||
f.glActiveTexture(_rgbaFrame ? GL_TEXTURE1 : GL_TEXTURE3);
|
f.glActiveTexture(_rgbaFrame ? GL_TEXTURE1 : GL_TEXTURE3);
|
||||||
|
|
|
@ -51,8 +51,10 @@ void Viewport::RendererSW::paintFallback(
|
||||||
}
|
}
|
||||||
paintTile(p, tile.get(), bounding, bg);
|
paintTile(p, tile.get(), bounding, bg);
|
||||||
}
|
}
|
||||||
|
const auto fullscreen = _owner->_fullscreen;
|
||||||
|
const auto color = fullscreen ? QColor(0, 0, 0) : st::groupCallBg->c;
|
||||||
for (const auto &rect : bg) {
|
for (const auto &rect : bg) {
|
||||||
p.fillRect(rect, st::groupCallBg);
|
p.fillRect(rect, color);
|
||||||
}
|
}
|
||||||
for (auto i = _tileData.begin(); i != _tileData.end();) {
|
for (auto i = _tileData.begin(); i != _tileData.end();) {
|
||||||
if (i->second.stale) {
|
if (i->second.stale) {
|
||||||
|
@ -113,10 +115,13 @@ void Viewport::RendererSW::paintTile(
|
||||||
const auto frameRotation = _userpicFrame ? 0 : data.rotation;
|
const auto frameRotation = _userpicFrame ? 0 : data.rotation;
|
||||||
Assert(!image.isNull());
|
Assert(!image.isNull());
|
||||||
|
|
||||||
|
const auto background = _owner->_fullscreen
|
||||||
|
? QColor(0, 0, 0)
|
||||||
|
: st::groupCallMembersBg->c;
|
||||||
const auto fill = [&](QRect rect) {
|
const auto fill = [&](QRect rect) {
|
||||||
const auto intersected = rect.intersected(clip);
|
const auto intersected = rect.intersected(clip);
|
||||||
if (!intersected.isEmpty()) {
|
if (!intersected.isEmpty()) {
|
||||||
p.fillRect(intersected, st::groupCallMembersBg);
|
p.fillRect(intersected, background);
|
||||||
bg -= intersected;
|
bg -= intersected;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ba40979470132db759fe8b8e7ff8ca70845f92c1
|
Subproject commit d98c3d539b0eb7c00f664c445ab4194c28e8cef7
|
Loading…
Add table
Reference in a new issue