Check if xcb-screensaver extension present

This commit is contained in:
Ilya Fedin 2020-08-29 03:55:38 +04:00 committed by John Preston
parent e523492de0
commit 6635d03818

View file

@ -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"))));