diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | xbmc/AppParamParser.cpp | 34 | ||||
-rw-r--r-- | xbmc/AppParamParser.h | 1 | ||||
-rw-r--r-- | xbmc/Application.cpp | 7 | ||||
-rw-r--r-- | xbmc/Application.h | 1 | ||||
-rw-r--r-- | xbmc/CompileInfo.cpp.in | 5 | ||||
-rw-r--r-- | xbmc/CompileInfo.h | 1 |
7 files changed, 50 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ff1a7dd63..01c500d510 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,6 +225,7 @@ add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp ${ADDON_XML_OUTPUTS} COMMAND ${CMAKE_COMMAND} -DCORE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + -DCORE_PLATFORM_NAME_LC="${CORE_PLATFORM_NAME_LC}" -DCORE_BUILD_DIR=${CORE_BUILD_DIR} -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} -DARCH_DEFINES="${ARCH_DEFINES}" diff --git a/xbmc/AppParamParser.cpp b/xbmc/AppParamParser.cpp index f8fd7b8e96..6a96313ccc 100644 --- a/xbmc/AppParamParser.cpp +++ b/xbmc/AppParamParser.cpp @@ -16,7 +16,17 @@ #include "utils/SystemInfo.h" #include "utils/log.h" +#include <iostream> #include <stdlib.h> +#include <string> +#include <vector> + +#if defined(TARGET_LINUX) +namespace +{ +std::vector<std::string> availableWindowSystems = CCompileInfo::GetAvailableWindowSystems(); +} // namespace +#endif CAppParamParser::CAppParamParser() : m_logLevel(LOG_LEVEL_NORMAL), @@ -63,6 +73,13 @@ void CAppParamParser::DisplayHelp() printf(" --test\t\tEnable test mode. [FILE] required.\n"); printf(" --settings=<filename>\t\tLoads specified file after advancedsettings.xml replacing any settings specified\n"); printf(" \t\t\t\tspecified file must exist in special://xbmc/system/\n"); +#if defined(TARGET_LINUX) + printf(" --windowing=<system>\tSelect which windowing method to use.\n"); + printf(" \t\t\t\tAvailable window systems are:"); + for (const auto& windowSystem : availableWindowSystems) + printf(" %s", windowSystem.c_str()); + printf("\n"); +#endif exit(0); } @@ -84,6 +101,23 @@ void CAppParamParser::ParseArg(const std::string &arg) m_testmode = true; else if (arg.substr(0, 11) == "--settings=") m_settingsFile = arg.substr(11); +#if defined(TARGET_LINUX) + else if (arg.substr(0, 12) == "--windowing=") + { + if (std::find(availableWindowSystems.begin(), availableWindowSystems.end(), arg.substr(12)) != + availableWindowSystems.end()) + m_windowing = arg.substr(12); + else + { + std::cout << "Selected window system not available: " << arg << std::endl; + std::cout << " Available window systems:"; + for (const auto& windowSystem : availableWindowSystems) + std::cout << " " << windowSystem; + std::cout << std::endl; + exit(0); + } + } +#endif else if (arg.length() != 0 && arg[0] != '-') { const CFileItemPtr item = std::make_shared<CFileItem>(arg); diff --git a/xbmc/AppParamParser.h b/xbmc/AppParamParser.h index a0823364e5..5cfede7f7a 100644 --- a/xbmc/AppParamParser.h +++ b/xbmc/AppParamParser.h @@ -30,6 +30,7 @@ public: bool m_platformDirectories = true; bool m_testmode = false; bool m_standAlone = false; + std::string m_windowing; private: void ParseArg(const std::string &arg); diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 18901ac94a..0e312de47c 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -365,6 +365,7 @@ bool CApplication::Create(const CAppParamParser ¶ms) m_bPlatformDirectories = params.m_platformDirectories; m_bTestMode = params.m_testmode; m_bStandalone = params.m_standAlone; + m_windowing = params.m_windowing; CServiceBroker::CreateLogging(); @@ -624,6 +625,9 @@ bool CApplication::CreateGUI() auto windowSystems = KODI::WINDOWING::CWindowSystemFactory::GetWindowSystems(); + if (!m_windowing.empty()) + windowSystems = {m_windowing}; + for (auto& windowSystem : windowSystems) { CLog::Log(LOGDEBUG, "CApplication::{} - trying to init {} windowing system", __FUNCTION__, @@ -633,6 +637,9 @@ bool CApplication::CreateGUI() if (!m_pWinSystem) continue; + if (!m_windowing.empty() && m_windowing != windowSystem) + continue; + CServiceBroker::RegisterWinSystem(m_pWinSystem.get()); if (!m_pWinSystem->InitWindowSystem()) diff --git a/xbmc/Application.h b/xbmc/Application.h index 923a630a2b..4c069cc588 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -486,6 +486,7 @@ private: CApplicationPlayer m_appPlayer; CEvent m_playerEvent; CApplicationStackHelper m_stackHelper; + std::string m_windowing; }; XBMC_GLOBAL_REF(CApplication,g_application); diff --git a/xbmc/CompileInfo.cpp.in b/xbmc/CompileInfo.cpp.in index 0acf125308..f81fe77902 100644 --- a/xbmc/CompileInfo.cpp.in +++ b/xbmc/CompileInfo.cpp.in @@ -100,3 +100,8 @@ std::vector<ADDON::RepoInfo> CCompileInfo::LoadOfficialRepoInfos() return officialRepoInfos; } + +std::vector<std::string> CCompileInfo::GetAvailableWindowSystems() +{ + return StringUtils::Split("@CORE_PLATFORM_NAME_LC@", ' '); +} diff --git a/xbmc/CompileInfo.h b/xbmc/CompileInfo.h index ad128f0da0..553a0194ee 100644 --- a/xbmc/CompileInfo.h +++ b/xbmc/CompileInfo.h @@ -30,5 +30,6 @@ public: static const char* GetCopyrightYears(); static std::string GetBuildDate(); static const char* GetVersionCode(); + static std::vector<std::string> GetAvailableWindowSystems(); static std::vector<ADDON::RepoInfo> LoadOfficialRepoInfos(); }; |