diff --git a/kwin/src/breezydesktopeffect.cpp b/kwin/src/breezydesktopeffect.cpp index 61d03bd..31105ae 100644 --- a/kwin/src/breezydesktopeffect.cpp +++ b/kwin/src/breezydesktopeffect.cpp @@ -202,6 +202,7 @@ void BreezyDesktopEffect::recenter() { void BreezyDesktopEffect::reconfigure(ReconfigureFlags) { BreezyDesktopConfig::self()->read(); + setLookAheadOverride(BreezyDesktopConfig::lookAheadOverride()); setFocusedDisplayDistance(BreezyDesktopConfig::focusedDisplayDistance() / 100.0f); setAllDisplaysDistance(BreezyDesktopConfig::allDisplaysDistance() / 100.0f); setDisplaySpacing(BreezyDesktopConfig::displaySpacing() / 1000.0f); @@ -397,6 +398,17 @@ QList BreezyDesktopEffect::lookAheadConfig() const { return m_lookAheadConfig; } +qreal BreezyDesktopEffect::lookAheadOverride() const { + return m_lookAheadOverride; +} + +void BreezyDesktopEffect::setLookAheadOverride(qreal override) { + if (override != m_lookAheadOverride) { + m_lookAheadOverride = override; + Q_EMIT lookAheadOverrideChanged(); + } +} + QList BreezyDesktopEffect::displayResolution() const { return m_displayResolution; } diff --git a/kwin/src/breezydesktopeffect.h b/kwin/src/breezydesktopeffect.h index c731ab0..3639c2c 100644 --- a/kwin/src/breezydesktopeffect.h +++ b/kwin/src/breezydesktopeffect.h @@ -27,6 +27,7 @@ namespace KWin Q_PROPERTY(QSize cursorImageSize READ cursorImageSize NOTIFY cursorImageSourceChanged) Q_PROPERTY(QPointF cursorPos READ cursorPos NOTIFY cursorPosChanged) Q_PROPERTY(QList lookAheadConfig READ lookAheadConfig NOTIFY devicePropertiesChanged) + Q_PROPERTY(qreal lookAheadOverride READ lookAheadOverride WRITE setLookAheadOverride NOTIFY devicePropertiesChanged) Q_PROPERTY(QList displayResolution READ displayResolution NOTIFY devicePropertiesChanged) Q_PROPERTY(qreal focusedDisplayDistance READ focusedDisplayDistance NOTIFY focusedDisplayDistanceChanged) Q_PROPERTY(qreal allDisplaysDistance READ allDisplaysDistance NOTIFY allDisplaysDistanceChanged) @@ -63,6 +64,8 @@ namespace KWin quint64 imuTimestamp() const; bool imuResetState() const; QList lookAheadConfig() const; + qreal lookAheadOverride() const; + void setLookAheadOverride(qreal override); QList displayResolution() const; qreal focusedDisplayDistance() const; void setFocusedDisplayDistance(qreal distance); @@ -98,6 +101,7 @@ namespace KWin bool removeVirtualDisplay(const QString &id); Q_SIGNALS: + void lookAheadOverrideChanged(); void focusedDisplayDistanceChanged(); void allDisplaysDistanceChanged(); void displaySpacingChanged(); @@ -133,6 +137,7 @@ namespace KWin quint32 m_imuTimeElapsedMs; quint64 m_imuTimestamp = 0; QList m_lookAheadConfig; + qreal m_lookAheadOverride = -1.0; // -1 = use device default QList m_displayResolution; qreal m_diagonalFOV; qreal m_lensDistanceRatio; diff --git a/kwin/src/kcm/breezydesktopeffectkcm.cpp b/kwin/src/kcm/breezydesktopeffectkcm.cpp index a84b697..a6fec2f 100644 --- a/kwin/src/kcm/breezydesktopeffectkcm.cpp +++ b/kwin/src/kcm/breezydesktopeffectkcm.cpp @@ -112,6 +112,7 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu connect(ui.kcfg_DisplaySpacing, &QSlider::valueChanged, this, &BreezyDesktopEffectConfig::save); connect(ui.kcfg_DisplayHorizontalOffset, &QSlider::valueChanged, this, &BreezyDesktopEffectConfig::save); connect(ui.kcfg_DisplayVerticalOffset, &QSlider::valueChanged, this, &BreezyDesktopEffectConfig::save); + connect(ui.kcfg_LookAheadOverride, &QSlider::valueChanged, this, &BreezyDesktopEffectConfig::save); connect(ui.kcfg_DisplayWrappingScheme, qOverload(&QComboBox::currentIndexChanged), this, &BreezyDesktopEffectConfig::save); connect(ui.kcfg_AntialiasingQuality, qOverload(&QComboBox::currentIndexChanged), this, &BreezyDesktopEffectConfig::save); connect(ui.kcfg_MirrorPhysicalDisplays, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::save); @@ -169,6 +170,9 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu renderVirtualDisplays(list); }); } + if (auto lookAheadOverrideSlider = widget()->findChild("kcfg_LookAheadOverride")) { + lookAheadOverrideSlider->setValueText(-1, i18n("Default")); + } renderVirtualDisplays(dbusListVirtualDisplays()); @@ -235,6 +239,7 @@ void BreezyDesktopEffectConfig::updateUiFromConfig() ui.kcfg_DisplaySpacing->setValue(BreezyDesktopConfig::self()->displaySpacing()); ui.kcfg_DisplayHorizontalOffset->setValue(BreezyDesktopConfig::self()->displayHorizontalOffset()); ui.kcfg_DisplayVerticalOffset->setValue(BreezyDesktopConfig::self()->displayVerticalOffset()); + ui.kcfg_LookAheadOverride->setValue(BreezyDesktopConfig::self()->lookAheadOverride()); ui.kcfg_DisplayWrappingScheme->setCurrentIndex(BreezyDesktopConfig::self()->displayWrappingScheme()); ui.kcfg_AntialiasingQuality->setCurrentIndex(BreezyDesktopConfig::self()->antialiasingQuality()); ui.kcfg_MirrorPhysicalDisplays->setChecked(BreezyDesktopConfig::self()->mirrorPhysicalDisplays()); diff --git a/kwin/src/kcm/breezydesktopeffectkcm.ui b/kwin/src/kcm/breezydesktopeffectkcm.ui index bfa38c2..f6a7669 100644 --- a/kwin/src/kcm/breezydesktopeffectkcm.ui +++ b/kwin/src/kcm/breezydesktopeffectkcm.ui @@ -343,7 +343,33 @@ - + + + + Movement look-ahead (ms): + + + + + + + QSlider::NoTicks + + + 1 + + + 5 + + + Qt::Horizontal + + + true + + + + false @@ -357,7 +383,7 @@ true - + Mirror physical displays (may impact performance) @@ -365,7 +391,7 @@ false - + Enable multi-tap detection diff --git a/kwin/src/kcm/labeledslider.h b/kwin/src/kcm/labeledslider.h index 8d7909c..d08190b 100644 --- a/kwin/src/kcm/labeledslider.h +++ b/kwin/src/kcm/labeledslider.h @@ -32,9 +32,6 @@ class LabeledSlider : public QSlider { // tickStartOffset: starting offset for label positions relative to minimum(). // Example: minimum=0, tickInterval=20, tickStartOffset=10 -> labels at 10,30,50,... Q_PROPERTY(int tickStartOffset READ tickStartOffset WRITE setTickStartOffset) - // valueTextPairs: allows setting custom labels from .ui (Designer) as a string list. - // Format each entry as "int: Text" or "int=Text". Example: ["0: Off", "100: Max"]. - Q_PROPERTY(QStringList valueTextPairs READ valueTextPairs WRITE setValueTextPairs) public: explicit LabeledSlider(QWidget *parent = nullptr) : QSlider(Qt::Horizontal, parent) @@ -77,34 +74,6 @@ public: QMap valueTexts() const { return m_valueTexts; } - // Property for .ui usage - QStringList valueTextPairs() const { - QStringList list; - for (auto it = m_valueTexts.constBegin(); it != m_valueTexts.constEnd(); ++it) { - list << (QString::number(it.key()) + QLatin1String(": ") + it.value()); - } - return list; - } - void setValueTextPairs(const QStringList &pairs) { - QMap newMap; - for (const QString &raw : pairs) { - QString s = raw.trimmed(); - if (s.isEmpty()) continue; - int sep = s.indexOf(QLatin1Char(':')); - if (sep == -1) sep = s.indexOf(QLatin1Char('=')); - if (sep == -1) continue; // skip invalid entry - QString left = s.left(sep).trimmed(); - QString right = s.mid(sep + 1).trimmed(); - bool ok = false; - int v = left.toInt(&ok); - if (!ok) continue; - newMap.insert(v, right); - } - if (m_valueTexts == newMap) return; - m_valueTexts = std::move(newMap); - update(); - } - int decimalShift() const { return m_decimalShift; } void setDecimalShift(int shift) { // clamp to sensible range @@ -194,7 +163,15 @@ protected: int topY = handle.top() - gap - extraLift - textRect.height(); if (topY < 0) topY = 0; // clamp to widget textRect.moveTop(topY); + // Center horizontally over handle textRect.moveLeft(handle.center().x() - textRect.width()/2); + // Clamp horizontally so we don't paint outside and get clipped + if (textRect.left() < 0) { + textRect.moveLeft(0); + } + if (textRect.right() > width()) { + textRect.moveLeft(width() - textRect.width()); + } // Bubble shape QPainterPath path; diff --git a/kwin/src/qml/CameraController.qml b/kwin/src/qml/CameraController.qml index 6d0b2d6..f4ee58c 100644 --- a/kwin/src/qml/CameraController.qml +++ b/kwin/src/qml/CameraController.qml @@ -22,7 +22,7 @@ Item { effect.imuRotations[0], effect.imuRotations[1], effect.imuTimeElapsedMs, - lookAheadMS(effect.imuTimestamp, effect.lookAheadConfig, -1) + lookAheadMS(effect.imuTimestamp, effect.lookAheadConfig, effect.lookAheadOverride) ); camera.position = effect.imuRotations[0].times(Qt.vector3d(0, 0, -fovDetails.lensDistancePixels)); }