Skip to content

Commit

Permalink
use qputenv to modify the running process environment
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Feb 12, 2025
1 parent 253d0f9 commit ca9e432
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,19 @@ Application::Application(int &argc, char **argv)
qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit());

const auto shouldDisableGraphicsAcceleration = [&]() {
const auto systemEnvironment = QProcessEnvironment::systemEnvironment();
if (systemEnvironment.contains(QStringLiteral("VMWARE"))) {
if (qEnvironmentVariableIsSet("VMWARE")) {
return true;
}

if (systemEnvironment.contains("SESSIONNAME") && systemEnvironment.value("SESSIONNAME").startsWith("RDP-")) {
if (qEnvironmentVariableIsSet("SESSIONNAME") && qEnvironmentVariable("SESSIONNAME").startsWith("RDP-")) {
return true;
}

return false;
};

if (shouldDisableGraphicsAcceleration()) {
QProcessEnvironment::systemEnvironment().insert(QStringLiteral("SVGA_ALLOW_LLVMPIPE"), 0);
qputenv("SVGA_ALLOW_LLVMPIPE", 0);
qCInfo(lcApplication) << "Disabling graphics acceleration, application might be running in a virtual or in a remote desktop.";
}
#endif
Expand Down

0 comments on commit ca9e432

Please sign in to comment.