mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Use better initial geometry for new windows.
This commit is contained in:
@@ -91,6 +91,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/connection_box.h"
|
||||
#include "boxes/premium_limits_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "styles/style_window.h"
|
||||
|
||||
#include <QtCore/QStandardPaths>
|
||||
#include <QtCore/QMimeDatabase>
|
||||
@@ -185,7 +186,7 @@ Application::~Application() {
|
||||
}
|
||||
|
||||
setLastActiveWindow(nullptr);
|
||||
_lastActivePrimaryWindow = nullptr;
|
||||
_windowInSettings = _lastActivePrimaryWindow = nullptr;
|
||||
_closingAsyncWindows.clear();
|
||||
_secondaryWindows.clear();
|
||||
_primaryWindows.clear();
|
||||
@@ -289,7 +290,7 @@ void Application::run() {
|
||||
|
||||
_primaryWindows.emplace(nullptr, std::make_unique<Window::Controller>());
|
||||
setLastActiveWindow(_primaryWindows.front().second.get());
|
||||
_lastActivePrimaryWindow = _lastActiveWindow;
|
||||
_windowInSettings = _lastActivePrimaryWindow = _lastActiveWindow;
|
||||
|
||||
_domain->activeChanges(
|
||||
) | rpl::start_with_next([=](not_null<Main::Account*> account) {
|
||||
@@ -1162,6 +1163,11 @@ void Application::localPasscodeChanged() {
|
||||
checkAutoLock(crl::now());
|
||||
}
|
||||
|
||||
bool Application::savingPositionFor(
|
||||
not_null<Window::Controller*> window) const {
|
||||
return !_windowInSettings || (_windowInSettings == window);
|
||||
}
|
||||
|
||||
bool Application::hasActiveWindow(not_null<Main::Session*> session) const {
|
||||
if (Quitting() || !_lastActiveWindow) {
|
||||
return false;
|
||||
@@ -1319,6 +1325,9 @@ void Application::closeWindow(not_null<Window::Controller*> window) {
|
||||
if (_lastActivePrimaryWindow == window) {
|
||||
_lastActivePrimaryWindow = next;
|
||||
}
|
||||
if (_windowInSettings == window) {
|
||||
_windowInSettings = next;
|
||||
}
|
||||
if (_lastActiveWindow == window) {
|
||||
setLastActiveWindow(next);
|
||||
if (_lastActiveWindow) {
|
||||
@@ -1331,6 +1340,7 @@ void Application::closeWindow(not_null<Window::Controller*> window) {
|
||||
if (i->second.get() == window) {
|
||||
Assert(_lastActiveWindow != window);
|
||||
Assert(_lastActivePrimaryWindow != window);
|
||||
Assert(_windowInSettings != window);
|
||||
i = _primaryWindows.erase(i);
|
||||
} else {
|
||||
++i;
|
||||
|
Reference in New Issue
Block a user