Skip to content

Commit

Permalink
Force XCB under Linux Wayland
Browse files Browse the repository at this point in the history
Due to an QT issue under Wayland, QLog sets
QT_QPA_PLATFORM to xcb
  • Loading branch information
foldynl committed Apr 29, 2024
1 parent 5c7fcf3 commit cf44ef8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,22 @@ static void debugMessageOutput(QtMsgType type, const QMessageLogContext &context
}
}

#ifdef Q_OS_LINUX
void wayland_hacks()
{
// due to QT's issue, Dock widget is not working (cannot be docked) under QT5, < ?6.7? on Linux
// Therefore it is necessary to force set XCB (X11)
const QByteArray &sessionType = qgetenv("XDG_SESSION_TYPE").toLower();
const QByteArray &disableXCBFallback = qgetenv("QLOG_DISABLE_XCB");
if ( sessionType.contains("wayland")
&& disableXCBFallback == QByteArray() )
{
qInfo() << "Force XCB";
qputenv("QT_QPA_PLATFORM", "xcb");
}
}
#endif

int main(int argc, char* argv[])
{

Expand All @@ -398,6 +414,9 @@ int main(int argc, char* argv[])
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

#ifdef Q_OS_LINUX
wayland_hacks();
#endif

bool stylePresent = false;

Expand Down

0 comments on commit cf44ef8

Please sign in to comment.