Use "$XDG_CURRENT_DESKTOP" before "$KDE_FULL_SESSION" to know if we are running KDE.

[GB.GUI]
* BUG: Use "$XDG_CURRENT_DESKTOP" before "$KDE_FULL_SESSION" to know if we are running KDE.

[GB.GUI.QT]
* BUG: Use "$XDG_CURRENT_DESKTOP" before "$KDE_FULL_SESSION" to know if we are running KDE.
This commit is contained in:
gambas 2020-12-21 17:45:26 +01:00
parent 7716f08584
commit 05e27f506b
3 changed files with 29 additions and 30 deletions

View file

@ -78,21 +78,9 @@ int EXPORT GB_INIT(void)
if (use == USE_NOTHING)
{
use = USE_GB_QT5;
env = getenv("KDE_FULL_SESSION");
if (env && !strcmp(env, "true"))
{
env = getenv("KDE_SESSION_VERSION");
if (env)
{
if (strcmp(env, "4") == 0)
use = USE_GB_QT4;
else if (strcmp(env, "5") == 0)
use = USE_GB_QT5;
}
}
use = GUI_should_use();
if (use == USE_NOTHING)
use = USE_GB_QT5;
}
if (_debug)

View file

@ -58,5 +58,28 @@ static const char *GUI_can_use(int use)
return NULL;
}
static int GUI_should_use()
{
const char *env = getenv("XDG_CURRENT_DESKTOP");
if (strncasecmp(env, "KDE", 3) == 0)
{
env = getenv("KDE_FULL_SESSION");
if (env && !strcmp(env, "true"))
{
env = getenv("KDE_SESSION_VERSION");
if (env)
{
if (strcmp(env, "4") == 0)
return USE_GB_QT4;
else if (strcmp(env, "5") == 0)
return USE_GB_QT5;
}
}
}
return USE_NOTHING;
}

View file

@ -90,21 +90,9 @@ int EXPORT GB_INIT(void)
if (use == USE_NOTHING)
{
use = USE_GB_GTK3;
env = getenv("KDE_FULL_SESSION");
if (env && !strcmp(env, "true"))
{
env = getenv("KDE_SESSION_VERSION");
if (env)
{
if (strcmp(env, "4") == 0)
use = USE_GB_QT4;
else if (strcmp(env, "5") == 0)
use = USE_GB_QT5;
}
}
use = GUI_should_use();
if (use == USE_NOTHING)
use = USE_GB_GTK3;
}
if (_debug)