[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.5/kdebase/workspace/plasma/desktop/shell
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-08-31 22:59:11
Message-ID: 20100831225911.8238FAC871 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1170446 by aseigo:
backport fixes for:
CCBUG:241332
M +25 -0 panelview.cpp
M +3 -0 panelview.h
M +30 -11 plasmaapp.cpp
M +6 -1 plasmaapp.h
--- branches/KDE/4.5/kdebase/workspace/plasma/desktop/shell/panelview.cpp #1170445:1170446
@@ -1196,6 +1196,31 @@
recreateUnhideTrigger();
}
+bool PanelView:: migratedFrom(int screenId) const
+{
+ KConfigGroup cg = config();
+ QList<int> migrations;
+ migrations = cg.readEntry("Migrations", migrations);
+ return migrations.contains(screenId);
+}
+
+void PanelView::migrateTo(int screenId)
+{
+ KConfigGroup cg = config();
+ QList<int> migrations;
+ migrations = cg.readEntry("Migrations", migrations);
+
+ const int index = migrations.indexOf(screenId);
+ if (index == -1) {
+ migrations.append(screenId);
+ } else {
+ migrations = migrations.mid(0, migrations.length() - index - 1);
+ }
+
+ cg.writeEntry("Migrations", migrations);
+ setScreen(screenId);
+}
+
void PanelView::enterEvent(QEvent *event)
{
// allow unhiding to happen again even if we were delay-unhidden
--- branches/KDE/4.5/kdebase/workspace/plasma/desktop/shell/panelview.h #1170445:1170446
@@ -205,6 +205,9 @@
void updateStruts();
+ bool migratedFrom(int screenId) const;
+ void migrateTo(int screenId);
+
protected:
void moveEvent(QMoveEvent *event);
void resizeEvent(QResizeEvent *event);
--- branches/KDE/4.5/kdebase/workspace/plasma/desktop/shell/plasmaapp.cpp #1170445:1170446
@@ -664,7 +664,7 @@
QList<Kephal::Screen *> screens = Kephal::Screens::self()->screens();
screens.removeAll(primary);
- // Now we process panels: if there is room on another sreen for the panel,
+ // Now we process panels: if there is room on another screen for the panel,
// we migrate the panel there, otherwise the view is deleted. The primary
// screen is preferred in all cases.
QMutableListIterator<PanelView*> pIt(m_panels);
@@ -684,7 +684,7 @@
}
if (moveTo) {
- panel->containment()->setScreen(moveTo->id());
+ panel->migrateTo(moveTo->id());
} else {
pIt.remove();
delete panel;
@@ -704,7 +704,13 @@
m_panelViewCreationTimer.start();
}
}
+
+ foreach (PanelView *view, m_panels) {
+ if (view->migratedFrom(screen->id())) {
+ view->migrateTo(screen->id());
}
+ }
+}
bool PlasmaApp::canRelocatePanel(PanelView * view, Kephal::Screen *screen)
{
@@ -740,7 +746,7 @@
if (pv != view &&
pv->screen() == screen->id() &&
pv->location() == view->location() &&
- !pv->geometry().intersects(newGeom)) {
+ pv->geometry().intersects(newGeom)) {
return false;
break;
}
@@ -919,11 +925,6 @@
const QList<QWeakPointer<Plasma::Containment> > containments = m_panelsWaiting;
m_panelsWaiting.clear();
- Kephal::Screen *primary = Kephal::Screens::self()->primaryScreen();
- QList<Kephal::Screen *> screens = Kephal::Screens::self()->screens();
- screens.removeAll(primary);
-
- QList<Plasma::Containment *> relocationCandidates;
foreach (QWeakPointer<Plasma::Containment> containmentPtr, containments) {
Plasma::Containment *containment = containmentPtr.data();
if (!containment) {
@@ -942,16 +943,32 @@
// try to relocate the panel if it is on a now-non-existent screen
if (containment->screen() >= Kephal::ScreenUtils::numScreens()) {
- relocationCandidates << containment;
+ m_panelRelocationCandidates << containment;
continue;
}
createPanelView(containment);
}
+ if (!m_panelRelocationCandidates.isEmpty()) {
+ QTimer::singleShot(0, this, SLOT(relocatePanels()));
+ }
+}
+
+void PlasmaApp::relocatePanels()
+{
// we go through relocatables last so that all other panels can be set up first,
// preventing panel creation ordering to trip up the canRelocatePanel algorithm
- foreach (Plasma::Containment *containment, relocationCandidates) {
+ Kephal::Screen *primary = Kephal::Screens::self()->primaryScreen();
+ QList<Kephal::Screen *> screens = Kephal::Screens::self()->screens();
+ screens.removeAll(primary);
+
+ foreach (QWeakPointer<Plasma::Containment> c, m_panelRelocationCandidates) {
+ Plasma::Containment *containment = c.data();
+ if (!containment) {
+ continue;
+ }
+
Kephal::Screen *moveTo = 0;
PanelView *panelView = createPanelView(containment);
if (canRelocatePanel(panelView, primary)) {
@@ -966,12 +983,14 @@
}
if (moveTo) {
- containment->setScreen(moveTo->id(), -1);
+ panelView->migrateTo(moveTo->id());
} else {
m_panels.removeAll(panelView);
delete panelView;
}
}
+
+ m_panelRelocationCandidates.clear();
}
PanelView *PlasmaApp::createPanelView(Plasma::Containment *containment)
--- branches/KDE/4.5/kdebase/workspace/plasma/desktop/shell/plasmaapp.h #1170445:1170446
@@ -152,13 +152,18 @@
void wallpaperCheckedIn();
void wallpaperCheckInTimeout();
void dashboardClosed();
+ void relocatePanels();
private:
DesktopCorona *m_corona;
+
QList<PanelView*> m_panels;
QList<QWeakPointer<Plasma::Containment> > m_panelsWaiting;
+ QList<QWeakPointer<Plasma::Containment> > m_panelRelocationCandidates;
+
+ QList<DesktopView*> m_desktops;
QList<QWeakPointer<Plasma::Containment> > m_desktopsWaiting;
- QList<DesktopView*> m_desktops;
+
QTimer m_panelViewCreationTimer;
QTimer m_desktopViewCreationTimer;
QWeakPointer<InteractiveConsole> m_console;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic