From fa8ed3668b09bc7c43bf8987da1c4f02c069c388 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 18 Feb 2014 16:54:05 +0100 Subject: [PATCH] event compress restore after location change now the panel position is correct after location change, and flickers less --- src/shell/panelview.cpp | 19 +++++++++++++++---- src/shell/panelview.h | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index e606e2f1a..dc8737c5f 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -58,21 +58,33 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent) themeChanged(); connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); + + m_positionPaneltimer.setSingleShot(true); + m_positionPaneltimer.setInterval(150); + connect(&m_positionPaneltimer, &QTimer::timeout, + this, [=] () { + restore(); + positionPanel(); + }); + //Screen management connect(this, &QWindow::screenChanged, this, &PanelView::positionPanel); connect(screen(), &QScreen::geometryChanged, this, &PanelView::positionPanel); connect(this, &PlasmaQuickView::locationChanged, - this, &PanelView::positionPanel); + &m_positionPaneltimer, [=] () { + m_positionPaneltimer.start(); + }); connect(this, &PlasmaQuickView::containmentChanged, this, &PanelView::positionPanel); connect(this, &PlasmaQuickView::containmentChanged, this, [=] () { - restore(); - positionPanel(); + m_positionPaneltimer.start(); }); + + if (!m_corona->package().isValid()) { qWarning() << "Invalid home screen package"; } @@ -382,7 +394,6 @@ void PanelView::positionPanel() } m_strutsTimer->stop(); m_strutsTimer->start(STRUTSTIMERDELAY); - setMinimumSize(QSize(0, 0)); setMaximumSize(screen()->size()); diff --git a/src/shell/panelview.h b/src/shell/panelview.h index e3aebc0ac..1f7550c08 100644 --- a/src/shell/panelview.h +++ b/src/shell/panelview.h @@ -24,6 +24,7 @@ #include "panelconfigview.h" #include #include +#include class ShellCorona; @@ -113,6 +114,7 @@ private: QTimer *m_strutsTimer; VisibilityMode m_visibilityMode; Plasma::Theme m_theme; + QTimer m_positionPaneltimer; static const int STRUTSTIMERDELAY = 200; };