diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c1c07ce..ecd3d1bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ option(NO_GIT_CLONE "Disables git clone usage for 3rdParty dependencies" OFF option(UPDATER "Enables updater" ${PORTABLE_INSTALL}) option(DISCORD_RPC "Enables Discord Rich Presence" ON) option(USE_CCACHE "Enables usage of ccache when ccache has been found" ON) +option(FORCE_XCB "Forces Qt to use the xcb platform on linux" LINUX) project(RMG) @@ -39,6 +40,11 @@ if (NOT PORTABLE_INSTALL AND UPDATER) set(UPDATER OFF) endif() +if (FORCE_XCB AND (WIN32 OR MSYS)) + message(WARNING "XCB Qt platform not supported on windows, disabling FORCE_XCB!") + set(FORCE_XCB OFF) +endif() + if (PORTABLE_INSTALL) set(CMAKE_INSTALL_PREFIX "") set(INSTALL_PATH "Bin/${CMAKE_BUILD_TYPE}") diff --git a/Source/RMG/CMakeLists.txt b/Source/RMG/CMakeLists.txt index 2110f3f5..be91963a 100644 --- a/Source/RMG/CMakeLists.txt +++ b/Source/RMG/CMakeLists.txt @@ -20,6 +20,10 @@ if (DISCORD_RPC) add_definitions(-DDISCORD_RPC) endif(DISCORD_RPC) +if (FORCE_XCB) + add_definitions(-DFORCE_XCB) +endif(FORCE_XCB) + find_package(PkgConfig REQUIRED) pkg_check_modules(SDL2 REQUIRED sdl2) diff --git a/Source/RMG/main.cpp b/Source/RMG/main.cpp index 2eac0033..86ba73b5 100644 --- a/Source/RMG/main.cpp +++ b/Source/RMG/main.cpp @@ -16,6 +16,7 @@ #include #include +#include // // Local Functions @@ -74,6 +75,10 @@ int main(int argc, char **argv) // install message handler qInstallMessageHandler(message_handler); +#ifdef FORCE_XCB + setenv("QT_QPA_PLATFORM", "xcb", 1); +#endif // FORCE_XCB + QApplication app(argc, argv); UserInterface::MainWindow window;