From 56a5408045a0d2327842bd5fa3c86a48cd6a375f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 24 Apr 2015 18:53:38 -0400 Subject: Before activating the panel on mouse-over, save the ID of the currently active window and then re-activate that other window when the mouse leaves the panel. --- lumina-desktop/LDesktop.cpp | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'lumina-desktop/LDesktop.cpp') diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index c2ef4a2a..21372bf1 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2012-2014, Ken Moore +// Copyright (c) 2012-2015, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -60,6 +60,7 @@ void LDesktop::show(){ void LDesktop::prepareToClose(){ //Get any panels ready to close + issyncing = true; //Stop handling any watcher events 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 @@ -105,6 +106,40 @@ void LDesktop::SystemApplication(QAction* act){ } } +void LDesktop::checkResolution(){ + //Compare the current screen resolution with the last one used/saved + //NOTE: This should only be performed after all the elements have been initialized/created. + int oldWidth = settings->value(DPREFIX+"screen/lastWidth",-1).toInt(); + int oldHeight = settings->value(DPREFIX+"screen/lastHeight",-1).toInt(); + QRect scrn = LSession::desktop()->screenGeometry(desktopnumber); + issyncing = true; + settings->setValue(DPREFIX+"screen/lastWidth",scrn.width()); + settings->setValue(DPREFIX+"screen/lastHeight",scrn.height()); + + if(oldWidth<1 || oldHeight<1 || scrn.width()<1 || scrn.height()<1){ + //nothing to do - something invalid + }else if(scrn.width()==oldWidth && scrn.height()==oldHeight){ + //nothing to do - same as before + }else{ + //Calculate the scale factor between the old/new sizes in each dimension + // and forward that on to all the interface elements + double xscale = scrn.width()/((double) oldWidth); + double yscale = scrn.height()/((double) oldHeight); + //Update any panels + for(int i=0; iscalePanel(xscale, yscale); + } + //Update any desktop plugins + for(int i=0; iscalePlugin(xscale, yscale); + } + //QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); + //QTimer::singleShot(2,this, SLOT(UpdatePanels()) ); + } + LSession::processEvents(); + issyncing = false; +} + void LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){ //Verify that a container does not already exist for this plugin QList wins = bgDesktop->subWindowList(); @@ -165,8 +200,11 @@ void LDesktop::InitDesktop(){ //Start the update processes QTimer::singleShot(10,this, SLOT(UpdateMenu()) ); QTimer::singleShot(0,this, SLOT(UpdateBackground()) ); - QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); - QTimer::singleShot(2,this, SLOT(UpdatePanels()) ); + //QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); + //QTimer::singleShot(2,this, SLOT(UpdatePanels()) ); + UpdatePanels(); + UpdateDesktop(); + //checkResolution(); } void LDesktop::SettingsChanged(){ -- cgit