linux: fix build on Qt5

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-12-19 17:49:00 +08:00
parent 768ab6da4b
commit 4e46ba4fb5
1 changed files with 14 additions and 4 deletions

View File

@ -681,7 +681,12 @@ bool Utils::isSupportedByWindowManager(const xcb_atom_t atom)
if (atom == XCB_NONE) { if (atom == XCB_NONE) {
return false; return false;
} }
static const auto netWmAtoms = []() -> QList<xcb_atom_t> { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
using result_type = QList<xcb_atom_t>;
#else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
using result_type = QVector<xcb_atom_t>;
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
static const auto netWmAtoms = []() -> result_type {
xcb_connection_t * const connection = x11_connection(); xcb_connection_t * const connection = x11_connection();
Q_ASSERT(connection); Q_ASSERT(connection);
if (!connection) { if (!connection) {
@ -697,7 +702,7 @@ bool Utils::isSupportedByWindowManager(const xcb_atom_t atom)
WARNING << "Failed to retrieve the atom of _NET_SUPPORTED."; WARNING << "Failed to retrieve the atom of _NET_SUPPORTED.";
return {}; return {};
} }
QList<xcb_atom_t> result = {}; result_type result = {};
int offset = 0; int offset = 0;
int remaining = 0; int remaining = 0;
do { do {
@ -729,7 +734,12 @@ bool Utils::isSupportedByRootWindow(const xcb_atom_t atom)
if (atom == XCB_NONE) { if (atom == XCB_NONE) {
return false; return false;
} }
static const auto rootWindowProperties = []() -> QList<xcb_atom_t> { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
using result_type = QList<xcb_atom_t>;
#else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
using result_type = QVector<xcb_atom_t>;
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
static const auto rootWindowProperties = []() -> result_type {
xcb_connection_t * const connection = x11_connection(); xcb_connection_t * const connection = x11_connection();
Q_ASSERT(connection); Q_ASSERT(connection);
if (!connection) { if (!connection) {
@ -740,7 +750,7 @@ bool Utils::isSupportedByRootWindow(const xcb_atom_t atom)
if (!rootWindow) { if (!rootWindow) {
return {}; return {};
} }
QList<xcb_atom_t> result = {}; result_type result = {};
const xcb_list_properties_cookie_t cookie = xcb_list_properties(connection, rootWindow); const xcb_list_properties_cookie_t cookie = xcb_list_properties(connection, rootWindow);
xcb_list_properties_reply_t * const reply = xcb_list_properties_reply(connection, cookie, nullptr); xcb_list_properties_reply_t * const reply = xcb_list_properties_reply(connection, cookie, nullptr);
if (!reply) { if (!reply) {