diff options
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 4 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 44 | ||||
-rw-r--r-- | lumina-desktop/LSession.h | 4 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 7 |
4 files changed, 27 insertions, 32 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 23e668cf..5771655b 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -84,7 +84,7 @@ QRect LDesktop::availableScreenGeom(){ void LDesktop::UpdateGeometry(){ //First make sure there is something different about the geometry - if(desktop->screenGeometry()==bgWindow->geometry()){ return; } + if(desktop->screenGeometry(desktopnumber)==bgWindow->geometry()){ return; } //Now update the screen // NOTE: This functionality is highly event-driven based on X changes - so we need to keep things in order (no signals/slots) qDebug() << "Changing Desktop Geom:" << desktopnumber; @@ -96,7 +96,7 @@ void LDesktop::UpdateGeometry(){ PANELS[i]->UpdatePanel(true); //only update geometry }*/ qDebug() << " - Done With Desktop Geom Updates"; - //QTimer::singleShot(0, this, SLOT(UpdatePanels())); + QTimer::singleShot(0, this, SLOT(UpdatePanels())); } void LDesktop::SystemLogout(){ diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index b7ccbbe5..995c442d 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -25,7 +25,9 @@ XCBEventFilter *evFilter = 0; -LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){ +LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lumina-desktop"){ + if(this->isPrimaryProcess()){ + connect(this, SIGNAL(InputsAvailable(QStringList)), this, SLOT(NewCommunication(QStringList)) ); this->setApplicationName("Lumina Desktop Environment"); this->setApplicationVersion( LUtils::LuminaDesktopVersion() ); this->setOrganizationName("LuminaDesktopEnvironment"); @@ -61,9 +63,11 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){ //Setup the event filter for Qt5 evFilter = new XCBEventFilter(this); this->installNativeEventFilter( evFilter ); + } //end check for primary process } LSession::~LSession(){ + if(this->isPrimaryProcess()){ WM->stopWM(); for(int i=0; i<DESKTOPS.length(); i++){ delete DESKTOPS[i]; @@ -73,6 +77,7 @@ LSession::~LSession(){ delete appmenu; delete currTranslator; if(mediaObj!=0){delete mediaObj;} + } } void LSession::setupSession(){ @@ -244,6 +249,15 @@ int LSession::VersionStringToNumber(QString version){ return (maj*1000000 + mid*1000 + min); } +void LSession::NewCommunication(QStringList list){ + if(DEBUG){ qDebug() << "New Communications:" << list; } + for(int i=0; i<list.length(); i++){ + if(list[i]=="--check-geoms"){ + screensChanged(); + } + } +} + void LSession::launchStartupApps(){ //First start any system-defined startups, then do user defined qDebug() << "Launching startup applications"; @@ -482,51 +496,29 @@ void LSession::updateDesktops(){ for(int i=0; i<DW->screenCount(); i++){ qDebug() << " -- Screen["+QString::number(i)+"]:" << DW->screenGeometry(i); } bool firstrun = (DESKTOPS.length()==0); bool numchange = DESKTOPS.length()!=DW->screenCount(); - //Determine if this is a temporary X screen reset (some full-screen apps modify the screens) - /*WId actWin = XCB->ActiveWindow(); - qDebug() << " -- Active Window:" << XCB->WindowClass(actWin); - //See if the current app is full-screen - int fscreen = -1; - if( XCB->WindowClass(actWin) != "Lumina Desktop Environment" ){ - fscreen = XCB->WindowIsFullscreen(actWin); - }*/ - qDebug() << " -- Desktop Flags:" << firstrun << numchange << DW->isVirtualDesktop(); - //Now go through and - //if(!firstrun){ savedScreens.clear(); } + //qDebug() << " -- Desktop Flags:" << firstrun << numchange << DW->isVirtualDesktop(); for(int i=0; i<DW->screenCount(); i++){ - //if(!firstrun){ savedScreens << DW->screenGeometry(i); } bool found = false; for(int j=0; j<DESKTOPS.length() && !found; j++){ - //Match either the screen number or the screen location (preventing duplicates) - //if(DESKTOPS[j]->Screen()==i || DW->screenGeometry(i)==DW->screenGeometry(DESKTOPS[j]->Screen()) ){ found = true; } if(DESKTOPS[j]->Screen()==i ){ found = true; } } if(!found){ //Start the desktop on the new screen qDebug() << " - Start desktop on screen:" << i << DW->screenGeometry(i) << "Virtual:" << DW->isVirtualDesktop(); - if(firstrun && DW->screenGeometry(i).x()==0){ - DESKTOPS << new LDesktop(i,true); //set this one as the default - }else{ DESKTOPS << new LDesktop(i); - } } } - //qDebug() << " - Done Starting Desktops"; - //return; //temporary stop for debugging if(!firstrun){//Done right here on first run //Now go through and make sure to delete any desktops for detached screens for(int i=0; i<DESKTOPS.length(); i++){ - /*if(DESKTOPS[i]->Screen()==fscreen){ - qDebug() << " - Hide desktop on screen:" << fscreen; - DESKTOPS[i]->hide(); - }else*/ if(DESKTOPS[i]->Screen() >= DW->screenCount()){ + if(DESKTOPS[i]->Screen() >= DW->screenCount()){ qDebug() << " - Close desktop on screen:" << DESKTOPS[i]->Screen(); DESKTOPS[i]->prepareToClose(); delete DESKTOPS.takeAt(i); i--; }else{ qDebug() << " - Show desktop on screen:" << DESKTOPS[i]->Screen(); - //DESKTOPS[i]->UpdateGeometry(); + DESKTOPS[i]->UpdateGeometry(); DESKTOPS[i]->show(); //QTimer::singleShot(0,DESKTOPS[i], SLOT(checkResolution())); } diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h index 8147e411..ae217bd8 100644 --- a/lumina-desktop/LSession.h +++ b/lumina-desktop/LSession.h @@ -31,6 +31,7 @@ //#include "BootSplash.h" #include <LuminaX11.h> +#include <LuminaSingleApplication.h> //SYSTEM TRAY STANDARD DEFINITIONS #define SYSTEM_TRAY_REQUEST_DOCK 0 @@ -45,7 +46,7 @@ public: } };*/ -class LSession : public QApplication{ +class LSession : public LSingleApplication{ Q_OBJECT public: LSession(int &argc, char **argv); @@ -138,6 +139,7 @@ public slots: void reloadIconTheme(); private slots: + void NewCommunication(QStringList); void launchStartupApps(); //used during initialization void watcherChange(QString); void screensChanged(); diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 1897fb2f..3602c10e 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -70,6 +70,10 @@ int main(int argc, char ** argv) setenv("DESKTOP_SESSION","Lumina",1); setenv("XDG_CURRENT_DESKTOP","Lumina",1); unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... + //Startup the Application + if(DEBUG){ qDebug() << "Session Init:";} + LSession a(argc, argv); + if(!a.isPrimaryProcess()){ return 0; } //Setup the log file qDebug() << "Lumina Log File:" << logfile.fileName(); if(QFile::exists(logfile.fileName()+".old")){ QFile::remove(logfile.fileName()+".old"); } @@ -82,9 +86,6 @@ int main(int argc, char ** argv) logfile.open(QIODevice::WriteOnly | QIODevice::Append); QTime *timer=0; if(DEBUG){ timer = new QTime(); timer->start(); } - //Startup the Application - if(DEBUG){ qDebug() << "Session Init:" << timer->elapsed(); } - LSession a(argc, argv); //Setup Log File qInstallMessageHandler(MessageOutput); if(DEBUG){ qDebug() << "Theme Init:" << timer->elapsed(); } |