backends/drm: fix udev event KWIN_DRM_DEVICES check

The existing check incorrectly compares the directory path only. This
allows unintended GPUs to be added when events occur for them, such
as with "udevadm trigger".

Update the check to use the full path.
This commit is contained in:
Justin Gatzen 2024-04-28 00:03:14 -04:00
parent eb331a5df4
commit 75ab5b8353

View file

@ -136,9 +136,9 @@ void DrmBackend::handleUdevEvent()
while (auto device = m_udevMonitor->getDevice()) {
// Ignore the device seat if the KWIN_DRM_DEVICES envvar is set.
if (!m_explicitGpus.isEmpty()) {
const auto canonicalPath = QFileInfo(device->devNode()).canonicalPath();
const auto canonicalPath = QFileInfo(device->devNode()).canonicalFilePath();
const bool foundMatch = std::ranges::any_of(m_explicitGpus, [&canonicalPath](const QString &explicitPath) {
return QFileInfo(explicitPath).canonicalPath() == canonicalPath;
return QFileInfo(explicitPath).canonicalFilePath() == canonicalPath;
});
if (!foundMatch) {
continue;