mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Decrease indentation in XCBLastUserInputTime
This commit is contained in:
parent
d02092f09e
commit
eaae7b1d03
1 changed files with 30 additions and 33 deletions
|
@ -386,7 +386,11 @@ std::vector<xcb_atom_t> GetXCBWMSupported(xcb_connection_t *connection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<crl::time> XCBLastUserInputTime() {
|
std::optional<crl::time> XCBLastUserInputTime() {
|
||||||
if (const auto native = QGuiApplication::platformNativeInterface()) {
|
const auto native = QGuiApplication::platformNativeInterface();
|
||||||
|
if (!native) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
const auto connection = reinterpret_cast<xcb_connection_t*>(
|
const auto connection = reinterpret_cast<xcb_connection_t*>(
|
||||||
native->nativeResourceForIntegration(QByteArray("connection")));
|
native->nativeResourceForIntegration(QByteArray("connection")));
|
||||||
|
|
||||||
|
@ -394,16 +398,12 @@ std::optional<crl::time> XCBLastUserInputTime() {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto screen = xcb_setup_roots_iterator(
|
const auto root = static_cast<xcb_window_t>(reinterpret_cast<quintptr>(
|
||||||
xcb_get_setup(connection)).data;
|
native->nativeResourceForIntegration(QByteArray("rootwindow"))));
|
||||||
|
|
||||||
if (!screen) {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto cookie = xcb_screensaver_query_info(
|
const auto cookie = xcb_screensaver_query_info(
|
||||||
connection,
|
connection,
|
||||||
screen->root);
|
root);
|
||||||
|
|
||||||
auto reply = xcb_screensaver_query_info_reply(
|
auto reply = xcb_screensaver_query_info_reply(
|
||||||
connection,
|
connection,
|
||||||
|
@ -418,9 +418,6 @@ std::optional<crl::time> XCBLastUserInputTime() {
|
||||||
free(reply);
|
free(reply);
|
||||||
|
|
||||||
return (crl::now() - static_cast<crl::time>(idle));
|
return (crl::now() - static_cast<crl::time>(idle));
|
||||||
}
|
|
||||||
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue