mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Remove some App::wnd() calls.
This commit is contained in:
@@ -218,6 +218,15 @@ void MainWindow::updateWindowIcon() {
|
||||
setWindowIcon(_icon);
|
||||
}
|
||||
|
||||
QRect MainWindow::desktopRect() const {
|
||||
const auto now = crl::now();
|
||||
if (now >= _monitorLastGot && now <= _monitorLastGot + crl::time(1000)) {
|
||||
_monitorLastGot = now;
|
||||
_monitorRect = computeDesktopRect();
|
||||
}
|
||||
return _monitorRect;
|
||||
}
|
||||
|
||||
void MainWindow::init() {
|
||||
Expects(!windowHandle());
|
||||
|
||||
@@ -612,6 +621,10 @@ void MainWindow::updateUnreadCounter() {
|
||||
unreadCounterChangedHook();
|
||||
}
|
||||
|
||||
QRect MainWindow::computeDesktopRect() const {
|
||||
return QApplication::desktop()->availableGeometry(this);
|
||||
}
|
||||
|
||||
void MainWindow::savePosition(Qt::WindowState state) {
|
||||
if (state == Qt::WindowActive) {
|
||||
state = windowHandle()->windowState();
|
||||
@@ -698,8 +711,9 @@ bool MainWindow::minimizeToTray() {
|
||||
|
||||
void MainWindow::reActivateWindow() {
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
const auto reActivate = [=] {
|
||||
if (const auto w = App::wnd()) {
|
||||
if (const auto w = weak.data()) {
|
||||
if (auto f = QApplication::focusWidget()) {
|
||||
f->clearFocus();
|
||||
}
|
||||
@@ -723,8 +737,8 @@ void MainWindow::showRightColumn(object_ptr<TWidget> widget) {
|
||||
_rightColumn->setParent(this);
|
||||
_rightColumn->show();
|
||||
_rightColumn->setFocus();
|
||||
} else if (App::wnd()) {
|
||||
App::wnd()->setInnerFocus();
|
||||
} else {
|
||||
setInnerFocus();
|
||||
}
|
||||
const auto nowRightWidth = _rightColumn ? _rightColumn->width() : 0;
|
||||
const auto wasMaximized = isMaximized();
|
||||
@@ -777,7 +791,7 @@ int MainWindow::tryToExtendWidthBy(int addToWidth) {
|
||||
|
||||
void MainWindow::launchDrag(std::unique_ptr<QMimeData> data) {
|
||||
auto weak = QPointer<MainWindow>(this);
|
||||
auto drag = std::make_unique<QDrag>(App::wnd());
|
||||
auto drag = std::make_unique<QDrag>(this);
|
||||
drag->setMimeData(data.release());
|
||||
drag->exec(Qt::CopyAction);
|
||||
|
||||
|
Reference in New Issue
Block a user