Commit Graph

671 Commits

Author SHA1 Message Date
Ilya Fedin
62e82a42fb Adapt to lib_base's XDP API changes 2022-04-14 09:15:50 +04:00
Ilya Fedin
80f1f079f1 Move waitForInterfaceAnnounce call to the uses of announced interfaces 2022-04-14 09:11:05 +04:00
Ilya Fedin
572eb1f5f8 Remove unneeded anymore xdg-open workaround for snap 2022-04-13 15:06:06 +04:00
Ilya Fedin
17fcc729a2 Implement org.freedesktop.appearance.color-scheme 2022-04-12 17:35:51 +04:00
Ilya Fedin
6fd02ccbae Match socket length check with Qt 2022-03-08 12:41:38 +04:00
Ilya Fedin
b39e4a3138 Do not call CloseNotification for activatable services
If the notification daemon is an activatable GApplication service (e.g.
on Mate), then the notification daemon may terminate a short time after
the notification has vanished (usually 15s). In that case the
notification daemon may reuse notification IDs, which is incompatible
with our notification clearing.
Also the service may not be running at all, when we call the
CloseNotification endpoint.

To fix this, we simply disable the entire notification history clearing
functionality on such desktops by proactively clearing all notification
references from our internal notification manager.

Signed-off-by: Magnus Groß <magnus.gross@rwth-aachen.de>
2022-03-05 16:51:02 +04:00
Magnus Groß
4dd14b81e1 Do not remove notification reference on NotificationClosed
In general we need to keep a reference to the notification id, so that
we can delete the notification later from history - unless the
NotificationClosed reason was that the user actively dismissed it, in
which case it is not kept in history anyway (so we can dismiss our
reference too).

-- Background --
Some desktop environments such as KDE keep a history of notifications.
An API is provided to delete notifications from that history by calling
the org.freedesktop.Notifications.CloseNotification endpoint with the ID
of that notification. If the notification was already closed (timed
out), then this will delete the notification from history.

The intent is to clear these notifications from the notification history
as soon as a chat with notifications originating from that person is
opened, as the user is then not interested anymore in those
notifications and to prevent unnecessary clutter in the history widget.
It is also cleared when the chat is read on another device.

-- Problem --
Telegram already has all the code in place to support this
functionality, but unfortunately this did not work on Linux before,
because we listen to the NotificationClosed signal and remove our
reference to the notification id from our internal manager as soon as we
get that signal. This means that we do not clear that notification from
history once we open the chat with that person (unless we open the chat
before the notification has timed out, i.e. if we didn't get the
NotificationClosed signal).

-- Fix --
To fix this, we keep our notification reference (if the notification was
not dismissed by the user), which means that our reference will be kept
around until we open the chat with that person (or close Telegram
entirely).

Since all the needed functionality for deleting notifications was
already in place, this patch is quite short as we only need to keep the
reference around longer than we did before this patch.

Note also that code is already in place to clear notifications for
messages that were read on another device: History::inboxRead() calls
Core::App().notifications().clearIncomingFromHistory()

Fixes #17111
2022-03-05 16:51:02 +04:00
Ilya Fedin
daaa654065 Get rid of unneeded MainWindow::Private class on Linux 2022-03-05 16:47:38 +04:00
Ilya Fedin
8db567ba7a Don't hold a dbus connection unecessarily in main window 2022-03-05 16:47:38 +04:00
Ilya Fedin
805e6de1dc Add global menu event hook on Linux just like on macOS 2022-03-05 16:47:38 +04:00
Ilya Fedin
1c8d4ee7ab Get rid of Q_OBJECT in HistoryInner 2022-03-05 16:47:38 +04:00
Ilya Fedin
99e8d22c51 Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
Ilya Fedin
7f0bdc5d36 Fix desktop environment list deduplication 2022-02-02 09:23:14 +03:00
Ilya Fedin
e5981ed22b Move jemalloc initialization code to cmake_helpers 2022-02-01 14:41:54 +03:00
Ilya Fedin
ceb323ac7c Use QMenuBar instead of own global menu implementation on Linux
This is another attempt of 79f96480c2
2022-01-22 21:18:37 +04:00
Ilya Fedin
b65d40a22b Get rid of custom SNI implementation
XDG is inventing new tray specification, so SNI will be outdated soon and it's better to just use QSystemTrayIcon.
I believe all the major drawbacks of QSystemTrayIcon are solved and we can live with minor ones.
Given the planned MainWindow refactoring, it seems it's the best time to do that.
2022-01-22 21:18:37 +04:00
Ilya Fedin
30810e95f4 Log when DE is unknown 2022-01-08 10:59:47 +03:00
Ilya Fedin
a3d84f69ea fixup! Use more sources for DE detection 2022-01-08 10:45:13 +03:00
Ilya Fedin
b3bb1a537c Use more sources for DE detection 2022-01-08 09:55:34 +03:00
Ilya Fedin
726aa3316d Rework DE detection
Variables can point to a mixed environment, make DE detection non-exclusive.
Remove unused methods.
2022-01-07 19:14:59 +03:00
John Preston
ba6c3eaf73 Add dummy Platform::Integration on Linux. 2022-01-06 15:44:02 +03:00
John Preston
8b0725650d Move global event filter to Platform::Integration on Windows. 2022-01-04 15:29:40 +03:00
Klemens Nanni
078a2af385 Fix -Wunused-const-variable warnings under DESKTOP_APP_DISABLE_DBUS_INTEGRATION
OpenBSD builds without dbus integration (for now);  this fixes the warnings.
Those variables have been introduced in multiple commits.
2021-12-29 20:16:04 +03:00
Ilya Fedin
33b7ac209e Don't use QPlatformNativeInterface-based XCB::GetRootWindowFromQt 2021-12-13 14:24:34 +04:00
Ilya Fedin
8592326a3c Revert "Use kernel accelerated sendfile to copy files on Linux"
This reverts commit 34534a9653.
2021-12-02 09:15:23 +04:00
Ilya Fedin
2ad20d6c4a Instantiate a local dbus server for webview IPC 2021-11-29 16:23:51 +04:00
Ilya Fedin
8fda1169e5 Get rid of Platform::MainWindow::psLinux* 2021-11-26 18:28:37 +04:00
Ilya Fedin
53305f5f46 Fix paste check in Linux global menu 2021-11-26 18:28:37 +04:00
Ilya Fedin
22b37c4bf8 Use webkitgtk without its headers 2021-11-06 16:33:39 +04:00
John Preston
1ea6224e60 Fix autostart toggling. 2021-11-05 10:15:41 +04:00
John Preston
f10ed4b9bc Support autostart in Windows Store version.
Fixes #3234.
2021-11-04 12:36:28 +04:00
John Preston
aef45b3a1d Refactor icon unread counter painting. 2021-11-02 20:12:57 +04:00
Ilya Fedin
c50a5db277 Restore dbusmenu-qt dependent functionality with Qt 6 2021-10-24 20:01:55 +04:00
John Preston
389ea2af83 Fix compilation error on Linux. 2021-10-22 18:34:59 +04:00
John Preston
d361f5c6b0 Hide native notifications of deleted messages. 2021-10-21 23:01:13 +04:00
Ilya Fedin
847c01d605 Add Qt 6 support
Tested only on Linux so far
2021-10-21 13:15:00 +04:00
John Preston
352768053d Beta version 3.1.6: Fix build on Linux. 2021-10-06 21:07:18 +04:00
John Preston
5cd0a3719e Beta version 3.1.6: Detach FastReply from MarkAsRead. 2021-10-06 19:24:30 +04:00
Gleb Smirnoff
59f2f750b4 On FreeBSD the system malloc is jemalloc and non-portable
extensions are enabled including malloc_np.h.
2021-09-15 23:24:39 +03:00
John Preston
8069fdd873 Use base/random.h instead of openssl::RandomValue. 2021-09-15 13:42:22 +03:00
Ilya Fedin
e92ae40ecb Implement close to taskbar option 2021-09-13 17:46:53 +03:00
Ilya Fedin
3fbd68cff9 Don't link glib with DESKTOP_APP_DISABLE_DBUS_INTEGRATION 2021-09-12 00:12:13 +03:00
Gleb Smirnoff
720f238cf8 Close a race between Gio threads and Qt application init.
QApplication has a historical feature[1] of calling setlocale(3) at init,
which today cause more harm than good.  Such call isn't thread safe neither
per C standard, not per any known libc implementation.  The Gio threads
would call into locale reading functions all the time, so early access to
locale by Gio may race with setlocale() by Qt leading to undefined behavior.

Platform specific start before the Sandbox (aka QApplication) is at core
design of tdesktop and that order can't be changed. There is no way to pause
Gio until QApplication instantiates.

Fortunately, Qt library itself has a static global flag that prevents it
from calling setlocale() twice. We don't even need to instantiate a
temporary QCoreApplication, we can just call into the method.  So call
it form Platform::start before any existing or future calls to Gio.

Fixes #16922

[1] https://chat.stackoverflow.com/rooms/63812/discussion-between-phil-armstrong-and-matteo-italia
2021-09-10 13:18:20 +03:00
Ilya Fedin
45360adbc2 Remove unneeded libraries from snapcraft.yaml 2021-09-07 23:40:08 +03:00
Ilya Fedin
05d4d58f8b Replace GTK integration with xsettings + XDP 2021-09-06 15:43:28 +03:00
Ilya Fedin
6192413f0b Split webview initialization from GtkIntegration class 2021-08-25 12:52:43 +03:00
Ilya Fedin
51df482571 Get rid of gtk open with dialog
Portal open with dialog works just fine and is a more universal solution... That allows to get rid of an additional process.
2021-08-25 12:52:43 +03:00
Ilya Fedin
e7d39e6046 Get rid of GtkIntegration::initializeSettings use 2021-08-13 15:21:19 +03:00
Ilya Fedin
63a92cb90a Log icon theme 2021-08-13 15:21:19 +03:00
Ilya Fedin
414456d003 Revert "Use gtk clipboard when available to avoid https://bugreports.qt.io/browse/QTBUG-56595"
Fixed in Qt by https://codereview.qt-project.org/c/qt/qtbase/+/306771

This reverts commit 3a91003eea.
2021-08-12 08:51:10 +03:00