Commit 2c5af49d authored by Andras Mantia's avatar Andras Mantia

Don't reset the moved display position

Summary:
This fixes the problem that after moving a display, clicking on another one
and clicking on the original one, its position got reset to the default one.
This due to layouting in the widget when displays are clicked, the
ControlPanel hides/shows the corresponding OutputConfig, which results in a
temporary layout changed, that causes a geometry change for the QML view,
that causes am updateOutpusPlacement()...

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18101
parent 3c0f7e0b
......@@ -49,6 +49,7 @@ void QMLScreen::setConfig(const KScreen::ConfigPtr &config)
{
qDeleteAll(m_outputMap);
m_outputMap.clear();
m_manuallyMovedOutputs.clear();
m_bottommost = m_leftmost = m_rightmost = m_topmost = nullptr;
m_connectedOutputsCount = 0;
m_enabledOutputsCount = 0;
......@@ -225,6 +226,8 @@ void QMLScreen::qmlOutputMoved(QMLOutput *qmlOutput)
if (qmlOutput->isCloneMode()) {
return;
}
if (!m_manuallyMovedOutputs.contains(qmlOutput))
m_manuallyMovedOutputs.append(qmlOutput);
updateCornerOutputs();
......@@ -346,7 +349,8 @@ void QMLScreen::updateOutputsPlacement()
qreal lastY = -1.0;
Q_FOREACH (QQuickItem *item, childItems()) {
QMLOutput *qmlOutput = qobject_cast<QMLOutput*>(item);
if (!qmlOutput->output()->isConnected() || !qmlOutput->output()->isEnabled()) {
if (!qmlOutput->output()->isConnected() || !qmlOutput->output()->isEnabled() ||
m_manuallyMovedOutputs.contains(qmlOutput)) {
continue;
}
......@@ -360,7 +364,8 @@ void QMLScreen::updateOutputsPlacement()
Q_FOREACH (QQuickItem *item, childItems()) {
QMLOutput *qmlOutput = qobject_cast<QMLOutput*>(item);
if (qmlOutput->output()->isConnected() && !qmlOutput->output()->isEnabled()) {
if (qmlOutput->output()->isConnected() && !qmlOutput->output()->isEnabled() &&
!m_manuallyMovedOutputs.contains(qmlOutput)) {
qmlOutput->blockSignals(true);
qmlOutput->setPosition(QPointF(lastX, lastY));
lastX += qmlOutput->width() / initialScale * scale;
......
......@@ -104,6 +104,7 @@ class QMLScreen : public QQuickItem
KScreen::ConfigPtr m_config;
QHash<KScreen::OutputPtr,QMLOutput*> m_outputMap;
QVector<QMLOutput*> m_manuallyMovedOutputs;
int m_connectedOutputsCount = 0;
int m_enabledOutputsCount = 0;
float m_outputScale = 1.0 / 8.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment