mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Check if xcb-screensaver extension present
This commit is contained in:
@@ -324,6 +324,20 @@ std::optional<xcb_atom_t> 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<xcb_atom_t> GetXCBWMSupported(xcb_connection_t *connection) {
|
||||
auto netWmAtoms = std::vector<xcb_atom_t>{};
|
||||
|
||||
@@ -398,6 +412,10 @@ std::optional<crl::time> XCBLastUserInputTime() {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!IsXCBExtensionPresent(connection, &xcb_screensaver_id)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto root = static_cast<xcb_window_t>(reinterpret_cast<quintptr>(
|
||||
native->nativeResourceForIntegration(QByteArray("rootwindow"))));
|
||||
|
||||
|
Reference in New Issue
Block a user