From 0365f5b0e1b0cccfd158297aa746190be4479e0c Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 1 Dec 2015 10:53:23 -0500 Subject: Adjust the main lumina-desktop session a bit: 1) Make it a single-instance process 2) Add a "--check-geoms" input flag which will have the desktop re-scan all monitor geometries and adjust as needed. 3) Adjust the monitor re-detection/adjustment routines a bit to ensure consisten functionality. --- lumina-desktop/LSession.cpp | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'lumina-desktop/LSession.cpp') 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; iscreenCount(); 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; iscreenCount(); i++){ - //if(!firstrun){ savedScreens << DW->screenGeometry(i); } bool found = false; for(int j=0; jScreen()==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; iScreen()==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())); } -- cgit