split output rotation setting from rotation applied because of auto rotation
This commit is contained in:
parent
ae84480fbf
commit
3654b76ec2
7 changed files with 34 additions and 12 deletions
|
@ -333,6 +333,7 @@ void DrmOutput::applyQueuedChanges(const std::shared_ptr<OutputChangeSet> &props
|
|||
next.position = props->pos.value_or(m_state.position);
|
||||
next.scale = props->scale.value_or(m_state.scale);
|
||||
next.transform = props->transform.value_or(m_state.transform);
|
||||
next.manualTransform = props->manualTransform.value_or(m_state.manualTransform);
|
||||
next.currentMode = m_pipeline->mode();
|
||||
next.overscan = m_pipeline->overscan();
|
||||
next.rgbRange = m_pipeline->rgbRange();
|
||||
|
|
|
@ -193,6 +193,11 @@ OutputTransform Output::transform() const
|
|||
return m_state.transform;
|
||||
}
|
||||
|
||||
OutputTransform Output::manualTransform() const
|
||||
{
|
||||
return m_state.manualTransform;
|
||||
}
|
||||
|
||||
QString Output::eisaId() const
|
||||
{
|
||||
return m_information.eisaId;
|
||||
|
|
|
@ -274,6 +274,11 @@ public:
|
|||
static std::chrono::milliseconds dimAnimationTime();
|
||||
|
||||
OutputTransform transform() const;
|
||||
/**
|
||||
* The transform that the user has configured, and which doesn't get changed
|
||||
* by automatic rotation
|
||||
*/
|
||||
OutputTransform manualTransform() const;
|
||||
QSize orientateSize(const QSize &size) const;
|
||||
|
||||
void applyChanges(const OutputConfiguration &config);
|
||||
|
@ -395,6 +400,7 @@ protected:
|
|||
QPoint position;
|
||||
qreal scale = 1;
|
||||
OutputTransform transform = OutputTransform::Normal;
|
||||
OutputTransform manualTransform = OutputTransform::Normal;
|
||||
QList<std::shared_ptr<OutputMode>> modes;
|
||||
std::shared_ptr<OutputMode> currentMode;
|
||||
DpmsMode dpmsMode = DpmsMode::On;
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
std::optional<QPoint> pos;
|
||||
std::optional<double> scale;
|
||||
std::optional<OutputTransform> transform;
|
||||
std::optional<OutputTransform> manualTransform;
|
||||
std::optional<uint32_t> overscan;
|
||||
std::optional<Output::RgbRange> rgbRange;
|
||||
std::optional<RenderLoop::VrrPolicy> vrrPolicy;
|
||||
|
|
|
@ -65,9 +65,6 @@ std::optional<std::tuple<OutputConfiguration, QVector<Output *>, OutputConfigura
|
|||
|
||||
void OutputConfigurationStore::applyOrientationReading(OutputConfiguration &config, const QVector<Output *> &outputs, QOrientationReading *orientation, bool isTabletMode)
|
||||
{
|
||||
if (!isAutoRotateActive(outputs, isTabletMode) || !orientation || orientation->orientation() == QOrientationReading::Orientation::Undefined) {
|
||||
return;
|
||||
}
|
||||
const auto output = std::find_if(outputs.begin(), outputs.end(), [&config](Output *output) {
|
||||
return output->isInternal() && config.changeSet(output)->enabled.value_or(output->isEnabled());
|
||||
});
|
||||
|
@ -76,6 +73,10 @@ void OutputConfigurationStore::applyOrientationReading(OutputConfiguration &conf
|
|||
}
|
||||
// TODO move other outputs to matching positions
|
||||
const auto changeset = config.changeSet(*output);
|
||||
if (!isAutoRotateActive(outputs, isTabletMode)) {
|
||||
changeset->transform = changeset->manualTransform;
|
||||
return;
|
||||
}
|
||||
switch (orientation->orientation()) {
|
||||
case QOrientationReading::Orientation::TopUp:
|
||||
changeset->transform = OutputTransform::Kind::Normal;
|
||||
|
@ -91,7 +92,9 @@ void OutputConfigurationStore::applyOrientationReading(OutputConfiguration &conf
|
|||
return;
|
||||
case QOrientationReading::Orientation::FaceUp:
|
||||
case QOrientationReading::Orientation::FaceDown:
|
||||
return;
|
||||
case QOrientationReading::Orientation::Undefined:
|
||||
changeset->transform = changeset->manualTransform;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -184,6 +187,7 @@ void OutputConfigurationStore::storeConfig(const QVector<Output *> &allOutputs,
|
|||
},
|
||||
.scale = changeSet->scale.value_or(output->scale()),
|
||||
.transform = changeSet->transform.value_or(output->transform()),
|
||||
.manualTransform = changeSet->manualTransform.value_or(output->manualTransform()),
|
||||
.overscan = changeSet->overscan.value_or(output->overscan()),
|
||||
.rgbRange = changeSet->rgbRange.value_or(output->rgbRange()),
|
||||
.vrrPolicy = changeSet->vrrPolicy.value_or(output->vrrPolicy()),
|
||||
|
@ -209,6 +213,7 @@ void OutputConfigurationStore::storeConfig(const QVector<Output *> &allOutputs,
|
|||
},
|
||||
.scale = output->scale(),
|
||||
.transform = output->transform(),
|
||||
.manualTransform = output->manualTransform(),
|
||||
.overscan = output->overscan(),
|
||||
.rgbRange = output->rgbRange(),
|
||||
.vrrPolicy = output->vrrPolicy(),
|
||||
|
@ -249,6 +254,7 @@ std::pair<OutputConfiguration, QVector<Output *>> OutputConfigurationStore::setu
|
|||
.pos = setupState.position,
|
||||
.scale = state.scale,
|
||||
.transform = state.transform,
|
||||
.manualTransform = state.manualTransform,
|
||||
.overscan = state.overscan,
|
||||
.rgbRange = state.rgbRange,
|
||||
.vrrPolicy = state.vrrPolicy,
|
||||
|
@ -362,6 +368,7 @@ std::pair<OutputConfiguration, QVector<Output *>> OutputConfigurationStore::gene
|
|||
.pos = pos,
|
||||
.scale = existingData.scale.value_or(chooseScale(output, mode.get())),
|
||||
.transform = existingData.transform.value_or(output->panelOrientation()),
|
||||
.manualTransform = existingData.manualTransform.value_or(output->panelOrientation()),
|
||||
.overscan = existingData.overscan.value_or(0),
|
||||
.rgbRange = existingData.rgbRange.value_or(Output::RgbRange::Automatic),
|
||||
.vrrPolicy = existingData.vrrPolicy.value_or(RenderLoop::VrrPolicy::Automatic),
|
||||
|
@ -545,13 +552,13 @@ void OutputConfigurationStore::load()
|
|||
if (const auto it = data.find("transform"); it != data.end()) {
|
||||
const auto str = it->toString();
|
||||
if (str == "Normal") {
|
||||
state.transform = OutputTransform::Kind::Normal;
|
||||
state.transform = state.manualTransform = OutputTransform::Kind::Normal;
|
||||
} else if (str == "Rotated90") {
|
||||
state.transform = OutputTransform::Kind::Rotated90;
|
||||
state.transform = state.manualTransform = OutputTransform::Kind::Rotated90;
|
||||
} else if (str == "Rotated180") {
|
||||
state.transform = OutputTransform::Kind::Rotated180;
|
||||
state.transform = state.manualTransform = OutputTransform::Kind::Rotated180;
|
||||
} else if (str == "Rotated270") {
|
||||
state.transform = OutputTransform::Kind::Rotated270;
|
||||
state.transform = state.manualTransform = OutputTransform::Kind::Rotated270;
|
||||
}
|
||||
}
|
||||
if (const auto it = data.find("overscan"); it != data.end()) {
|
||||
|
@ -729,13 +736,13 @@ void OutputConfigurationStore::save()
|
|||
if (output.scale) {
|
||||
o["scale"] = *output.scale;
|
||||
}
|
||||
if (output.transform == OutputTransform::Kind::Normal) {
|
||||
if (output.manualTransform == OutputTransform::Kind::Normal) {
|
||||
o["transform"] = "Normal";
|
||||
} else if (output.transform == OutputTransform::Kind::Rotated90) {
|
||||
} else if (output.manualTransform == OutputTransform::Kind::Rotated90) {
|
||||
o["transform"] = "Rotated90";
|
||||
} else if (output.transform == OutputTransform::Kind::Rotated180) {
|
||||
} else if (output.manualTransform == OutputTransform::Kind::Rotated180) {
|
||||
o["transform"] = "Rotated180";
|
||||
} else if (output.transform == OutputTransform::Kind::Rotated270) {
|
||||
} else if (output.manualTransform == OutputTransform::Kind::Rotated270) {
|
||||
o["transform"] = "Rotated270";
|
||||
}
|
||||
if (output.overscan) {
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
std::optional<ModeData> mode;
|
||||
std::optional<double> scale;
|
||||
std::optional<OutputTransform> transform;
|
||||
std::optional<OutputTransform> manualTransform;
|
||||
std::optional<uint32_t> overscan;
|
||||
std::optional<Output::RgbRange> rgbRange;
|
||||
std::optional<RenderLoop::VrrPolicy> vrrPolicy;
|
||||
|
|
|
@ -150,7 +150,8 @@ void OutputConfigurationV2Interface::kde_output_configuration_v2_transform(Resou
|
|||
};
|
||||
auto _transform = toTransform();
|
||||
if (OutputDeviceV2Interface *output = OutputDeviceV2Interface::get(outputdevice)) {
|
||||
config.changeSet(output->handle())->transform = _transform;
|
||||
const auto changeset = config.changeSet(output->handle());
|
||||
changeset->transform = changeset->manualTransform = _transform;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue