From 99450d5ba03e1f5accd2f4057f2fba0590295054 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Apr 2015 11:08:02 -0400 Subject: Fix/Fix a couple important bugs before announcing 0.8.4-release: 1) Desktop plugins are not getting removed. - This appears to be a bug in Qt 5.4.1 from what I can tell (any window buttons in the QMdiSubWindow are non-responsive), but for the moment the user can right-click on the plugin titlebar and select "close" from the menu for the same effect. I have fixed a couple edge cases/situations where forcibly closing/removing a desktop plugin will crash the session (it behaves properly in all situations now from my testing). 2) Disable the panel location limitations in lumina-config since with the new lenght settings it is possible to place panels in any location now (such as two panels on the top - one pinned left and the other pinned right). 3) Fix up the desktop plugin area calculations so they properly handle panels in any configuration. 4) If the desktop area was re-configured, go through and adjust the location/sizing of any desktop plugins (to ensure that they are all within the available space - use the grid alignment procedure). --- lumina-desktop/LDesktop.cpp | 52 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'lumina-desktop/LDesktop.cpp') diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index eed9fa9c..5e61db8a 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -64,6 +64,14 @@ void LDesktop::prepareToClose(){ for(int i=0; iprepareToClose(); delete PANELS.takeAt(i); i--; } //Now close down any desktop plugins desktoplocked = true; //make sure that plugin settings are preserved during removal + //Remove all the current containers + QList wins = bgDesktop->subWindowList(); + for(int i=0; isetWhatsThis(""); //clear this so it knows it is being temporarily removed + bgDesktop->removeSubWindow(wins[i]->widget()); //unhook plugin from container + bgDesktop->removeSubWindow(wins[i]); //remove container from screen + delete wins[i]; //delete old container + } for(int i=0; i wins = bgDesktop->subWindowList(); + for(int i=0; iwhatsThis() == ID){ + if(DEBUG){ qDebug() << " - Removing Plugin Container"; } + //wins[i]->setWhatsThis(""); //clear this so it knows it is being temporarily removed + bgDesktop->removeSubWindow(wins[i]->widget()); //unhook plugin from container + bgDesktop->removeSubWindow(wins[i]); //remove container from screen + delete wins[i]; //delete old container + break; + } + } //qDebug() << "PLUGINS:" << PLUGINS.length() << ID; for(int i=0; iID() == ID){ //qDebug() << "- found ID"; - if(DEBUG){ qDebug() << "Deleting Desktop Plugin:" << ID; } + if(DEBUG){ qDebug() << " - Deleting Desktop Plugin:" << ID; } delete PLUGINS.takeAt(i); break; } @@ -433,9 +454,12 @@ void LDesktop::DesktopPluginRemoved(QString ID){ if(DEBUG){ qDebug() << " - Also removing plugin from future list"; } plugins.removeAll(ID); issyncing = true; + if(DEBUG){ qDebug() << " - Save modified plugins list"; } settings->setValue(DPREFIX+"pluginlist", plugins); - settings->sync(); + if(DEBUG){ qDebug() << " - Unlock settings file in 200 ms"; } + //settings->sync(); QTimer::singleShot(200, this, SLOT(UnlockSettings()) ); + if(DEBUG){ qDebug() << " - Done removing plugin"; } } void LDesktop::UpdatePanels(){ @@ -476,13 +500,24 @@ void LDesktop::UpdatePanels(){ void LDesktop::UpdateDesktopPluginArea(){ QRegion visReg( bgWindow->geometry() ); //visible region (not hidden behind a panel) + QRect rawRect = visReg.boundingRect(); //initial value (screen size) for(int i=0; ivalue(PANELS[i]->prefix()+"location","top").toString().toLower(); - if(loc=="top"){ shifted.translate(0, PANELS[i]->visibleWidth()); } - else if(loc=="bottom"){ shifted.translate(0, 0-PANELS[i]->visibleWidth()); } - else if(loc=="left"){ shifted.translate(PANELS[i]->visibleWidth(),0); } - else{ shifted.translate(0-PANELS[i]->visibleWidth(),0); } + int vis = PANELS[i]->visibleWidth(); + if(loc=="top"){ + if(!shifted.contains(QRect(rawRect.x(), rawRect.y(), rawRect.width(), vis))){ continue; } + shifted.translate(0, (rawRect.top()+vis)-shifted.boundingRect().top() ); + }else if(loc=="bottom"){ + if(!shifted.contains(QRect(rawRect.x(), rawRect.bottom()-vis, rawRect.width(), vis))){ continue; } + shifted.translate(0, (rawRect.bottom()-vis)-shifted.boundingRect().bottom()); + }else if(loc=="left"){ + if( !shifted.contains(QRect(rawRect.x(), rawRect.y(), vis,rawRect.height())) ){ continue; } + shifted.translate((rawRect.left()+vis)-shifted.boundingRect().left() ,0); + }else{ //right + if(!shifted.contains(QRect(rawRect.right()-vis, rawRect.y(), vis,rawRect.height())) ){ continue; } + shifted.translate((rawRect.right()-vis)-shifted.boundingRect().right(),0); + } visReg = visReg.intersected( shifted ); } //Now make sure the desktop plugin area is only the visible area @@ -492,11 +527,14 @@ void LDesktop::UpdateDesktopPluginArea(){ globalWorkRect = rec; //save this for later rec.moveTopLeft( QPoint( rec.x()-desktop->screenGeometry(desktopnumber).x() , rec.y() ) ); //qDebug() << "DPlug Area:" << rec.x() << rec.y() << rec.width() << rec.height(); + if(rec == bgDesktop->geometry()){return; } //nothing changed bgDesktop->setGeometry( rec ); bgDesktop->setBackground( QBrush(Qt::NoBrush) ); bgDesktop->update(); //Re-paint the panels (just in case a plugin was underneath it and the panel is transparent) for(int i=0; iupdate(); } + //Also need to re-arrange any desktop plugins to ensure that nothing is out of the screen area + AlignDesktopPlugins(); } void LDesktop::UpdateBackground(){ -- cgit