From c63baa3ae35473aa1128228631371f1f374b7703 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Mon, 10 Oct 2016 21:21:39 +0530 Subject: [PATCH] [shell] Don't resize or reposition panel if we are doing restore Summary: PanelView::restore sets various properties including length, thickness, which would result in panel resize and repositioning. PanelView::restore also explicitly calls PanelView::positionPanel and ::resizePanel. This results in positionPanel and resizePanel operation being done multiple times at startup/adding panel and hence flicker when panel first shows up. This patch makes resizePanel and positionPanel no-op if we are restoring panel. Test Plan: Added panel, restored panel, moved around panel Reviewers: #plasma, mart Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D3008 --- shell/panelview.cpp | 12 +++++++++++- shell/panelview.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/shell/panelview.cpp b/shell/panelview.cpp index 9f8fad071..9aa55f826 100644 --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -62,7 +62,8 @@ PanelView::PanelView(ShellCorona *corona, QScreen *targetScreen, QWindow *parent m_corona(corona), m_visibilityMode(NormalPanel), m_background(0), - m_shellSurface(nullptr) + m_shellSurface(nullptr), + m_initCompleted(false) { if (targetScreen) { setPosition(targetScreen->geometry().center()); @@ -356,6 +357,10 @@ void PanelView::positionPanel() return; } + if (!m_initCompleted) { + return; + } + KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge; switch (containment()->location()) { @@ -461,6 +466,10 @@ QRect PanelView::geometryByDistance(int distance) const void PanelView::resizePanel() { + if (!m_initCompleted) { + return; + } + QSize targetSize; QSize targetMinSize; QSize targetMaxSize; @@ -520,6 +529,7 @@ void PanelView::restore() m_minLength = qBound(MINSIZE, config().readEntry("minLength", side), maxSize); setVisibilityMode((VisibilityMode)config().readEntry("panelVisibility", (int)NormalPanel)); + m_initCompleted = true; resizePanel(); positionPanel(); diff --git a/shell/panelview.h b/shell/panelview.h index 7e521bd48..894ea95cf 100644 --- a/shell/panelview.h +++ b/shell/panelview.h @@ -209,6 +209,7 @@ private: int m_contentLength; int m_distance; int m_thickness; + bool m_initCompleted; Qt::Alignment m_alignment; QPointer m_panelConfigView; ShellCorona *m_corona;