From d79162b6d9dd228c834c681db7eb5f5536c60e00 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 9 Dec 2013 19:29:11 +0100 Subject: [PATCH] Make sure that panels are properly placed upon resize Recalculate position when screen has changed or when the location changes. Recalculate position when the thickness changes, otherwise it grows outside of the window when a bottom panel thickness changes (we change it through setHeight). --- src/shell/panelview.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index d4f05ca23..dee656b7e 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -59,12 +59,14 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent) KWindowEffects::enableBlurBehind(winId(), true); //Screen management + connect(this, &QWindow::screenChanged, + this, &PanelView::positionPanel); connect(screen(), &QScreen::geometryChanged, this, &PanelView::positionPanel); connect(this, &PlasmaQuickView::locationChanged, - this, &PanelView::restore); + this, &PanelView::positionPanel); connect(this, &PlasmaQuickView::containmentChanged, - this, &PanelView::restore); + this, &PanelView::positionPanel); if (!m_corona->package().isValid()) { qWarning() << "Invalid home screen package"; @@ -80,7 +82,6 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent) qmlRegisterType(); engine()->rootContext()->setContextProperty("panel", this); setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml"))); - positionPanel(); PanelShadows::self()->addWindow(this); } @@ -167,15 +168,9 @@ void PanelView::setThickness(int value) return; } - if (formFactor() == Plasma::Types::Vertical) { - setWidth(value); - } else { - setHeight(value); - } config().writeEntry("thickness", value); - emit thicknessChanged(); m_corona->requestApplicationConfigSync(); - m_strutsTimer->start(STRUTSTIMERDELAY); + positionPanel(); } int PanelView::length() const @@ -367,6 +362,11 @@ void PanelView::positionPanel() m_strutsTimer->start(STRUTSTIMERDELAY); if (thickness() != oldThickness) { + if (formFactor() == Plasma::Types::Vertical) { + setWidth(thickness()); + } else { + setHeight(thickness()); + } emit thicknessChanged(); } }