2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-08 10:26:37 +00:00

Move GSDMediaKeys initialization to SetWatchingMediaKeys

This commit is contained in:
Ilya Fedin
2021-01-02 10:26:07 +04:00
committed by John Preston
parent 8fb6ece796
commit b9acea9cef
4 changed files with 16 additions and 26 deletions

View File

@@ -24,6 +24,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#include "core/application.h"
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "platform/linux/linux_gsd_media_keys.h"
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtCore/QStandardPaths>
@@ -521,6 +525,18 @@ Window::Control GtkKeywordToWindowControl(const QString &keyword) {
} // namespace
void SetWatchingMediaKeys(bool watching) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
static std::unique_ptr<internal::GSDMediaKeys> Instance;
if (watching && !Instance) {
Instance = std::make_unique<internal::GSDMediaKeys>();
} else if (!watching && Instance) {
Instance = nullptr;
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
}
void SetApplicationIcon(const QIcon &icon) {
QApplication::setWindowIcon(icon);
}