From c3d263912217c10dcbd78b30b9eba47d0aa727ab Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Thu, 15 Sep 2022 03:21:03 -0500 Subject: [PATCH 1/4] Ignore early startup resolution changes in AppletsLayout::AppletsLayout --- components/containmentlayoutmanager/appletslayout.cpp | 10 ++++++++++ components/containmentlayoutmanager/appletslayout.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/components/containmentlayoutmanager/appletslayout.cpp b/components/containmentlayoutmanager/appletslayout.cpp index e31606f49e..36ea697a14 100644 --- a/components/containmentlayoutmanager/appletslayout.cpp +++ b/components/containmentlayoutmanager/appletslayout.cpp @@ -40,6 +40,7 @@ AppletsLayout::AppletsLayout(QQuickItem *parent) if (!m_containment) { return; } + // We can't save the layout during bootup, for performance reasons and to avoid race consitions as much as possible, so if we needto save and still // starting up, don't actually savenow, but we will when Corona::startupCompleted is emitted @@ -63,6 +64,15 @@ AppletsLayout::AppletsLayout(QQuickItem *parent) if (!m_containment) { return; } + + // The first time this code is run, an early-startup screen resolution change will cause widgets to become scrambl> + // resolution changes that happen the first time the function is called. + + if (!m_initFinished) { + m_geometryBeforeResolutionChange = QRectF(); + m_initFinished = true; + } + const QString &serializedConfig = m_containment->config().readEntry(m_configKey, ""); if ((m_layoutChanges & ConfigKeyChange) && !serializedConfig.isEmpty()) { if (!m_configKey.isEmpty() && m_containment) { diff --git a/components/containmentlayoutmanager/appletslayout.h b/components/containmentlayoutmanager/appletslayout.h index 86cc194128..cebf27383a 100644 --- a/components/containmentlayoutmanager/appletslayout.h +++ b/components/containmentlayoutmanager/appletslayout.h @@ -230,6 +230,8 @@ private: QPointF m_mouseDownPosition = QPoint(-1, -1); bool m_mouseDownWasEditMode = false; bool m_editMode = false; + + bool m_initFinished = false; }; Q_DECLARE_OPERATORS_FOR_FLAGS(AppletsLayout::LayoutChanges) -- GitLab From 4665566419661db6fcd37d003b689afd52f952c1 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Thu, 15 Sep 2022 03:21:31 -0500 Subject: [PATCH 2/4] Remove unnecessary heuristic relayout function call --- components/containmentlayoutmanager/appletslayout.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/containmentlayoutmanager/appletslayout.cpp b/components/containmentlayoutmanager/appletslayout.cpp index 36ea697a14..ce72fa638e 100644 --- a/components/containmentlayoutmanager/appletslayout.cpp +++ b/components/containmentlayoutmanager/appletslayout.cpp @@ -93,10 +93,6 @@ AppletsLayout::AppletsLayout(QQuickItem *parent) } else if (!m_geometryBeforeResolutionChange.isEmpty()) { m_layoutManager->layoutGeometryChanged(newGeom, m_geometryBeforeResolutionChange); m_geometryBeforeResolutionChange = QRectF(); - - // Heuristically relayout items only when the plasma startup is fully completed - } else { - polish(); } } m_layoutChanges = NoChange; -- GitLab From dc392386542dd89fdb2f2c018fc9644ac17df01c Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Thu, 15 Sep 2022 03:21:55 -0500 Subject: [PATCH 3/4] Save layout immediately after a resolution change triggered relayout --- components/containmentlayoutmanager/appletslayout.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/containmentlayoutmanager/appletslayout.cpp b/components/containmentlayoutmanager/appletslayout.cpp index ce72fa638e..55f7696d75 100644 --- a/components/containmentlayoutmanager/appletslayout.cpp +++ b/components/containmentlayoutmanager/appletslayout.cpp @@ -93,6 +93,11 @@ AppletsLayout::AppletsLayout(QQuickItem *parent) } else if (!m_geometryBeforeResolutionChange.isEmpty()) { m_layoutManager->layoutGeometryChanged(newGeom, m_geometryBeforeResolutionChange); m_geometryBeforeResolutionChange = QRectF(); + + // If the user doesn't move a widget after this is done, the widget positions won't be saved and they will be in the wrong + // places on next login, so save them now. + + save(); } } m_layoutChanges = NoChange; -- GitLab From 535fdcfabf105e7b634a4474011034e1babdad90 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Fri, 16 Sep 2022 16:32:29 -0500 Subject: [PATCH 4/4] Revert "Ignore early startup resolution changes in AppletsLayout::AppletsLayout" This reverts commit ff6de558fa0fe7b65dfd341aaebbc488c65661cc. --- components/containmentlayoutmanager/appletslayout.cpp | 10 ---------- components/containmentlayoutmanager/appletslayout.h | 2 -- 2 files changed, 12 deletions(-) diff --git a/components/containmentlayoutmanager/appletslayout.cpp b/components/containmentlayoutmanager/appletslayout.cpp index 55f7696d75..124d541bdd 100644 --- a/components/containmentlayoutmanager/appletslayout.cpp +++ b/components/containmentlayoutmanager/appletslayout.cpp @@ -40,7 +40,6 @@ AppletsLayout::AppletsLayout(QQuickItem *parent) if (!m_containment) { return; } - // We can't save the layout during bootup, for performance reasons and to avoid race consitions as much as possible, so if we needto save and still // starting up, don't actually savenow, but we will when Corona::startupCompleted is emitted @@ -64,15 +63,6 @@ AppletsLayout::AppletsLayout(QQuickItem *parent) if (!m_containment) { return; } - - // The first time this code is run, an early-startup screen resolution change will cause widgets to become scrambl> - // resolution changes that happen the first time the function is called. - - if (!m_initFinished) { - m_geometryBeforeResolutionChange = QRectF(); - m_initFinished = true; - } - const QString &serializedConfig = m_containment->config().readEntry(m_configKey, ""); if ((m_layoutChanges & ConfigKeyChange) && !serializedConfig.isEmpty()) { if (!m_configKey.isEmpty() && m_containment) { diff --git a/components/containmentlayoutmanager/appletslayout.h b/components/containmentlayoutmanager/appletslayout.h index cebf27383a..86cc194128 100644 --- a/components/containmentlayoutmanager/appletslayout.h +++ b/components/containmentlayoutmanager/appletslayout.h @@ -230,8 +230,6 @@ private: QPointF m_mouseDownPosition = QPoint(-1, -1); bool m_mouseDownWasEditMode = false; bool m_editMode = false; - - bool m_initFinished = false; }; Q_DECLARE_OPERATORS_FOR_FLAGS(AppletsLayout::LayoutChanges) -- GitLab