mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 04:50:06 +00:00 
			
		
		
		
	Initial attempt to disable Wayland platform on Nvidia
This commit is contained in:
		
							parent
							
								
									fa50defe62
								
							
						
					
					
						commit
						7723aee1d8
					
				
					 1 changed files with 34 additions and 0 deletions
				
			
		|  | @ -19,6 +19,8 @@ | |||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/threads.hpp> | ||||
| 
 | ||||
| #include <filesystem> | ||||
| #include <fstream> | ||||
| #include <string> | ||||
| #include <vector> | ||||
| 
 | ||||
|  | @ -42,6 +44,7 @@ static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | |||
| 
 | ||||
| static void ConfigureTheme(const std::vector<std::string>& args); | ||||
| static void OverrideDefaultStyle(const std::vector<std::string>& args); | ||||
| static void OverridePlatform(); | ||||
| 
 | ||||
| int main(int argc, char* argv[]) | ||||
| { | ||||
|  | @ -52,6 +55,8 @@ int main(int argc, char* argv[]) | |||
|       args.push_back(argv[i]); | ||||
|    } | ||||
| 
 | ||||
|    OverridePlatform(); | ||||
| 
 | ||||
|    // Initialize logger
 | ||||
|    auto& logManager = scwx::qt::manager::LogManager::Instance(); | ||||
|    logManager.Initialize(); | ||||
|  | @ -252,3 +257,32 @@ OverrideDefaultStyle([[maybe_unused]] const std::vector<std::string>& args) | |||
|    } | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| constexpr std::string NVIDIA_ID = "0x10de"; | ||||
| static void           OverridePlatform() | ||||
| { | ||||
| #if defined(__linux__) | ||||
|    namespace fs = std::filesystem; | ||||
|    for (const auto& entry : fs::directory_iterator("/sys/class/drm")) | ||||
|    { | ||||
|       if (!entry.is_directory() || | ||||
|           !entry.path().filename().string().starts_with("card")) | ||||
|       { | ||||
|          continue; | ||||
|       } | ||||
| 
 | ||||
|       auto          vendorPath = entry.path() / "device" / "vendor"; | ||||
|       std::ifstream vendorFile(vendorPath); | ||||
|       std::string   vendor; | ||||
|       if (vendorFile && std::getline(vendorFile, vendor)) | ||||
|       { | ||||
|          if (vendor == NVIDIA_ID) | ||||
|          { | ||||
|             // Force xcb on NVIDIA
 | ||||
|             setenv("QT_QPA_PLATFORM", "xcb", 1); | ||||
|             return; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
| #endif | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak