mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
check if there is platform plugin for XDG_SESSION_DESKTOP from qt_guiPlatformPlugin()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
198625f679
commit
543dd63b00
1 changed files with 17 additions and 10 deletions
|
@ -47,17 +47,24 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, platformLoader, (QString::fromLatin1("
|
||||||
QGuiPlatformPlugin *qt_guiPlatformPlugin()
|
QGuiPlatformPlugin *qt_guiPlatformPlugin()
|
||||||
{
|
{
|
||||||
static QGuiPlatformPlugin *plugin = nullptr;
|
static QGuiPlatformPlugin *plugin = nullptr;
|
||||||
if (!plugin)
|
if (!plugin) {
|
||||||
{
|
|
||||||
#ifndef QT_NO_LIBRARY
|
#ifndef QT_NO_LIBRARY
|
||||||
|
static const char* platformEnvTbl[] = {
|
||||||
static QString key = qGetEnv("QT_PLATFORM_PLUGIN");
|
"QT_PLATFORM_PLUGIN",
|
||||||
if (key.isEmpty()) {
|
"XDG_CURRENT_DESKTOP",
|
||||||
key = qGetEnv("DESKTOP_SESSION");
|
"DESKTOP_SESSION",
|
||||||
}
|
nullptr
|
||||||
|
};
|
||||||
if (!key.isEmpty()) {
|
int counter = 0;
|
||||||
plugin = qobject_cast<QGuiPlatformPlugin *>(platformLoader()->instance(key));
|
while (platformEnvTbl[counter]) {
|
||||||
|
QString key = qGetEnv(platformEnvTbl[counter]);
|
||||||
|
if (!key.isEmpty()) {
|
||||||
|
plugin = qobject_cast<QGuiPlatformPlugin*>(platformLoader()->instance(key));
|
||||||
|
if (plugin) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
#endif // QT_NO_LIBRARY
|
#endif // QT_NO_LIBRARY
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue