diff --git a/src/shell/desktopcorona.cpp b/src/shell/desktopcorona.cpp index 010a45329..efdfaa309 100644 --- a/src/shell/desktopcorona.cpp +++ b/src/shell/desktopcorona.cpp @@ -50,12 +50,6 @@ DesktopCorona::DesktopCorona(QObject *parent) connect(m_appConfigSyncTimer, &QTimer::timeout, this, &DesktopCorona::syncAppConfig); - m_waitingPanelsTimer = new QTimer(this); - m_waitingPanelsTimer->setSingleShot(true); - connect(m_waitingPanelsTimer, &QTimer::timeout, - this, &DesktopCorona::createWaitingPanels); - - connect(m_desktopWidget, SIGNAL(resized(int)), this, SLOT(screenResized(int))); connect(m_desktopWidget, SIGNAL(screenCountChanged(int)), @@ -257,14 +251,23 @@ void DesktopCorona::checkViews() } } -void DesktopCorona::createWaitingPanels() + +void DesktopCorona::checkLoadingDesktopsComplete() { - foreach (Plasma::Containment *cont, m_waitingPanels) { - m_panelViews[cont] = new PanelView(this); - m_panelViews[cont]->setContainment(cont); - m_panelViews[cont]->show(); + Plasma::Containment *c = qobject_cast(sender()); + if (c) { + disconnect(c, &Plasma::Containment::uiReadyChanged, + this, &DesktopCorona::checkLoadingDesktopsComplete); + m_loadingDesktops.remove(c); + } + + if (m_loadingDesktops.isEmpty()) { + foreach (Plasma::Containment *cont, m_waitingPanels) { + m_panelViews[cont] = new PanelView(this); + m_panelViews[cont]->setContainment(cont); + } + m_waitingPanels.clear(); } - m_waitingPanels.clear(); } void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Containment *containment) @@ -276,7 +279,6 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta if (isScreen >= 0) { m_waitingPanels << containment; - m_waitingPanelsTimer->start(250); } else { if (m_panelViews.contains(containment)) { m_panelViews[containment]->setContainment(0); @@ -284,13 +286,18 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta m_panelViews.remove(containment); } } - + //Desktop view } else { - - if (m_waitingPanelsTimer->isActive()) { - m_waitingPanelsTimer->start(250); + + if (containment->isUiReady()) { + checkLoadingDesktopsComplete(); + } else { + m_loadingDesktops.insert(containment); + connect(containment, &Plasma::Containment::uiReadyChanged, + this, &DesktopCorona::checkLoadingDesktopsComplete); } + if (isScreen < 0 || m_views.count() < isScreen + 1) { qWarning() << "Invalid screen"; return; diff --git a/src/shell/desktopcorona.h b/src/shell/desktopcorona.h index b66d6e9e3..c6ba4937c 100644 --- a/src/shell/desktopcorona.h +++ b/src/shell/desktopcorona.h @@ -99,17 +99,17 @@ private Q_SLOTS: void handleContainmentAdded(Plasma::Containment *c); void showWidgetExplorer(); void syncAppConfig(); - void createWaitingPanels(); + void checkLoadingDesktopsComplete(); private: QDesktopWidget *m_desktopWidget; QList m_views; WidgetExplorerView *m_widgetExplorerView; QList m_waitingPanels; + QSet m_loadingDesktops; QHash m_panelViews; KConfigGroup m_desktopDefaultsConfig; QTimer *m_appConfigSyncTimer; - QTimer *m_waitingPanelsTimer; }; #endif diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 4b86e025a..4dde8c826 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -47,6 +47,7 @@ PanelView::PanelView(DesktopCorona *corona, QWindow *parent) setColor(QColor(Qt::transparent)); setFlags(Qt::FramelessWindowHint); KWindowSystem::setType(winId(), NET::Dock); + setVisible(false); //TODO: how to take the shape from the framesvg? KWindowEffects::enableBlurBehind(winId(), true); @@ -326,6 +327,10 @@ void PanelView::restore() return; } + setVisible(containment()->isUiReady()); + connect(containment(), &Plasma::Containment::uiReadyChanged, + this, &PanelView::setVisible); + static const int MINSIZE = 10; m_offset = config().readEntry("offset", 0);