mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Move GSDMediaKeys initialization to SetWatchingMediaKeys
This commit is contained in:
parent
8fb6ece796
commit
b9acea9cef
4 changed files with 16 additions and 26 deletions
|
@ -23,13 +23,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/localstorage.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/platform/linux/base_xcb_utilities_linux.h"
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include "platform/linux/linux_gsd_media_keys.h"
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
#include "base/call_delayed.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
|
@ -584,17 +579,6 @@ void MainWindow::initHook() {
|
|||
} else {
|
||||
LOG(("Not using Unity launcher counter."));
|
||||
}
|
||||
|
||||
Media::Player::instance()->updatedNotifier(
|
||||
) | rpl::start_with_next([=](const Media::Player::TrackState &state) {
|
||||
if (!Media::Player::IsStoppedOrStopping(state.state)) {
|
||||
if (!_gsdMediaKeys) {
|
||||
_gsdMediaKeys = std::make_unique<internal::GSDMediaKeys>();
|
||||
}
|
||||
} else if (_gsdMediaKeys) {
|
||||
_gsdMediaKeys = nullptr;
|
||||
}
|
||||
}, lifetime());
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
updateWaylandDecorationColors();
|
||||
|
|
|
@ -25,11 +25,6 @@ typedef struct _GDBusProxy GDBusProxy;
|
|||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
namespace Platform {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
namespace internal {
|
||||
class GSDMediaKeys;
|
||||
} // namespace internal
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
class MainWindow : public Window::MainWindow {
|
||||
public:
|
||||
|
@ -93,8 +88,6 @@ private:
|
|||
bool _appMenuSupported = false;
|
||||
DBusMenuExporter *_mainMenuExporter = nullptr;
|
||||
|
||||
std::unique_ptr<internal::GSDMediaKeys> _gsdMediaKeys;
|
||||
|
||||
QMenu *psMainMenu = nullptr;
|
||||
QAction *psLogout = nullptr;
|
||||
QAction *psUndo = nullptr;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -17,9 +17,6 @@ class LocationPoint;
|
|||
|
||||
namespace Platform {
|
||||
|
||||
inline void SetWatchingMediaKeys(bool watching) {
|
||||
}
|
||||
|
||||
bool InFlatpak();
|
||||
bool InSnap();
|
||||
bool IsStaticBinary();
|
||||
|
|
Loading…
Add table
Reference in a new issue