mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Remove some App::wnd() calls.
This commit is contained in:
@@ -59,8 +59,6 @@ QString psAppDataPath();
|
||||
void psAutoStart(bool start, bool silent = false);
|
||||
void psSendToMenu(bool send, bool silent = false);
|
||||
|
||||
QRect psDesktopRect();
|
||||
|
||||
int psCleanup();
|
||||
int psFixPrevious();
|
||||
|
||||
|
@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/application.h"
|
||||
#include "core/core_settings.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "mainwindow.h"
|
||||
#include "history/history_location_manager.h"
|
||||
#include "base/platform/mac/base_utilities_mac.h"
|
||||
@@ -36,17 +37,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include <mach-o/dyld.h>
|
||||
#include <AVFoundation/AVFoundation.h>
|
||||
|
||||
QRect psDesktopRect() {
|
||||
static QRect _monitorRect;
|
||||
static crl::time _monitorLastGot = 0;
|
||||
auto tnow = crl::now();
|
||||
if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) {
|
||||
_monitorLastGot = tnow;
|
||||
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
|
||||
}
|
||||
return _monitorRect;
|
||||
}
|
||||
|
||||
void psWriteDump() {
|
||||
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
||||
double v = objc_appkitVersion();
|
||||
@@ -56,7 +46,8 @@ void psWriteDump() {
|
||||
|
||||
void psActivateProcess(uint64 pid) {
|
||||
if (!pid) {
|
||||
objc_activateProgram(App::wnd() ? App::wnd()->winId() : 0);
|
||||
const auto window = Core::App().activeWindow();
|
||||
objc_activateProgram(window ? window->widget()->winId() : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "storage/localstorage.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "base/platform/mac/base_utilities_mac.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "lang/lang_keys.h"
|
||||
@@ -114,7 +115,11 @@ ApplicationDelegate *_sharedDelegate = nil;
|
||||
}
|
||||
|
||||
- (BOOL) applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag {
|
||||
if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray();
|
||||
if (const auto window = Core::App().activeWindow()) {
|
||||
if (window->widget()->isHidden()) {
|
||||
window->widget()->showFromTray();
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -143,9 +148,9 @@ ApplicationDelegate *_sharedDelegate = nil;
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
if (Core::IsAppLaunched() && !_ignoreActivation) {
|
||||
Core::App().handleAppActivated();
|
||||
if (auto window = App::wnd()) {
|
||||
if (window->isHidden()) {
|
||||
window->showFromTray();
|
||||
if (auto window = Core::App().activeWindow()) {
|
||||
if (window->widget()->isHidden()) {
|
||||
window->widget()->showFromTray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ void TitleWidget::mouseDoubleClickEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent) {
|
||||
if (auto window = qobject_cast<Platform::MainWindow*>(parent)) {
|
||||
if (auto window = Core::App().activeWindow()) {
|
||||
if (auto height = window->getCustomTitleHeight()) {
|
||||
return object_ptr<TitleWidget>(window, height);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent) {
|
||||
// account, with 100% scale and without "px" dimensions, because thats
|
||||
// how it will look in real launched macOS app.
|
||||
int PreviewTitleHeight() {
|
||||
if (auto window = qobject_cast<Platform::MainWindow*>(App::wnd())) {
|
||||
if (auto window = Core::App().activeWindow()) {
|
||||
if (auto height = window->getCustomTitleHeight()) {
|
||||
return height;
|
||||
}
|
||||
|
Reference in New Issue
Block a user