Improve call / voicechat title controls on Windows 11.

This commit is contained in:
John Preston 2022-01-18 15:53:04 +03:00
parent 11f183a79f
commit 4934b026d3
5 changed files with 19 additions and 16 deletions

View File

@ -61,8 +61,8 @@ Panel::Panel(not_null<Call*> call)
, _user(call->user())
, _layerBg(std::make_unique<Ui::LayerManager>(widget()))
#ifndef Q_OS_MAC
, _controls(std::make_unique<Ui::Platform::TitleControls>(
widget(),
, _controls(Ui::Platform::SetupSeparateTitleControls(
window(),
st::callTitle,
[=](bool maximized) { toggleFullScreen(maximized); }))
#endif // !Q_OS_MAC
@ -144,7 +144,7 @@ void Panel::initWindow() {
return Flag::None | Flag(0);
}
#ifndef Q_OS_MAC
if (_controls->geometry().contains(widgetPoint)) {
if (_controls->controls.geometry().contains(widgetPoint)) {
return Flag::None | Flag(0);
}
#endif // !Q_OS_MAC
@ -550,7 +550,7 @@ void Panel::initLayout() {
}, widget()->lifetime());
#ifndef Q_OS_MAC
_controls->raise();
_controls->wrap.raise();
#endif // !Q_OS_MAC
}
@ -628,7 +628,7 @@ void Panel::updateControlsGeometry() {
}
if (_fingerprint) {
#ifndef Q_OS_MAC
const auto controlsGeometry = _controls->geometry();
const auto controlsGeometry = _controls->controls.geometry();
const auto halfWidth = widget()->width() / 2;
const auto minLeft = (controlsGeometry.center().x() < halfWidth)
? (controlsGeometry.width() + st::callFingerprintTop)

View File

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/weak_ptr.h"
#include "base/timer.h"
#include "base/object_ptr.h"
#include "base/unique_qptr.h"
#include "calls/calls_call.h"
#include "calls/group/ui/desktop_capture_choose_source.h"
#include "ui/effects/animations.h"
@ -37,7 +38,7 @@ namespace GL {
enum class Backend;
} // namespace GL
namespace Platform {
class TitleControls;
struct SeparateTitleControls;
} // namespace Platform
} // namespace Ui
@ -126,7 +127,7 @@ private:
std::unique_ptr<Incoming> _incoming;
#ifndef Q_OS_MAC
std::unique_ptr<Ui::Platform::TitleControls> _controls;
std::unique_ptr<Ui::Platform::SeparateTitleControls> _controls;
#endif // !Q_OS_MAC
QSize _incomingFrameSize;

View File

@ -88,8 +88,8 @@ Panel::Panel(not_null<GroupCall*> call)
, _peer(call->peer())
, _layerBg(std::make_unique<Ui::LayerManager>(widget()))
#ifndef Q_OS_MAC
, _controls(std::make_unique<Ui::Platform::TitleControls>(
widget(),
, _controls(Ui::Platform::SetupSeparateTitleControls(
window(),
st::groupCallTitle))
#endif // !Q_OS_MAC
, _viewport(
@ -302,7 +302,7 @@ void Panel::initWidget() {
updateControlsGeometry();
}
// title geometry depends on _controls->geometry,
// title geometry depends on _controls->controls.geometry,
// which is not updated here yet.
crl::on_main(widget(), [=] { refreshTitle(); });
}, lifetime());
@ -1368,7 +1368,7 @@ void Panel::initLayout() {
initGeometry();
#ifndef Q_OS_MAC
_controls->raise();
_controls->wrap.raise();
Ui::Platform::TitleControlsLayoutChanged(
) | rpl::start_with_next([=] {
@ -1413,7 +1413,7 @@ QRect Panel::computeTitleRect() const {
#ifdef Q_OS_MAC
return QRect(70, 0, width - remove - 70, 28);
#else // Q_OS_MAC
const auto controls = _controls->geometry();
const auto controls = _controls->controls.geometry();
const auto right = controls.x() + controls.width() + skip;
return (controls.center().x() < width / 2)
? QRect(right, 0, width - right - remove, controls.height())
@ -1884,7 +1884,8 @@ void Panel::updateControlsGeometry() {
#ifdef Q_OS_MAC
const auto controlsOnTheLeft = true;
#else // Q_OS_MAC
const auto controlsOnTheLeft = _controls->geometry().center().x()
const auto center = _controls->controls.geometry().center();
const auto controlsOnTheLeft = center.x()
< widget()->width() / 2;
#endif // Q_OS_MAC
const auto menux = st::groupCallMenuTogglePosition.x();

View File

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer.h"
#include "base/flags.h"
#include "base/object_ptr.h"
#include "base/unique_qptr.h"
#include "calls/group/calls_group_call.h"
#include "calls/group/calls_group_common.h"
#include "calls/group/calls_choose_join_as.h"
@ -51,7 +52,7 @@ namespace Toast {
class Instance;
} // namespace Toast
namespace Platform {
class TitleControls;
struct SeparateTitleControls;
} // namespace Platform
} // namespace Ui
@ -194,7 +195,7 @@ private:
rpl::variable<PanelMode> _mode;
#ifndef Q_OS_MAC
std::unique_ptr<Ui::Platform::TitleControls> _controls;
std::unique_ptr<Ui::Platform::SeparateTitleControls> _controls;
#endif // !Q_OS_MAC
rpl::lifetime _callLifetime;

@ -1 +1 @@
Subproject commit 64fa3d83b5fa70394dd7c0a023ae3c8c9e809d8c
Subproject commit d5d2ccb4677c8d86c33d628699ed86bb9c8fc948