2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-10-03 13:26:03 +00:00

Move GTK integration out of process with D-Bus

This commit is contained in:
Ilya Fedin
2021-06-23 03:20:40 +04:00
committed by John Preston
parent d3c9bb0bc6
commit 551ea7d879
13 changed files with 729 additions and 74 deletions

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/crash_reports.h"
#include "core/update_checker.h"
#include "platform/linux/linux_gtk_integration.h"
#include <QtWidgets/QApplication>
@@ -23,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
namespace {
using Platform::internal::GtkIntegration;
class Arguments {
public:
void push(QByteArray argument) {
@@ -45,7 +48,32 @@ private:
} // namespace
Launcher::Launcher(int argc, char *argv[])
: Core::Launcher(argc, argv) {
: Core::Launcher(argc, argv)
, _arguments(argv, argv + argc) {
}
int Launcher::exec() {
for (auto i = begin(_arguments), e = end(_arguments); i != e; ++i) {
if (*i == "-basegtkintegration" && std::distance(i, e) > 2) {
return GtkIntegration::Exec(
GtkIntegration::Type::Base,
QString::fromStdString(*(i + 1)),
std::stoi(*(i + 2)));
} else if (*i == "-webviewhelper" && std::distance(i, e) > 3) {
return GtkIntegration::Exec(
GtkIntegration::Type::Webview,
QString::fromStdString(*(i + 1)),
std::stoi(*(i + 2)),
std::stoi(*(i + 3)));
} else if (*i == "-gtkintegration" && std::distance(i, e) > 2) {
return GtkIntegration::Exec(
GtkIntegration::Type::TDesktop,
QString::fromStdString(*(i + 1)),
std::stoi(*(i + 2)));
}
}
return Core::Launcher::exec();
}
void Launcher::initHook() {