mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Fix IV window geometry restoration
This commit is contained in:
parent
b9677fe1db
commit
eaf4575eb8
3 changed files with 8 additions and 4 deletions
|
@ -7,13 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
class RpWindow;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Iv {
|
||||
|
||||
class Delegate {
|
||||
public:
|
||||
virtual void ivSetLastSourceWindow(not_null<QWidget*> window) = 0;
|
||||
[[nodiscard]] virtual QRect ivGeometry() const = 0;
|
||||
virtual void ivSaveGeometry(not_null<QWidget*> window) = 0;
|
||||
virtual void ivSaveGeometry(not_null<Ui::RpWindow*> window) = 0;
|
||||
};
|
||||
|
||||
} // namespace Iv
|
||||
|
|
|
@ -67,7 +67,7 @@ QRect DelegateImpl::ivGeometry() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void DelegateImpl::ivSaveGeometry(not_null<QWidget*> window) {
|
||||
void DelegateImpl::ivSaveGeometry(not_null<Ui::RpWindow*> window) {
|
||||
if (!window->windowHandle()) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ void DelegateImpl::ivSaveGeometry(not_null<QWidget*> window) {
|
|||
realPosition.moncrc = 0;
|
||||
DEBUG_LOG(("IV Pos: Saving maximized position."));
|
||||
} else {
|
||||
auto r = window->geometry();
|
||||
auto r = window->body()->mapToGlobal(window->body()->rect());
|
||||
realPosition.x = r.x();
|
||||
realPosition.y = r.y();
|
||||
realPosition.w = r.width();
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
void ivSetLastSourceWindow(not_null<QWidget*> window) override;
|
||||
[[nodiscard]] QRect ivGeometry() const override;
|
||||
void ivSaveGeometry(not_null<QWidget*> window) override;
|
||||
void ivSaveGeometry(not_null<Ui::RpWindow*> window) override;
|
||||
|
||||
private:
|
||||
QPointer<QWidget> _lastSourceWindow;
|
||||
|
|
Loading…
Add table
Reference in a new issue