Add "all displays follow" option

This commit is contained in:
wheaney 2025-09-18 14:45:14 -07:00
parent 3388d5fc41
commit 2db93b6b15
5 changed files with 35 additions and 5 deletions

View File

@ -81,5 +81,10 @@
<label>Movement look-ahead (ms)</label>
<description>Override the default look ahead time in milliseconds (-1 to use default)</description>
</entry>
<entry name="AllDisplaysFollowMode" type="Bool">
<default>false</default>
<label>All displays follow mode</label>
<description>Apply follow mode to all displays instead of only the focused display</description>
</entry>
</group>
</kcfg>

View File

@ -228,6 +228,9 @@ void BreezyDesktopEffect::reconfigure(ReconfigureFlags)
if (m_antialiasingQuality != aaQuality) { m_antialiasingQuality = aaQuality; Q_EMIT antialiasingQualityChanged(); }
if (m_removeVirtualDisplaysOnDisable != removeVD) { m_removeVirtualDisplaysOnDisable = removeVD; Q_EMIT removeVirtualDisplaysOnDisableChanged(); }
if (m_mirrorPhysicalDisplays != mirrorPhysicalDisplays) { m_mirrorPhysicalDisplays = mirrorPhysicalDisplays; Q_EMIT mirrorPhysicalDisplaysChanged(); }
// this one doesn't have a signal, just always assign it
m_allDisplaysFollowMode = BreezyDesktopConfig::allDisplaysFollowMode();
}
QVariantMap BreezyDesktopEffect::initialProperties(Output *screen)
@ -507,7 +510,8 @@ QList<QQuaternion> BreezyDesktopEffect::smoothFollowOrigin() const {
}
bool BreezyDesktopEffect::smoothFollowEnabled() const {
return m_smoothFollowEnabled;
// the effect doesn't need to know about smooth follow if it's in "all displays" mode
return m_focusedSmoothFollowEnabled;
}
bool BreezyDesktopEffect::checkParityByte(const char* data) {
@ -673,14 +677,21 @@ void BreezyDesktopEffect::updateImuRotation() {
uint8_t smoothFollowEnabled = false;
memcpy(&smoothFollowEnabled, data + DataView::SMOOTH_FOLLOW_ENABLED[DataView::OFFSET_INDEX], sizeof(smoothFollowEnabled));
bool nextSmoothFollowEnabled = (smoothFollowEnabled != 0);
if (m_smoothFollowEnabled != nextSmoothFollowEnabled) {
bool focusedSmoothFollowEnabled = nextSmoothFollowEnabled && !m_allDisplaysFollowMode;
if (m_smoothFollowEnabled != nextSmoothFollowEnabled || m_focusedSmoothFollowEnabled != focusedSmoothFollowEnabled) {
m_smoothFollowEnabled = nextSmoothFollowEnabled;
Q_EMIT smoothFollowEnabledChanged();
if (nextSmoothFollowEnabled) updateDriverSmoothFollowSettings();
if (m_focusedSmoothFollowEnabled != focusedSmoothFollowEnabled) {
m_focusedSmoothFollowEnabled = focusedSmoothFollowEnabled;
// only emit the signal if it affects the effect
Q_EMIT smoothFollowEnabledChanged();
}
if (m_smoothFollowEnabled) updateDriverSmoothFollowSettings();
} else if (enabled && !wasEnabled) {
Q_EMIT smoothFollowEnabledChanged();
if (nextSmoothFollowEnabled) updateDriverSmoothFollowSettings();
if (m_smoothFollowEnabled) updateDriverSmoothFollowSettings();
}
}

View File

@ -168,6 +168,8 @@ namespace KWin
bool m_removeVirtualDisplaysOnDisable = true;
bool m_mirrorPhysicalDisplays = false;
float m_smoothFollowThreshold = 1.0f;
bool m_allDisplaysFollowMode = false;
bool m_focusedSmoothFollowEnabled = false;
struct VirtualOutputInfo {
Output *output = nullptr;

View File

@ -124,6 +124,7 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu
connect(ui.kcfg_AntialiasingQuality, qOverload<int>(&QComboBox::currentIndexChanged), this, &BreezyDesktopEffectConfig::save);
connect(ui.kcfg_MirrorPhysicalDisplays, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::save);
connect(ui.kcfg_RemoveVirtualDisplaysOnDisable, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::save);
connect(ui.kcfg_AllDisplaysFollowMode, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::save);
connect(ui.EnableMultitap, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateMultitapEnabled);
connect(ui.SmoothFollowTrackYaw, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateSmoothFollowTrackYaw);
connect(ui.SmoothFollowTrackPitch, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateSmoothFollowTrackPitch);
@ -257,6 +258,7 @@ void BreezyDesktopEffectConfig::updateUiFromConfig()
ui.kcfg_AntialiasingQuality->setCurrentIndex(BreezyDesktopConfig::self()->antialiasingQuality());
ui.kcfg_MirrorPhysicalDisplays->setChecked(BreezyDesktopConfig::self()->mirrorPhysicalDisplays());
ui.kcfg_RemoveVirtualDisplaysOnDisable->setChecked(BreezyDesktopConfig::self()->removeVirtualDisplaysOnDisable());
ui.kcfg_AllDisplaysFollowMode->setChecked(BreezyDesktopConfig::self()->allDisplaysFollowMode());
ui.kcfg_ZoomOnFocusEnabled->setChecked(BreezyDesktopConfig::self()->zoomOnFocusEnabled());
ui.kcfg_FocusedDisplayDistance->setEnabled(ui.kcfg_ZoomOnFocusEnabled->isChecked());
ui.kcfg_SmoothFollowThreshold->setValue(BreezyDesktopConfig::self()->smoothFollowThreshold());

View File

@ -371,6 +371,16 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_AllDisplaysFollowMode">
<property name="text">
<string>All displays follow mode</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelDisplayHorizontalOffset">
<property name="text">