summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-04-07 16:25:16 -0500
committerTimothy Pearson <[email protected]>2013-04-07 16:25:16 -0500
commit97c65270b2d50c99da341da6c04f86a5644b4b4b (patch)
tree5fe0e79d321fd31712decdc4885f7c6b36221fb1
parent8d2f9ae31522a472de122e849d206a869f248773 (diff)
downloadtdebase-97c65270b2d50c99da341da6c04f86a5644b4b4b.tar.gz
tdebase-97c65270b2d50c99da341da6c04f86a5644b4b4b.zip
Wait for all kicker containers to load before sending desktop size to kdesktop
This resolves a long standing bug where icons would not stay put across logout / login cycles Properly handle desktop area changes when align to grid is enabled
-rw-r--r--kdesktop/desktop.cc8
-rw-r--r--kdesktop/kdiconview.cc225
-rw-r--r--kicker/kicker/core/extensionmanager.cpp41
-rw-r--r--kicker/kicker/core/extensionmanager.h1
4 files changed, 151 insertions, 124 deletions
diff --git a/kdesktop/desktop.cc b/kdesktop/desktop.cc
index 45ae1e8e5..b3893c029 100644
--- a/kdesktop/desktop.cc
+++ b/kdesktop/desktop.cc
@@ -346,7 +346,8 @@ void KDesktop::slotNoKicker()
kdDebug(1204) << "KDesktop::slotNoKicker ... kicker did not respond" << endl;
// up till now, we got no desktopIconsArea from kicker - probably
// it's not running, so use the area from KWinModule
- m_pIconView->updateWorkArea(twinModule()->workArea(twinModule()->currentDesktop()));
+ TQRect area = twinModule()->workArea(twinModule()->currentDesktop());
+ m_pIconView->updateWorkArea(area);
}
void
@@ -908,8 +909,9 @@ void KDesktop::desktopIconsAreaChanged(const TQRect &area, int screen)
// This is pretty broken, mixes Xinerama and non-Xinerama multihead
// and generally doesn't seem to be required anyway => ignore screen.
- if ( /*(screen == kdesktop_screen_number) &&*/ m_pIconView )
+ if ( /*(screen == kdesktop_screen_number) &&*/ m_pIconView ) {
m_pIconView->updateWorkArea(area);
+ }
}
void KDesktop::slotSwitchDesktops(int delta)
@@ -1120,7 +1122,9 @@ void KDesktop::desktopResized()
res >> area;
}
else
+ {
area = twinModule()->workArea(twinModule()->currentDesktop());
+ }
m_pIconView->updateWorkArea(area);
m_pIconView->startDirLister();
diff --git a/kdesktop/kdiconview.cc b/kdesktop/kdiconview.cc
index e00fbada2..6dbc09270 100644
--- a/kdesktop/kdiconview.cc
+++ b/kdesktop/kdiconview.cc
@@ -214,11 +214,13 @@ void KDIconView::initDotDirectories()
TQString prefix = iconPositionGroupPrefix();
TQString dotFileName = locateLocal("appdata", "IconPositions");
- if (kdesktop_screen_number != 0)
- dotFileName += "_Desktop" + TQString::number(kdesktop_screen_number);
+ if (kdesktop_screen_number != 0) {
+ dotFileName += "_Desktop" + TQString::number(kdesktop_screen_number);
+ }
- if (m_dotDirectory && !m_bEditableDesktopIcons)
- m_dotDirectory->rollback(false); // Don't save positions
+ if (m_dotDirectory && !m_bEditableDesktopIcons) {
+ m_dotDirectory->rollback(false); // Don't save positions
+ }
delete m_dotDirectory;
@@ -261,7 +263,7 @@ void KDIconView::initDotDirectories()
int x,y;
readIconPosition(&dotDir, x, y);
m_dotDirectory->writeEntry( X_w, x );
- m_dotDirectory->writeEntry( Y_h, y ); // Not persistant!
+ m_dotDirectory->writeEntry( Y_h, y ); // Not persistent!
}
}
}
@@ -351,8 +353,9 @@ void KDIconView::start()
{
// We can only start once
Q_ASSERT(!m_dirLister);
- if (m_dirLister)
+ if (m_dirLister) {
return;
+ }
kdDebug(1204) << "KDIconView::start" << endl;
@@ -361,16 +364,12 @@ void KDIconView::start()
m_bNeedSave = false;
- connect( m_dirLister, TQT_SIGNAL( clear() ), this, TQT_SLOT( slotClear() ) );
- connect( m_dirLister, TQT_SIGNAL( started(const KURL&) ),
- this, TQT_SLOT( slotStarted(const KURL&) ) );
- connect( m_dirLister, TQT_SIGNAL( completed() ), this, TQT_SLOT( slotCompleted() ) );
- connect( m_dirLister, TQT_SIGNAL( newItems( const KFileItemList & ) ),
- this, TQT_SLOT( slotNewItems( const KFileItemList & ) ) );
- connect( m_dirLister, TQT_SIGNAL( deleteItem( KFileItem * ) ),
- this, TQT_SLOT( slotDeleteItem( KFileItem * ) ) );
- connect( m_dirLister, TQT_SIGNAL( refreshItems( const KFileItemList & ) ),
- this, TQT_SLOT( slotRefreshItems( const KFileItemList & ) ) );
+ connect( m_dirLister, TQT_SIGNAL( clear() ), this, TQT_SLOT( slotClear() ) );
+ connect( m_dirLister, TQT_SIGNAL( started(const KURL&) ), this, TQT_SLOT( slotStarted(const KURL&) ) );
+ connect( m_dirLister, TQT_SIGNAL( completed() ), this, TQT_SLOT( slotCompleted() ) );
+ connect( m_dirLister, TQT_SIGNAL( newItems( const KFileItemList & ) ), this, TQT_SLOT( slotNewItems( const KFileItemList & ) ) );
+ connect( m_dirLister, TQT_SIGNAL( deleteItem( KFileItem * ) ), this, TQT_SLOT( slotDeleteItem( KFileItem * ) ) );
+ connect( m_dirLister, TQT_SIGNAL( refreshItems( const KFileItemList & ) ), this, TQT_SLOT( slotRefreshItems( const KFileItemList & ) ) );
// Start the directory lister !
m_dirLister->setShowingDotFiles( m_bShowDot );
@@ -381,37 +380,32 @@ void KDIconView::start()
void KDIconView::configureMedia()
{
- kdDebug(1204) << "***********KDIconView::configureMedia() " <<endl;
- m_dirLister->setMimeExcludeFilter(m_excludedMedia);
- m_dirLister->emitChanges();
- updateContents();
- if (m_enableMedia)
- {
- for (KURL::List::Iterator it1=m_mergeDirs.begin();it1!=m_mergeDirs.end();++it1)
- {
- if ((*it1).url()=="media:/") return;
- }
- m_mergeDirs.append(KURL("media:/"));
- m_dirLister->openURL(KURL("media:/"),true);
- }
- else
- {
- for (KURL::List::Iterator it2=m_mergeDirs.begin();it2!=m_mergeDirs.end();++it2)
- {
- if ((*it2).url()=="media:/")
- {
- delete m_dirLister;
- m_dirLister=0;
- start();
-// m_mergeDirs.remove(it2);
-// m_dirLister->stop("media");
- return;
+ kdDebug(1204) << "***********KDIconView::configureMedia() " <<endl;
+ m_dirLister->setMimeExcludeFilter(m_excludedMedia);
+ m_dirLister->emitChanges();
+ updateContents();
+ if (m_enableMedia) {
+ for (KURL::List::Iterator it1=m_mergeDirs.begin();it1!=m_mergeDirs.end();++it1) {
+ if ((*it1).url()=="media:/") {
+ return;
+ }
}
-
- }
- return;
- }
-
+ m_mergeDirs.append(KURL("media:/"));
+ m_dirLister->openURL(KURL("media:/"),true);
+ }
+ else {
+ for (KURL::List::Iterator it2=m_mergeDirs.begin();it2!=m_mergeDirs.end();++it2) {
+ if ((*it2).url()=="media:/") {
+ delete m_dirLister;
+ m_dirLister=0;
+ start();
+// m_mergeDirs.remove(it2);
+// m_dirLister->stop("media");
+ return;
+ }
+ }
+ return;
+ }
}
void KDIconView::createActions()
@@ -1611,69 +1605,73 @@ void KDIconView::viewportWheelEvent( TQWheelEvent * e )
void KDIconView::updateWorkArea( const TQRect &wr )
{
- m_gotIconsArea = true; // now we have it!
-
- if (( iconArea() == wr ) && (m_needDesktopAlign == false)) return; // nothing changed; avoid repaint/saveIconPosition ...
-
- TQRect oldArea = iconArea();
- setIconArea( wr );
-
- kdDebug(1204) << "KDIconView::updateWorkArea wr: " << wr.x() << "," << wr.y()
- << " " << wr.width() << "x" << wr.height() << endl;
- kdDebug(1204) << " oldArea: " << oldArea.x() << "," << oldArea.y()
- << " " << oldArea.width() << "x" << oldArea.height() << endl;
-
- if ( m_autoAlign ) {
- //lineupIcons();
- }
- else {
- bool needRepaint = false;
- TQIconViewItem* item;
- int dx, dy;
-
- dx = wr.left() - oldArea.left();
- dy = wr.top() - oldArea.top();
-
- if ( dx != 0 || dy != 0 ) {
- if ( (dx > 0) || (dy > 0) ) // the iconArea was shifted right/down; less space now
- for ( item = firstItem(); item; item = item->nextItem() ) {
- // check if there is any item inside the now unavailable area
- // If so, we have to move _all_ items
- // If not, we don't have to move any item (avoids bug:117868)
- if ( (item->x() < wr.x()) || (item->y() < wr.y()) ) {
- needRepaint = true;
- break;
- }
- }
- else // the iconArea was shifted left/up; more space now - use it
- needRepaint = true;
-
- if ( needRepaint )
- for ( item = firstItem(); item; item = item->nextItem() )
- item->moveBy( dx, dy );
- }
-
- for ( item = firstItem(); item; item = item->nextItem() ) {
- TQRect r( item->rect() );
- int dx = 0, dy = 0;
- if ( r.bottom() > wr.bottom() )
- dy = wr.bottom() - r.bottom() - 1;
- if ( r.right() > wr.right() )
- dx = wr.right() - r.right() - 1;
- if ( dx != 0 || dy != 0 ) {
- needRepaint = true;
- item->moveBy( dx, dy );
- }
- }
- if ( needRepaint ) {
- viewport()->repaint( FALSE );
- repaint( FALSE );
- saveIconPositions();
- }
- }
-
- m_needDesktopAlign = false;
- lineupIcons();
+ m_gotIconsArea = true; // now we have it!
+
+ if (( iconArea() == wr ) && (m_needDesktopAlign == false)) {
+ // nothing changed; avoid repaint/saveIconPosition ...
+ return;
+ }
+
+ TQRect oldArea = iconArea();
+ setIconArea( wr );
+
+ kdDebug(1204) << "KDIconView::updateWorkArea wr: " << wr.x() << "," << wr.y() << " " << wr.width() << "x" << wr.height() << endl;
+ kdDebug(1204) << " oldArea: " << oldArea.x() << "," << oldArea.y() << " " << oldArea.width() << "x" << oldArea.height() << endl;
+
+ bool needRepaint = false;
+ TQIconViewItem* item;
+ int dx, dy;
+
+ dx = wr.left() - oldArea.left();
+ dy = wr.top() - oldArea.top();
+
+ if ( dx != 0 || dy != 0 ) {
+ if ( (dx > 0) || (dy > 0) ) {
+ // the iconArea was shifted right/down; less space now
+ for ( item = firstItem(); item; item = item->nextItem() ) {
+ // check if there is any item inside the now unavailable area
+ // If so, we have to move _all_ items
+ // If not, we don't have to move any item (avoids bug:117868)
+ if ( (item->x() < wr.x()) || (item->y() < wr.y()) ) {
+ needRepaint = true;
+ break;
+ }
+ }
+ }
+ else {
+ // the iconArea was shifted left/up; more space now - use it
+ needRepaint = true;
+ }
+
+ if ( needRepaint ) {
+ for ( item = firstItem(); item; item = item->nextItem() ) {
+ item->moveBy( dx, dy );
+ }
+ }
+ }
+
+ for ( item = firstItem(); item; item = item->nextItem() ) {
+ TQRect r( item->rect() );
+ int dx = 0, dy = 0;
+ if ( r.bottom() > wr.bottom() ) {
+ dy = wr.bottom() - r.bottom() - 1;
+ }
+ if ( r.right() > wr.right() ) {
+ dx = wr.right() - r.right() - 1;
+ }
+ if ( dx != 0 || dy != 0 ) {
+ needRepaint = true;
+ item->moveBy( dx, dy );
+ }
+ }
+ if ( needRepaint ) {
+ viewport()->repaint( FALSE );
+ repaint( FALSE );
+ saveIconPositions();
+ }
+
+ m_needDesktopAlign = false;
+ lineupIcons();
}
void KDIconView::setupSortKeys()
@@ -1926,13 +1924,15 @@ void KDIconView::saveIconPositions()
{
kdDebug(1214) << "KDIconView::saveIconPositions" << endl;
- if (!m_bEditableDesktopIcons)
+ if (!m_bEditableDesktopIcons) {
return; // Don't save position
+ }
TQString prefix = iconPositionGroupPrefix();
TQIconViewItem *it = firstItem();
- if ( !it )
+ if ( !it ) {
return; // No more icons. Maybe we're closing and they've been removed already
+ }
while ( it )
{
@@ -1951,8 +1951,9 @@ void KDIconView::saveIconPositions()
void KDIconView::update( const TQString &_url )
{
- if (m_dirLister)
+ if (m_dirLister) {
m_dirLister->updateDirectory( _url );
+ }
}
diff --git a/kicker/kicker/core/extensionmanager.cpp b/kicker/kicker/core/extensionmanager.cpp
index 927a84f76..26b792271 100644
--- a/kicker/kicker/core/extensionmanager.cpp
+++ b/kicker/kicker/core/extensionmanager.cpp
@@ -62,7 +62,8 @@ ExtensionManager::ExtensionManager()
: TQObject(0, "ExtensionManager"),
m_menubarPanel(0),
m_mainPanel(0),
- m_panelCounter(-1)
+ m_panelCounter(-1),
+ m_loadingContainers(false)
{
}
@@ -86,6 +87,8 @@ ExtensionManager::~ExtensionManager()
void ExtensionManager::initialize()
{
+ m_loadingContainers = true;
+
// kdDebug(1210) << "ExtensionManager::loadContainerConfig()" << endl;
TDEConfig* config = TDEGlobal::config();
PluginManager* pm = PluginManager::the();
@@ -136,6 +139,13 @@ void ExtensionManager::initialize()
TQStringList::iterator itEnd = elist.end();
for (TQStringList::iterator it = elist.begin(); it != elist.end(); ++it)
{
+ // last container?
+ TQStringList::iterator lastcheck(it);
+ lastcheck++;
+ if (lastcheck == elist.end()) {
+ m_loadingContainers = false;
+ }
+
// extension id
TQString extensionId(*it);
@@ -166,6 +176,7 @@ void ExtensionManager::initialize()
kapp->processEvents();
}
}
+ m_loadingContainers = false;
pm->clearUntrustedLists();
connect(Kicker::the(), TQT_SIGNAL(configurationChanged()), TQT_SLOT(configurationChanged()));
@@ -219,7 +230,9 @@ void ExtensionManager::configureMenubar(bool duringInit)
delete m_menubarPanel;
m_menubarPanel = 0;
- emit desktopIconsAreaChanged(desktopIconsArea(screen), screen);
+ if (!m_loadingContainers) {
+ emit desktopIconsAreaChanged(desktopIconsArea(screen), screen);
+ }
}
}
@@ -374,8 +387,10 @@ void ExtensionManager::updateMenubar()
tmpmenu.sizeHint().height());
m_menubarPanel->writeConfig();
- emit desktopIconsAreaChanged(desktopIconsArea(m_menubarPanel->xineramaScreen()),
- m_menubarPanel->xineramaScreen());
+ if (!m_loadingContainers) {
+ emit desktopIconsAreaChanged(desktopIconsArea(m_menubarPanel->xineramaScreen()),
+ m_menubarPanel->xineramaScreen());
+ }
}
bool ExtensionManager::isMainPanel(const TQWidget* panel) const
@@ -425,8 +440,10 @@ void ExtensionManager::addContainer(ExtensionContainer* e)
connect(e, TQT_SIGNAL(removeme(ExtensionContainer*)),
this, TQT_SLOT(removeContainer(ExtensionContainer*)));
- emit desktopIconsAreaChanged(desktopIconsArea(e->xineramaScreen()),
- e->xineramaScreen());
+ if (!m_loadingContainers) {
+ emit desktopIconsAreaChanged(desktopIconsArea(e->xineramaScreen()),
+ e->xineramaScreen());
+ }
}
void ExtensionManager::removeContainer(ExtensionContainer* e)
@@ -441,8 +458,10 @@ void ExtensionManager::removeContainer(ExtensionContainer* e)
e->deleteLater(); // Wait till we return to the main event loop
saveContainerConfig();
- emit desktopIconsAreaChanged(desktopIconsArea(e->xineramaScreen()),
- e->xineramaScreen());
+ if (!m_loadingContainers) {
+ emit desktopIconsAreaChanged(desktopIconsArea(e->xineramaScreen()),
+ e->xineramaScreen());
+ }
}
void ExtensionManager::removeAllContainers()
@@ -766,8 +785,10 @@ void ExtensionManager::extensionSizeChanged(ExtensionContainer *extension)
return;
}
- emit desktopIconsAreaChanged(desktopIconsArea(extension->xineramaScreen()),
- extension->xineramaScreen());
+ if (!m_loadingContainers) {
+ emit desktopIconsAreaChanged(desktopIconsArea(extension->xineramaScreen()),
+ extension->xineramaScreen());
+ }
}
#include "extensionmanager.moc"
diff --git a/kicker/kicker/core/extensionmanager.h b/kicker/kicker/core/extensionmanager.h
index 47db7006e..b4a53ec31 100644
--- a/kicker/kicker/core/extensionmanager.h
+++ b/kicker/kicker/core/extensionmanager.h
@@ -85,6 +85,7 @@ private:
ExtensionContainer* m_menubarPanel;
ExtensionContainer* m_mainPanel;
int m_panelCounter;
+ bool m_loadingContainers;
static ExtensionManager* m_self;
};