Fix maximize/fullscreen of pinned-to-top livestream.

This commit is contained in:
John Preston 2023-08-21 13:14:22 +02:00
parent 56555c330b
commit d7e2046ef3
2 changed files with 26 additions and 0 deletions

View File

@ -146,6 +146,23 @@ Main::Session &Show::session() const {
return panel->call()->peer()->session();
}
#ifdef Q_OS_WIN
void UnpinMaximized(not_null<QWidget*> widget) {
SetWindowPos(
reinterpret_cast<HWND>(widget->window()->windowHandle()->winId()),
HWND_NOTOPMOST,
0,
0,
0,
0,
(SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOOWNERZORDER
| SWP_FRAMECHANGED
| SWP_NOACTIVATE));
}
#endif // Q_OS_WIN
} // namespace
struct Panel::ControlsBackgroundNarrow {
@ -1257,7 +1274,12 @@ void Panel::createPinOnTop() {
_pinOnTop->setVisible(!fullScreenOrMaximized);
if (fullScreenOrMaximized) {
#ifdef Q_OS_WIN
UnpinMaximized(window());
_unpinnedMaximized = true;
#else // Q_OS_WIN
pin(false);
#endif // Q_OS_WIN
_viewport->rp()->events(
) | rpl::filter([](not_null<QEvent*> event) {
@ -1269,6 +1291,9 @@ void Panel::createPinOnTop() {
_hideControlsTimer.callOnce(kHideControlsTimeout);
} else {
if (_unpinnedMaximized) {
pin(false);
}
_hideControlsTimerLifetime.destroy();
_hideControlsTimer.cancel();
refreshTitleGeometry();

View File

@ -228,6 +228,7 @@ private:
const std::unique_ptr<Ui::LayerManager> _layerBg;
rpl::variable<PanelMode> _mode;
rpl::variable<bool> _fullScreenOrMaximized = false;
bool _unpinnedMaximized = false;
#ifndef Q_OS_MAC
rpl::variable<int> _controlsTop = 0;