mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Merge tag 'v6.5.1' into dev
This commit is contained in:
@@ -619,7 +619,7 @@ void Controller::createWindow() {
|
||||
updateTitleGeometry(width);
|
||||
}, _subtitle->lifetime());
|
||||
|
||||
window->setGeometry(_delegate->ivGeometry());
|
||||
window->setGeometry(_delegate->ivGeometry(window));
|
||||
window->setMinimumSize({ st::windowMinWidth, st::windowMinHeight });
|
||||
|
||||
window->geometryValue(
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace Iv {
|
||||
|
||||
class Delegate {
|
||||
public:
|
||||
virtual void ivSetLastSourceWindow(not_null<QWidget*> window) = 0;
|
||||
[[nodiscard]] virtual QRect ivGeometry() const = 0;
|
||||
[[nodiscard]] virtual QRect ivGeometry(not_null<Ui::RpWindow*> window) const = 0;
|
||||
virtual void ivSaveGeometry(not_null<Ui::RpWindow*> window) = 0;
|
||||
|
||||
[[nodiscard]] virtual int ivZoom() const = 0;
|
||||
|
||||
@@ -45,26 +45,16 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
void DelegateImpl::ivSetLastSourceWindow(not_null<QWidget*> window) {
|
||||
_lastSourceWindow = window;
|
||||
}
|
||||
|
||||
QRect DelegateImpl::ivGeometry() const {
|
||||
const auto found = _lastSourceWindow
|
||||
? Core::App().findWindow(_lastSourceWindow)
|
||||
: nullptr;
|
||||
|
||||
QRect DelegateImpl::ivGeometry(not_null<Ui::RpWindow*> window) const {
|
||||
const auto saved = Core::App().settings().ivPosition();
|
||||
const auto adjusted = Core::AdjustToScale(saved, u"IV"_q);
|
||||
const auto initial = DefaultPosition();
|
||||
auto result = initial.rect();
|
||||
if (const auto window = found ? found : Core::App().activeWindow()) {
|
||||
result = window->widget()->countInitialGeometry(
|
||||
adjusted,
|
||||
initial,
|
||||
{ st::ivWidthMin, st::ivHeightMin });
|
||||
}
|
||||
return result;
|
||||
return Window::CountInitialGeometry(
|
||||
window,
|
||||
adjusted,
|
||||
initial,
|
||||
{ st::ivWidthMin, st::ivHeightMin },
|
||||
u"IV"_q);
|
||||
}
|
||||
|
||||
void DelegateImpl::ivSaveGeometry(not_null<Ui::RpWindow*> window) {
|
||||
@@ -100,7 +90,8 @@ void DelegateImpl::ivSaveGeometry(not_null<Ui::RpWindow*> window) {
|
||||
realPosition = Window::PositionWithScreen(
|
||||
realPosition,
|
||||
window,
|
||||
{ st::ivWidthMin, st::ivHeightMin });
|
||||
{ st::ivWidthMin, st::ivHeightMin },
|
||||
u"IV"_q);
|
||||
if (realPosition.w >= st::ivWidthMin
|
||||
&& realPosition.h >= st::ivHeightMin
|
||||
&& realPosition != savedPosition) {
|
||||
|
||||
@@ -15,17 +15,13 @@ class DelegateImpl final : public Delegate {
|
||||
public:
|
||||
DelegateImpl() = default;
|
||||
|
||||
void ivSetLastSourceWindow(not_null<QWidget*> window) override;
|
||||
[[nodiscard]] QRect ivGeometry() const override;
|
||||
[[nodiscard]] QRect ivGeometry(not_null<Ui::RpWindow*> window) const override;
|
||||
void ivSaveGeometry(not_null<Ui::RpWindow*> window) override;
|
||||
|
||||
[[nodiscard]] int ivZoom() const override;
|
||||
[[nodiscard]] rpl::producer<int> ivZoomValue() const override;
|
||||
void ivSetZoom(int value) override;
|
||||
|
||||
private:
|
||||
QPointer<QWidget> _lastSourceWindow;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Iv
|
||||
|
||||
@@ -829,7 +829,6 @@ void Instance::show(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Data*> data,
|
||||
QString hash) {
|
||||
_delegate->ivSetLastSourceWindow(controller->widget());
|
||||
show(controller->uiShow(), data, hash);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user