From b976c274fd51be471464987f37696156a0cfc8e1 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Mon, 29 Apr 2024 17:08:03 +0200 Subject: [PATCH] workspace: don't touch output configs on Xorg It sets some output properties that don't match what Xorg knows about the outputs, which may cause problems CCBUG: 477268 --- src/workspace.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/workspace.cpp b/src/workspace.cpp index 39727c8681..681a796333 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -248,18 +248,20 @@ void Workspace::init() connect(this, &Workspace::windowRemoved, m_placementTracker.get(), &PlacementTracker::remove); m_placementTracker->init(getPlacementTrackerHash()); - const auto applySensorChanges = [this]() { + if (waylandServer()) { + const auto applySensorChanges = [this]() { + m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); + const auto opt = m_outputConfigStore->queryConfig(kwinApp()->outputBackend()->outputs(), m_lidSwitchTracker->isLidClosed(), m_orientationSensor->reading(), kwinApp()->tabletModeManager()->effectiveTabletMode()); + if (opt) { + const auto &[config, order, type] = *opt; + applyOutputConfiguration(config, order); + } + }; + connect(m_lidSwitchTracker.get(), &LidSwitchTracker::lidStateChanged, this, applySensorChanges); + connect(m_orientationSensor.get(), &OrientationSensor::orientationChanged, this, applySensorChanges); + connect(kwinApp()->tabletModeManager(), &TabletModeManager::tabletModeChanged, this, applySensorChanges); m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); - const auto opt = m_outputConfigStore->queryConfig(kwinApp()->outputBackend()->outputs(), m_lidSwitchTracker->isLidClosed(), m_orientationSensor->reading(), kwinApp()->tabletModeManager()->effectiveTabletMode()); - if (opt) { - const auto &[config, order, type] = *opt; - applyOutputConfiguration(config, order); - } - }; - connect(m_lidSwitchTracker.get(), &LidSwitchTracker::lidStateChanged, this, applySensorChanges); - connect(m_orientationSensor.get(), &OrientationSensor::orientationChanged, this, applySensorChanges); - connect(kwinApp()->tabletModeManager(), &TabletModeManager::tabletModeChanged, this, applySensorChanges); - m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); + } } QString Workspace::getPlacementTrackerHash()