diff --git a/src/backends/drm/drm_backend.cpp b/src/backends/drm/drm_backend.cpp index 0b28f5d7f3..7e87bb25e7 100644 --- a/src/backends/drm/drm_backend.cpp +++ b/src/backends/drm/drm_backend.cpp @@ -55,12 +55,34 @@ namespace KWin { +static QStringList splitPathList(const QString &input, const QChar delimiter) +{ + QStringList ret; + QString tmp; + for (int i = 0; i < input.size(); i++) { + if (input[i] == delimiter) { + if (i > 0 && input[i - 1] == '\\') { + tmp[tmp.size() - 1] = delimiter; + } else if (!tmp.isEmpty()) { + ret.append(tmp); + tmp = QString(); + } + } else { + tmp.append(input[i]); + } + } + if (!tmp.isEmpty()) { + ret.append(tmp); + } + return ret; +} + DrmBackend::DrmBackend(QObject *parent) : Platform(parent) , m_udev(new Udev) , m_udevMonitor(m_udev->monitor()) , m_session(Session::create(this)) - , m_explicitGpus(qEnvironmentVariable("KWIN_DRM_DEVICES").split(':', Qt::SkipEmptyParts)) + , m_explicitGpus(splitPathList(qEnvironmentVariable("KWIN_DRM_DEVICES"), ':')) , m_dpmsFilter() { setSupportsPointerWarping(true);