From kde-commits Thu Aug 06 21:44:16 2009 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Thu, 06 Aug 2009 21:44:16 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/containments/desktop Message-Id: <1249595056.786832.440.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124959508907804 SVN commit 1008100 by aseigo: * when our screen changes, update the working area * when we update our working area, check to make sure that the screen actually exists currently: it may be a screen that USED to exist but doesn't anymore (but is still associated with it in case that screen reappears!) M +16 -12 desktop.cpp --- trunk/KDE/kdebase/workspace/plasma/containments/desktop/desktop.cpp #1008099:1008100 @@ -99,11 +99,6 @@ } } - if (constraints & Plasma::SizeConstraint) { - refreshWorkingArea(); - } - - //FIXME: are refres on working are change and refresh on resize mutually exclusive? if (constraints & Plasma::StartupCompletedConstraint) { connect(corona(), SIGNAL(availableScreenRegionChanged()), this, SLOT(refreshWorkingArea())); @@ -121,6 +116,8 @@ } m_layout->adjustPhysicalPositions(); + } else if ((constraints & Plasma::SizeConstraint) || (constraints & Plasma::ScreenConstraint)) { + refreshWorkingArea(); } } @@ -135,13 +132,14 @@ void DefaultDesktop::addPanel(const QString &plugin) { - if (corona()) { - Containment* panel = corona()->addContainment(plugin); + Corona *c = corona(); + if (c) { + Containment* panel = c->addContainment(plugin); panel->showConfigurationInterface(); panel->setScreen(screen()); - QList freeEdges = corona()->freeEdges(screen()); + QList freeEdges = c->freeEdges(screen()); //kDebug() << freeEdges; Plasma::Location destination; if (freeEdges.contains(Plasma::TopEdge)) { @@ -161,8 +159,11 @@ panel->updateConstraints(Plasma::StartupCompletedConstraint); panel->flushPendingConstraintsEvents(); - const QRect screenGeom = corona()->screenGeometry(screen()); - const QRegion availGeom = corona()->availableScreenRegion(screen()); + const bool screenExists = screen() < c->numScreens(); + const QRect screenGeom = screenExists ? c->screenGeometry(screen()) + : geometry().toRect(); + const QRegion availGeom = screenExists ? c->availableScreenRegion(screen()) + : geometry().toRect(); int minH = 10; int minW = 10; int w = 35; @@ -369,11 +370,12 @@ Corona *c = corona(); if (!c) { //kDebug() << "no corona?!"; + QTimer::singleShot(100, this, SLOT(refreshWorkingArea())); return; } QRectF workingGeom; - if (screen() != -1) { + if (screen() != -1 && screen() < c->numScreens()) { // we are associated with a screen, make sure not to overlap panels workingGeom = c->availableScreenRegion(screen()).boundingRect(); //kDebug() << "got" << workingGeom; @@ -385,10 +387,12 @@ //kDebug() << "defaults due to no screen; got:" << workingGeom; } - if (workingGeom != QRectF()) { + if (workingGeom.isValid()) { //kDebug() << "!!!!!!!!!!!!! workingGeom is" << workingGeom; m_layout->setWorkingArea(workingGeom); m_layout->adjustPhysicalPositions(); + } else { + QTimer::singleShot(100, this, SLOT(refreshWorkingArea())); } }