From 6635d03818c90f62cfddb516acadc293255b8905 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 29 Aug 2020 03:55:38 +0400 Subject: [PATCH] Check if xcb-screensaver extension present --- .../platform/linux/specific_linux.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index a5a827418..fc0638158 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -324,6 +324,20 @@ std::optional GetXCBAtom( return atom; } +bool IsXCBExtensionPresent( + xcb_connection_t *connection, + xcb_extension_t *ext) { + const auto reply = xcb_get_extension_data( + connection, + ext); + + if (!reply) { + return false; + } + + return reply->present; +} + std::vector GetXCBWMSupported(xcb_connection_t *connection) { auto netWmAtoms = std::vector{}; @@ -398,6 +412,10 @@ std::optional XCBLastUserInputTime() { return std::nullopt; } + if (!IsXCBExtensionPresent(connection, &xcb_screensaver_id)) { + return std::nullopt; + } + const auto root = static_cast(reinterpret_cast( native->nativeResourceForIntegration(QByteArray("rootwindow"))));