2020-03-10 18:29:05 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gb_gui_test_temp.h
|
|
|
|
|
|
|
|
(c) 2000-2020 Benoît Minisini <g4mba5@gmail.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#define __GB_GUI_TEST_TEMP_H
|
|
|
|
|
|
|
|
static char *make_name(const char *prefix, const char *suffix)
|
|
|
|
{
|
|
|
|
static char buffer[32];
|
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, suffix);
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2020-09-23 01:06:18 +02:00
|
|
|
static const char *GUI_can_use(int use)
|
2020-03-10 18:29:05 +01:00
|
|
|
{
|
2020-09-23 01:06:18 +02:00
|
|
|
static const char *ext[] = { "ext", "webkit", "opengl", "webview", NULL };
|
2020-03-10 18:29:05 +01:00
|
|
|
const char **pext;
|
|
|
|
const char *name;
|
2020-09-23 01:06:18 +02:00
|
|
|
char *child;
|
2020-03-10 18:29:05 +01:00
|
|
|
|
|
|
|
name = get_name(use);
|
|
|
|
|
|
|
|
if (!GB.Component.CanLoadLibrary(name))
|
2020-09-23 01:06:18 +02:00
|
|
|
return name;
|
2020-03-10 18:29:05 +01:00
|
|
|
|
|
|
|
for (pext = ext; *pext; pext++)
|
|
|
|
{
|
2020-09-23 01:06:18 +02:00
|
|
|
if (!GB.Component.Exist(make_name("gb.gui", *pext)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
child = make_name(name, *pext);
|
|
|
|
if (!GB.Component.CanLoadLibrary(child))
|
|
|
|
return child;
|
|
|
|
if (_debug)
|
|
|
|
fprintf(stderr, " %s OK\n", child);
|
2020-03-10 18:29:05 +01:00
|
|
|
}
|
|
|
|
|
2020-09-23 01:06:18 +02:00
|
|
|
return NULL;
|
2020-03-10 18:29:05 +01:00
|
|
|
}
|
|
|
|
|
2020-12-21 17:45:26 +01:00
|
|
|
static int GUI_should_use()
|
|
|
|
{
|
|
|
|
const char *env = getenv("XDG_CURRENT_DESKTOP");
|
|
|
|
|
2020-12-26 22:44:57 +01:00
|
|
|
if (env && strncasecmp(env, "KDE", 3) == 0)
|
2020-12-21 17:45:26 +01:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2020-03-10 18:29:05 +01:00
|
|
|
|
|
|
|
|