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"
|
#include "platform/linux/notifications_manager_linux.h"
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "platform/linux/specific_linux.h"
|
#include "platform/linux/specific_linux.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -70,7 +71,7 @@ void GetSupported() {
|
||||||
}
|
}
|
||||||
Checked = true;
|
Checked = true;
|
||||||
|
|
||||||
if (Global::NativeNotifications()) {
|
if (Global::NativeNotifications() && !Platform::IsWayland()) {
|
||||||
ComputeSupported(true);
|
ComputeSupported(true);
|
||||||
} else {
|
} else {
|
||||||
ComputeSupported();
|
ComputeSupported();
|
||||||
|
@ -474,7 +475,8 @@ std::unique_ptr<Window::Notifications::Manager> Create(
|
||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
GetSupported();
|
GetSupported();
|
||||||
|
|
||||||
if (Global::NativeNotifications() && Supported()) {
|
if ((Global::NativeNotifications() && Supported())
|
||||||
|
|| Platform::IsWayland()) {
|
||||||
return std::make_unique<Manager>(system);
|
return std::make_unique<Manager>(system);
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
|
@ -488,6 +490,10 @@ Manager::Private::Private(not_null<Manager*> manager, Type type)
|
||||||
, _manager(manager) {
|
, _manager(manager) {
|
||||||
qDBusRegisterMetaType<NotificationData::ImageData>();
|
qDBusRegisterMetaType<NotificationData::ImageData>();
|
||||||
|
|
||||||
|
if (!Supported()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto serverInformation = GetServerInformation();
|
const auto serverInformation = GetServerInformation();
|
||||||
const auto capabilities = GetCapabilities();
|
const auto capabilities = GetCapabilities();
|
||||||
|
|
||||||
|
@ -520,6 +526,8 @@ void Manager::Private::showNotification(
|
||||||
const QString &msg,
|
const QString &msg,
|
||||||
bool hideNameAndPhoto,
|
bool hideNameAndPhoto,
|
||||||
bool hideReplyButton) {
|
bool hideReplyButton) {
|
||||||
|
if (!Supported()) return;
|
||||||
|
|
||||||
auto notification = std::make_shared<NotificationData>(
|
auto notification = std::make_shared<NotificationData>(
|
||||||
_manager,
|
_manager,
|
||||||
title,
|
title,
|
||||||
|
@ -558,6 +566,8 @@ void Manager::Private::showNotification(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::Private::clearAll() {
|
void Manager::Private::clearAll() {
|
||||||
|
if (!Supported()) return;
|
||||||
|
|
||||||
auto temp = base::take(_notifications);
|
auto temp = base::take(_notifications);
|
||||||
for_const (auto ¬ifications, temp) {
|
for_const (auto ¬ifications, temp) {
|
||||||
for_const (auto notification, notifications) {
|
for_const (auto notification, notifications) {
|
||||||
|
@ -567,6 +577,8 @@ void Manager::Private::clearAll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::Private::clearFromHistory(not_null<History*> history) {
|
void Manager::Private::clearFromHistory(not_null<History*> history) {
|
||||||
|
if (!Supported()) return;
|
||||||
|
|
||||||
auto i = _notifications.find(history->peer->id);
|
auto i = _notifications.find(history->peer->id);
|
||||||
if (i != _notifications.cend()) {
|
if (i != _notifications.cend()) {
|
||||||
auto temp = base::take(i.value());
|
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) {
|
void Manager::Private::clearNotification(PeerId peerId, MsgId msgId) {
|
||||||
|
if (!Supported()) return;
|
||||||
|
|
||||||
auto i = _notifications.find(peerId);
|
auto i = _notifications.find(peerId);
|
||||||
if (i != _notifications.cend()) {
|
if (i != _notifications.cend()) {
|
||||||
i.value().remove(msgId);
|
i.value().remove(msgId);
|
||||||
|
|
|
@ -634,6 +634,11 @@ void SetupNotificationsContent(
|
||||||
} else if (Platform::IsWindows()) {
|
} else if (Platform::IsWindows()) {
|
||||||
return tr::lng_settings_use_windows(tr::now);
|
return tr::lng_settings_use_windows(tr::now);
|
||||||
} else if (Platform::IsLinux()) {
|
} 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 tr::lng_settings_use_native_notifications(tr::now);
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
|
Loading…
Reference in New Issue