Merge pull request #485 from dpaulat/revert-479-no-wayland-on-nvidia

Revert "Disable Wayland platform plugin on Nvidia"
This commit is contained in:
Dan Paulat 2025-07-13 10:30:06 -05:00 committed by GitHub
commit 7200acc382
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,8 +19,6 @@
#include <scwx/util/logger.hpp>
#include <scwx/util/threads.hpp>
#include <filesystem>
#include <fstream>
#include <string>
#include <vector>
@ -45,7 +43,6 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static void ConfigureTheme(const std::vector<std::string>& args);
static void InitializeOpenGL();
static void OverrideDefaultStyle(const std::vector<std::string>& args);
static void OverridePlatform();
int main(int argc, char* argv[])
{
@ -56,8 +53,6 @@ int main(int argc, char* argv[])
args.push_back(argv[i]);
}
OverridePlatform();
// Initialize logger
auto& logManager = scwx::qt::manager::LogManager::Instance();
logManager.Initialize();
@ -281,32 +276,3 @@ OverrideDefaultStyle([[maybe_unused]] const std::vector<std::string>& args)
}
#endif
}
static void OverridePlatform()
{
#if defined(__linux__)
static const std::string NVIDIA_ID = "0x10de";
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
}