mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-27 17:13:40 +00:00
Never use custom notifications on Wayland since there are no positioning API
This commit is contained in:
parent
2559a3590d
commit
56de3194ef
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/linux/notifications_manager_linux.h"
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "history/history.h"
|
||||
#include "lang/lang_keys.h"
|
||||
@ -70,7 +71,7 @@ void GetSupported() {
|
||||
}
|
||||
Checked = true;
|
||||
|
||||
if (Global::NativeNotifications()) {
|
||||
if (Global::NativeNotifications() && !Platform::IsWayland()) {
|
||||
ComputeSupported(true);
|
||||
} else {
|
||||
ComputeSupported();
|
||||
@ -474,7 +475,8 @@ std::unique_ptr<Window::Notifications::Manager> Create(
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
GetSupported();
|
||||
|
||||
if (Global::NativeNotifications() && Supported()) {
|
||||
if ((Global::NativeNotifications() && Supported())
|
||||
|| Platform::IsWayland()) {
|
||||
return std::make_unique<Manager>(system);
|
||||
}
|
||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
@ -488,6 +490,10 @@ Manager::Private::Private(not_null<Manager*> manager, Type type)
|
||||
, _manager(manager) {
|
||||
qDBusRegisterMetaType<NotificationData::ImageData>();
|
||||
|
||||
if (!Supported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto serverInformation = GetServerInformation();
|
||||
const auto capabilities = GetCapabilities();
|
||||
|
||||
@ -520,6 +526,8 @@ void Manager::Private::showNotification(
|
||||
const QString &msg,
|
||||
bool hideNameAndPhoto,
|
||||
bool hideReplyButton) {
|
||||
if (!Supported()) return;
|
||||
|
||||
auto notification = std::make_shared<NotificationData>(
|
||||
_manager,
|
||||
title,
|
||||
@ -558,6 +566,8 @@ void Manager::Private::showNotification(
|
||||
}
|
||||
|
||||
void Manager::Private::clearAll() {
|
||||
if (!Supported()) return;
|
||||
|
||||
auto temp = base::take(_notifications);
|
||||
for_const (auto ¬ifications, temp) {
|
||||
for_const (auto notification, notifications) {
|
||||
@ -567,6 +577,8 @@ void Manager::Private::clearAll() {
|
||||
}
|
||||
|
||||
void Manager::Private::clearFromHistory(not_null<History*> history) {
|
||||
if (!Supported()) return;
|
||||
|
||||
auto i = _notifications.find(history->peer->id);
|
||||
if (i != _notifications.cend()) {
|
||||
auto temp = base::take(i.value());
|
||||
@ -579,6 +591,8 @@ void Manager::Private::clearFromHistory(not_null<History*> history) {
|
||||
}
|
||||
|
||||
void Manager::Private::clearNotification(PeerId peerId, MsgId msgId) {
|
||||
if (!Supported()) return;
|
||||
|
||||
auto i = _notifications.find(peerId);
|
||||
if (i != _notifications.cend()) {
|
||||
i.value().remove(msgId);
|
||||
|
@ -634,6 +634,11 @@ void SetupNotificationsContent(
|
||||
} else if (Platform::IsWindows()) {
|
||||
return tr::lng_settings_use_windows(tr::now);
|
||||
} else if (Platform::IsLinux()) {
|
||||
#ifdef Q_OS_UNIX
|
||||
if (Platform::IsWayland()) {
|
||||
return QString();
|
||||
}
|
||||
#endif // Q_OS_UNIX
|
||||
return tr::lng_settings_use_native_notifications(tr::now);
|
||||
}
|
||||
return QString();
|
||||
|
Loading…
Reference in New Issue
Block a user