[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
wilder-5.14
Bhushan Shah 10 years ago
parent 02dde72d31
commit c63baa3ae3
  1. 12
      shell/panelview.cpp
  2. 1
      shell/panelview.h

@ -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<int>(MINSIZE, config().readEntry<int>("minLength", side), maxSize);
setVisibilityMode((VisibilityMode)config().readEntry<int>("panelVisibility", (int)NormalPanel));
m_initCompleted = true;
resizePanel();
positionPanel();

@ -209,6 +209,7 @@ private:
int m_contentLength;
int m_distance;
int m_thickness;
bool m_initCompleted;
Qt::Alignment m_alignment;
QPointer<PlasmaQuick::ConfigView> m_panelConfigView;
ShellCorona *m_corona;

Loading…
Cancel
Save