2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Hook main queue processing to update requests.

This commit is contained in:
John Preston
2019-07-04 15:33:11 +02:00
parent b1807938ad
commit 0e964b06dc
8 changed files with 100 additions and 48 deletions

View File

@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "platform/platform_specific.h"
#include <execinfo.h>
#include <signal.h>
@@ -39,6 +41,10 @@ inline std::optional<crl::time> LastUserInputTime() {
return std::nullopt;
}
inline constexpr bool UseMainQueueGeneric() {
return true;
}
} // namespace Platform
inline QString psServerPrefix() {

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "platform/platform_specific.h"
#include "platform/mac/specific_mac_p.h"
namespace Data {
@@ -23,6 +24,10 @@ QString CurrentExecutablePath(int argc, char *argv[]);
void RemoveQuarantine(const QString &path);
inline constexpr bool UseMainQueueGeneric() {
return false;
}
namespace ThirdParty {
inline void start() {

View File

@@ -29,6 +29,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <mach-o/dyld.h>
#include <AVFoundation/AVFoundation.h>
extern "C" {
void _dispatch_main_queue_callback_4CF(mach_msg_header_t *msg);
} // extern "C"
namespace {
QStringList _initLogs;
@@ -139,6 +143,10 @@ void RemoveQuarantine(const QString &path) {
removexattr(local.data(), kQuarantineAttribute, 0);
}
void DrainMainQueue() {
_dispatch_main_queue_callback_4CF(nullptr);
}
void RegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);

View File

@@ -45,6 +45,9 @@ bool OpenSystemSettings(SystemSettingsType type);
return LastUserInputTime().has_value();
}
[[nodiscard]] constexpr bool UseMainQueueGeneric();
void DrainMainQueue(); // Needed only if UseMainQueueGeneric() is false.
namespace ThirdParty {
void start();

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "platform/platform_specific.h"
#include "platform/win/wrapper_windows_h.h"
namespace Data {
@@ -38,6 +39,10 @@ inline void ReInitOnTopPanel(QWidget *panel) {
QString CurrentExecutablePath(int argc, char *argv[]);
inline constexpr bool UseMainQueueGeneric() {
return true;
}
namespace ThirdParty {
void start();