mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32: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()
|
||||
{
|
||||
static QGuiPlatformPlugin *plugin = nullptr;
|
||||
if (!plugin)
|
||||
{
|
||||
if (!plugin) {
|
||||
#ifndef QT_NO_LIBRARY
|
||||
|
||||
static QString key = qGetEnv("QT_PLATFORM_PLUGIN");
|
||||
if (key.isEmpty()) {
|
||||
key = qGetEnv("DESKTOP_SESSION");
|
||||
}
|
||||
|
||||
if (!key.isEmpty()) {
|
||||
plugin = qobject_cast<QGuiPlatformPlugin *>(platformLoader()->instance(key));
|
||||
static const char* platformEnvTbl[] = {
|
||||
"QT_PLATFORM_PLUGIN",
|
||||
"XDG_CURRENT_DESKTOP",
|
||||
"DESKTOP_SESSION",
|
||||
nullptr
|
||||
};
|
||||
int counter = 0;
|
||||
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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue