35 lines
891 B
Diff
35 lines
891 B
Diff
|
--- Telegram/SourceFiles/platform/linux/specific_linux.cpp 2020-08-23 15:36:52.000000000 +0200
|
||
|
+++ Telegram/SourceFiles/platform/linux/specific_linux.cpp 2020-09-02 08:38:32.950087151 +0200
|
||
|
@@ -298,6 +298,20 @@
|
||
|
}
|
||
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
||
|
|
||
|
+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::optional<crl::time> XCBLastUserInputTime() {
|
||
|
const auto native = QGuiApplication::platformNativeInterface();
|
||
|
if (!native) {
|
||
|
@@ -311,6 +325,10 @@
|
||
|
return std::nullopt;
|
||
|
}
|
||
|
|
||
|
+ if (!IsXCBExtensionPresent(connection, &xcb_screensaver_id)) {
|
||
|
+ return std::nullopt;
|
||
|
+ }
|
||
|
+
|
||
|
const auto screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data;
|
||
|
if (!screen) {
|
||
|
return std::nullopt;
|