Get rid of DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Desktop App Toolkit uses GLib as the D-Bus library for quite long time, but GLib is not only a D-Bus library, it's more a basic library providing native Linux APIs implementing various specs. The situation right now is that DESKTOP_APP_DISABLE_DBUS_INTEGRATION disables not only D-Bus code but all the native API integration such as MIME handling or .desktop file parsing. In other words, the option disables native Linux APIs on Linux what is absurd and doesn't have any sense.
This commit is contained in:
parent
37f5576c38
commit
0a011db483
|
@ -57,7 +57,6 @@ jobs:
|
|||
matrix:
|
||||
defines:
|
||||
- ""
|
||||
- "DESKTOP_APP_DISABLE_DBUS_INTEGRATION"
|
||||
- "DESKTOP_APP_DISABLE_X11_INTEGRATION"
|
||||
- "DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION"
|
||||
|
||||
|
|
|
@ -1082,7 +1082,6 @@ PRIVATE
|
|||
platform/linux/integration_linux.h
|
||||
platform/linux/main_window_linux.cpp
|
||||
platform/linux/main_window_linux.h
|
||||
platform/linux/notifications_manager_linux_dummy.cpp
|
||||
platform/linux/notifications_manager_linux.cpp
|
||||
platform/linux/notifications_manager_linux.h
|
||||
platform/linux/overlay_widget_linux.h
|
||||
|
@ -1401,18 +1400,6 @@ if (NOT build_winstore)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
|
||||
remove_target_sources(Telegram ${src_loc}
|
||||
platform/linux/linux_xdp_open_with_dialog.cpp
|
||||
platform/linux/linux_xdp_open_with_dialog.h
|
||||
platform/linux/notifications_manager_linux.cpp
|
||||
)
|
||||
else()
|
||||
remove_target_sources(Telegram ${src_loc}
|
||||
platform/linux/notifications_manager_linux_dummy.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
remove_target_sources(Telegram ${src_loc}
|
||||
platform/linux/linux_wayland_integration.cpp
|
||||
|
@ -1522,12 +1509,10 @@ elseif (APPLE)
|
|||
endif()
|
||||
endif()
|
||||
else()
|
||||
if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
desktop-app::external_glibmm
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
desktop-app::external_glibmm
|
||||
)
|
||||
|
||||
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
|
||||
target_link_libraries(Telegram
|
||||
|
|
|
@ -7,23 +7,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "platform/linux/file_utilities_linux.h"
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include "base/platform/linux/base_linux_app_launch_context.h"
|
||||
#include "platform/linux/linux_xdp_open_with_dialog.h"
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
#include <QtGui/QDesktopServices>
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include <glibmm.h>
|
||||
#include <giomm.h>
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
namespace Platform {
|
||||
namespace File {
|
||||
|
||||
void UnsafeOpenUrl(const QString &url) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
try {
|
||||
if (Gio::AppInfo::launch_default_for_uri(
|
||||
url.toStdString(),
|
||||
|
@ -33,7 +28,6 @@ void UnsafeOpenUrl(const QString &url) {
|
|||
} catch (const std::exception &e) {
|
||||
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
@ -43,17 +37,14 @@ void UnsafeOpenEmailLink(const QString &email) {
|
|||
}
|
||||
|
||||
bool UnsafeShowOpenWith(const QString &filepath) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
if (internal::ShowXDPOpenWithDialog(filepath)) {
|
||||
return true;
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void UnsafeLaunch(const QString &filepath) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
try {
|
||||
if (Gio::AppInfo::launch_default_for_uri(
|
||||
Glib::filename_to_uri(filepath.toStdString()),
|
||||
|
@ -67,7 +58,6 @@ void UnsafeLaunch(const QString &filepath) {
|
|||
if (UnsafeShowOpenWith(filepath)) {
|
||||
return;
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(filepath));
|
||||
}
|
||||
|
|
|
@ -26,15 +26,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/platform/linux/base_linux_glibmm_helper.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/ui_utility.h"
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include "base/platform/linux/base_linux_glibmm_helper.h"
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
#include "base/platform/linux/base_linux_xcb_utilities.h"
|
||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
|
@ -44,10 +41,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtGui/QWindow>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include <glibmm.h>
|
||||
#include <giomm.h>
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
namespace Platform {
|
||||
namespace {
|
||||
|
@ -177,7 +172,6 @@ void ForceDisabled(QAction *action, bool disabled) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
uint djbStringHash(const std::string &string) {
|
||||
uint hash = 5381;
|
||||
for (const auto &curChar : string) {
|
||||
|
@ -185,7 +179,6 @@ uint djbStringHash(const std::string &string) {
|
|||
}
|
||||
return hash;
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -245,7 +238,6 @@ void MainWindow::updateWindowIcon() {
|
|||
}
|
||||
|
||||
void MainWindow::updateUnityCounter() {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
const auto launcherUrl = Glib::ustring(
|
||||
"application://"
|
||||
+ QGuiApplication::desktopFileName().toStdString());
|
||||
|
@ -281,7 +273,6 @@ void MainWindow::updateUnityCounter() {
|
|||
}));
|
||||
} catch (...) {
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
}
|
||||
|
||||
void MainWindow::createGlobalMenu() {
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "platform/linux/notifications_manager_linux.h"
|
||||
|
||||
#include "base/platform/base_platform_info.h"
|
||||
|
||||
namespace Platform {
|
||||
namespace Notifications {
|
||||
|
||||
bool SkipToastForCustom() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void MaybePlaySoundForCustom(Fn<void()> playSound) {
|
||||
playSound();
|
||||
}
|
||||
|
||||
void MaybeFlashBounceForCustom(Fn<void()> flashBounce) {
|
||||
flashBounce();
|
||||
}
|
||||
|
||||
bool WaitForInputForCustom() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Supported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Enforced() {
|
||||
// Wayland doesn't support positioning
|
||||
// and custom notifications don't work here
|
||||
return IsWayland();
|
||||
}
|
||||
|
||||
bool ByDefault() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Create(Window::Notifications::System *system) {
|
||||
if (Enforced()) {
|
||||
using DummyManager = Window::Notifications::DummyManager;
|
||||
system->setManager(std::make_unique<DummyManager>(system));
|
||||
} else {
|
||||
system->setManager(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Notifications
|
||||
} // namespace Platform
|
|
@ -10,6 +10,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/random.h"
|
||||
#include "base/options.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/platform/linux/base_linux_glibmm_helper.h"
|
||||
#include "base/platform/linux/base_linux_dbus_utilities.h"
|
||||
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
||||
#include "platform/linux/linux_desktop_environment.h"
|
||||
#include "platform/linux/linux_wayland_integration.h"
|
||||
#include "platform/platform_launcher.h"
|
||||
|
@ -24,12 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_controller.h"
|
||||
#include "webview/platform/linux/webview_linux_webkitgtk.h"
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include "base/platform/linux/base_linux_glibmm_helper.h"
|
||||
#include "base/platform/linux/base_linux_dbus_utilities.h"
|
||||
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
#include "base/platform/linux/base_linux_xcb_utilities.h"
|
||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
|
@ -42,10 +39,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <kshell.h>
|
||||
#include <ksandbox.h>
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include <glibmm.h>
|
||||
#include <giomm.h>
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -68,7 +63,6 @@ typedef int (*XErrorHandler)(Display*, XErrorEvent*);
|
|||
typedef XErrorHandler (*LPXSETERRORHANDLER)(XErrorHandler);
|
||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
typedef GApplication TDesktopApplication;
|
||||
typedef GApplicationClass TDesktopApplicationClass;
|
||||
|
||||
|
@ -119,14 +113,12 @@ static void t_desktop_application_class_init(
|
|||
|
||||
static void t_desktop_application_init(TDesktopApplication *application) {
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
namespace Platform {
|
||||
namespace {
|
||||
|
||||
constexpr auto kDesktopFile = ":/misc/org.telegram.desktop.desktop"_cs;
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
bool PortalAutostart(bool start, bool silent) {
|
||||
if (cExeName().isEmpty()) {
|
||||
return false;
|
||||
|
@ -564,7 +556,6 @@ void InstallLauncher() {
|
|||
applicationsPath
|
||||
});
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -584,7 +575,6 @@ QString SingleInstanceLocalServerName(const QString &hash) {
|
|||
}
|
||||
|
||||
std::optional<bool> IsDarkMode() {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
[[maybe_unused]] static const auto Inited = [] {
|
||||
using XDPSettingWatcher = base::Platform::XDP::SettingWatcher;
|
||||
static const XDPSettingWatcher Watcher(
|
||||
|
@ -619,21 +609,15 @@ std::optional<bool> IsDarkMode() {
|
|||
}
|
||||
} catch (...) {
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool AutostartSupported() {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
return true;
|
||||
#else // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
return false;
|
||||
#endif // DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
}
|
||||
|
||||
void AutostartToggle(bool enabled, Fn<void(bool)> done) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
const auto success = [&] {
|
||||
const auto silent = !done;
|
||||
|
||||
|
@ -660,7 +644,6 @@ void AutostartToggle(bool enabled, Fn<void(bool)> done) {
|
|||
if (done) {
|
||||
done(enabled && success);
|
||||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
}
|
||||
|
||||
bool AutostartSkip() {
|
||||
|
@ -775,7 +758,6 @@ void start() {
|
|||
qputenv("PULSE_PROP_application.name", AppName.utf8());
|
||||
qputenv("PULSE_PROP_application.icon_name", base::IconName().toLatin1());
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
Glib::set_prgname(cExeName().toStdString());
|
||||
Glib::set_application_name(AppName.data());
|
||||
|
||||
|
@ -793,7 +775,6 @@ void start() {
|
|||
"Application was built without embedded fonts, "
|
||||
"this may lead to font issues.");
|
||||
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
Webview::WebKitGTK::SetSocketPath(u"%1/%2-%3-webview-%4"_q.arg(
|
||||
QDir::tempPath(),
|
||||
|
@ -887,10 +868,8 @@ void start() {
|
|||
}
|
||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
InstallLauncher();
|
||||
LaunchGApplication();
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
}
|
||||
|
||||
void finish() {
|
||||
|
|
|
@ -40,9 +40,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#if __has_include(<giomm.h>)
|
||||
#include <giomm.h>
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#endif // __has_include(<giomm.h>)
|
||||
|
||||
namespace Window {
|
||||
namespace Notifications {
|
||||
|
@ -90,11 +90,11 @@ base::options::toggle OptionGNotification({
|
|||
.description = "Force enable GLib's GNotification."
|
||||
" When disabled, autodetect is used.",
|
||||
.scope = [] {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#if __has_include(<giomm.h>)
|
||||
return bool(Gio::Application::get_default());
|
||||
#else // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#else // __has_include(<giomm.h>)
|
||||
return false;
|
||||
#endif // DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#endif // __has_include(<giomm.h>)
|
||||
},
|
||||
.restartRequired = true,
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 02462671e56bcf5498f1ae00806a680791be3b0a
|
||||
Subproject commit 05f50c86bc721d67df2378d27d5a48c4890a8f07
|
|
@ -1 +1 @@
|
|||
Subproject commit 7c9aa94533276d693942ed0ffb39d3d66a49e124
|
||||
Subproject commit e8857f5792c8c8bc721be0607e07ccd5616b939b
|
|
@ -1 +1 @@
|
|||
Subproject commit f632fc84cbc62ae8abbbd05f81d472757a337c11
|
||||
Subproject commit 2e313690d9765f28fc98c6c79473296de3a3d85c
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
|||
Subproject commit d625b4d1ba9dbcbb2f7a8f6555e1658569aaa093
|
||||
Subproject commit 9abd685bf498f2410dfbc42f77c99e35ddedca94
|
Loading…
Reference in New Issue