From 178e6d6bdc8f2045606bdd47739397d577e21e89 Mon Sep 17 00:00:00 2001 From: aseigo Date: Sun, 18 Jan 2009 22:24:37 +0000 Subject: [PATCH] delay a few things on startup, such as setting the visibility mode, which ensures that things like "let windows cover" gets set up properly in all cases. BUG:181157 git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/KDE/kdebase@913219 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- workspace/plasma/shells/desktop/panelview.cpp | 49 +++++++++++++++++---------- workspace/plasma/shells/desktop/panelview.h | 2 ++ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/workspace/plasma/shells/desktop/panelview.cpp b/workspace/plasma/shells/desktop/panelview.cpp index 997ee44e..3ff05c88 100644 --- a/workspace/plasma/shells/desktop/panelview.cpp +++ b/workspace/plasma/shells/desktop/panelview.cpp @@ -196,26 +196,12 @@ PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent) #endif m_visibilityMode(NormalPanel), m_lastHorizontal(true), + m_init(false), m_editting(false), m_firstPaint(true), m_triggerEntered(false) { Q_ASSERT(qobject_cast(panel->scene())); - KConfigGroup viewConfig = config(); - - m_offset = viewConfig.readEntry("Offset", 0); - m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", (int)Qt::AlignLeft)); - setVisibilityMode((VisibilityMode)viewConfig.readEntry("panelVisibility", (int)m_visibilityMode)); - - // pinchContainment calls updatePanelGeometry for us - QRect screenRect = Kephal::ScreenUtils::screenGeometry(containment()->screen()); - m_lastHorizontal = isHorizontal(); - KConfigGroup sizes = KConfigGroup(&viewConfig, "Sizes"); - m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? screenRect.width() : screenRect.height()); - pinchContainment(screenRect); - m_lastMin = containment()->minimumSize(); - m_lastMax = containment()->maximumSize(); - if (panel) { connect(panel, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted())); connect(panel, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController())); @@ -238,13 +224,36 @@ PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent) pal.setBrush(backgroundRole(), Qt::transparent); setPalette(pal); - // KWin setup - KWindowSystem::setOnAllDesktops(winId(), true); - #ifdef Q_WS_WIN registerAccessBar(true); #endif + KConfigGroup viewConfig = config(); + KConfigGroup sizes = KConfigGroup(&viewConfig, "Sizes"); + QRect screenRect = Kephal::ScreenUtils::screenGeometry(containment()->screen()); + m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? screenRect.width() : screenRect.height()); + m_offset = viewConfig.readEntry("Offset", 0); + m_lastHorizontal = isHorizontal(); + + QTimer::singleShot(0, this, SLOT(init())); +} + +void PanelView::init() +{ + KConfigGroup viewConfig = config(); + m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", (int)Qt::AlignLeft)); + setVisibilityMode((VisibilityMode)viewConfig.readEntry("panelVisibility", (int)m_visibilityMode)); + + // pinchContainment calls updatePanelGeometry for us + QRect screenRect = Kephal::ScreenUtils::screenGeometry(containment()->screen()); + pinchContainment(screenRect); + m_lastMin = containment()->minimumSize(); + m_lastMax = containment()->maximumSize(); + + // KWin setup + KWindowSystem::setOnAllDesktops(winId(), true); + + m_init = true; updateStruts(); Kephal::Screens *screens = Kephal::Screens::self(); @@ -798,6 +807,10 @@ Qt::Alignment PanelView::alignmentFilter(Qt::Alignment align) const void PanelView::updateStruts() { + if (!m_init) { + return; + } + NETExtendedStrut strut; if (m_visibilityMode == NormalPanel) { diff --git a/workspace/plasma/shells/desktop/panelview.h b/workspace/plasma/shells/desktop/panelview.h index 57b69489..96a44c79 100644 --- a/workspace/plasma/shells/desktop/panelview.h +++ b/workspace/plasma/shells/desktop/panelview.h @@ -204,6 +204,7 @@ private: #endif private Q_SLOTS: + void init(); void togglePanelController(); void edittingComplete(); void animateHide(qreal); @@ -241,6 +242,7 @@ private: VisibilityMode m_visibilityMode; int m_lastSeenSize; bool m_lastHorizontal : 1; + bool m_init : 1; bool m_editting : 1; bool m_firstPaint : 1; -- 2.11.4.GIT