diff options
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 23 | ||||
-rw-r--r-- | lumina-desktop/LDesktop.h | 10 | ||||
-rw-r--r-- | lumina-desktop/LPanel.cpp | 18 | ||||
-rw-r--r-- | lumina-desktop/LPanel.h | 2 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 68 | ||||
-rw-r--r-- | lumina-desktop/LSession.h | 3 | ||||
-rw-r--r-- | lumina-desktop/WMProcess.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/WMProcess.h | 7 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.cpp | 3 |
9 files changed, 104 insertions, 32 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 31ac47c3..6546cec4 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -52,11 +52,11 @@ void LDesktop::show(){ for(int i=0; i<PANELS.length(); i++){ PANELS[i]->show(); } } -/*void LDesktop::hide(){ +void LDesktop::hide(){ if(bgWindow!=0){ bgWindow->hide(); } if(bgDesktop!=0){ bgDesktop->hide(); } for(int i=0; i<PANELS.length(); i++){ PANELS[i]->hide(); } -}*/ +} void LDesktop::prepareToClose(){ //Get any panels ready to close @@ -89,6 +89,23 @@ QRect LDesktop::availableScreenGeom(){ } } +void LDesktop::UpdateGeometry(){ + //First make sure there is something different about the geometry + if(desktop->screenGeometry()==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; + bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); + qDebug() << " - Update Desktop Plugin Area"; + UpdateDesktopPluginArea(); + /*qDebug() << " - Update Panel Geometry"; + for(int i=0; PANELS.length(); i++){ + PANELS[i]->UpdatePanel(true); //only update geometry + }*/ + qDebug() << " - Done With Desktop Geom Updates"; + //QTimer::singleShot(0, this, SLOT(UpdatePanels())); +} + void LDesktop::SystemLogout(){ LSession::handle()->systemWindow(); } @@ -268,7 +285,7 @@ void LDesktop::InitDesktop(){ //This is called *once* during the main initialization routines checkResolution(); //Adjust the desktop config file first (if necessary) if(DEBUG){ qDebug() << "Init Desktop:" << desktopnumber; } - connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int))); + //connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int))); if(DEBUG){ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber) << LSession::handle()->screenGeom(desktopnumber); } deskMenu = new QMenu(0); connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) ); diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h index b476deab..e1900f5a 100644 --- a/lumina-desktop/LDesktop.h +++ b/lumina-desktop/LDesktop.h @@ -40,12 +40,14 @@ public: int Screen(); //return the screen number this object is managing void show(); - //void hide(); + void hide(); void prepareToClose(); WId backgroundID(); QRect availableScreenGeom(); + void UpdateGeometry(); + public slots: void SystemLogout(); void SystemTerminal(); @@ -105,11 +107,5 @@ private slots: void UpdateDesktopPluginArea(); //make sure the area is not underneath any panels void UpdateBackground(); - void UpdateGeometry(int screen){ - if(screen==desktopnumber){ - bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); - QTimer::singleShot(0, this, SLOT(UpdatePanels())); - } - } }; #endif diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp index 7767d004..4cdbcbfd 100644 --- a/lumina-desktop/LPanel.cpp +++ b/lumina-desktop/LPanel.cpp @@ -56,7 +56,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ LSession::handle()->XCB->SetAsSticky(this->winId()); QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread - connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes + //connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes } LPanel::~LPanel(){ @@ -90,12 +90,12 @@ void LPanel::scalePanel(double xscale, double yscale){ //=========== // PUBLIC SLOTS //=========== -void LPanel::UpdatePanel(){ +void LPanel::UpdatePanel(bool geomonly){ //Create/Update the panel as designated in the Settings file settings->sync(); //make sure to catch external settings changes //First set the geometry of the panel and send the EWMH message to reserve that space - if(DEBUG){ qDebug() << "Update Panel"; } - hidden = settings->value(PPREFIX+"hidepanel",false).toBool(); //default to true for the moment + if(DEBUG){ qDebug() << "Update Panel: Geometry only=" << geomonly << "Screen Size:" << LSession::handle()->screenGeom(screennum); } + hidden = settings->value(PPREFIX+"hidepanel",false).toBool(); QString loc = settings->value(PPREFIX+"location","").toString().toLower(); if(loc.isEmpty() && defaultpanel){ loc="top"; } if(loc=="top" || loc=="bottom"){ @@ -122,15 +122,18 @@ void LPanel::UpdatePanel(){ if(panelPercent<1 || panelPercent>100){ panelPercent = 100; } panelPercent = panelPercent/100.0; QString panelPinLoc = settings->value(PPREFIX+"pinLocation","center").toString().toLower(); //[left/right/center] possible values (assume center otherwise) + if(DEBUG){ qDebug() << " - Panel settings:" << QString::number(panelPercent)+QString("%") << panelPinLoc << loc; } //xloc=xoffset; if(loc=="top"){ //top of screen QSize sz = QSize(xwid*panelPercent, ht); if(panelPinLoc=="left"){} // no change to xloc else if(panelPinLoc=="right"){ xloc = xloc+xwid-sz.width(); } else{ xloc = xloc+((xwid-sz.width())/2) ; } //centered + //qDebug() << " - Panel Sizing:" << xloc << sz; this->setMinimumSize(sz); this->setMaximumSize(sz); this->setGeometry(xloc,0,sz.width(), sz.height()); + //qDebug() << " - Reserve Panel Localation"; if(!hidden){ LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), ht, "top"); } else{ LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), hidesize, "top"); @@ -189,7 +192,8 @@ void LPanel::UpdatePanel(){ //With QT5, we need to make sure to reset window properties on occasion //LSession::handle()->XCB->SetDisableWMActions(this->winId()); //ensure no WM actions //LSession::handle()->XCB->SetAsSticky(this->winId()); - + if(DEBUG){ qDebug() << " - Done with panel geometry"; } + if(geomonly){ return; } //Now update the appearance of the toolbar if(settings->value(PPREFIX+"customcolor", false).toBool()){ QString color = settings->value(PPREFIX+"color", "rgba(255,255,255,160)").toString(); @@ -315,8 +319,8 @@ void LPanel::enterEvent(QEvent *event){ //Move the panel out so it is fully available this->move(showpoint); } - tmpID = LSession::handle()->XCB->ActiveWindow(); - this->activateWindow(); + //tmpID = LSession::handle()->XCB->ActiveWindow(); + //this->activateWindow(); event->accept(); //just to quiet the compile warning } diff --git a/lumina-desktop/LPanel.h b/lumina-desktop/LPanel.h index f823b73d..cee1b5c7 100644 --- a/lumina-desktop/LPanel.h +++ b/lumina-desktop/LPanel.h @@ -62,7 +62,7 @@ public: void scalePanel(double xscale, double yscale); public slots: - void UpdatePanel(); //Load the settings file and update the panel appropriately + void UpdatePanel(bool geomonly = false); //Load the settings file and update the panel appropriately void UpdateLocale(); //Locale Changed externally void UpdateTheme(); //Theme Changed externally diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 1747154d..8286bdd6 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -48,6 +48,10 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){ TrayDmgError = 0; cleansession = true; TrayStopping = false; + screenTimer = new QTimer(this); + screenTimer->setSingleShot(true); + screenTimer->setInterval(2000); //0.2 seconds + connect(screenTimer, SIGNAL(timeout()), this, SLOT(updateDesktops()) ); for(int i=1; i<argc; i++){ if( QString::fromLocal8Bit(argv[i]) == "--noclean" ){ cleansession = false; break; } } @@ -156,7 +160,8 @@ void LSession::setupSession(){ watcher->addPath( QDir::homePath() ); //connect internal signals/slots - connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(updateDesktops()) ); + connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screensChanged()) ); + connect(this->desktop(), SIGNAL(resized(int)), this, SLOT(screenResized(int)) ); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange(QString)) ); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange(QString)) ); connect(this, SIGNAL(aboutToQuit()), this, SLOT(SessionEnding()) ); @@ -343,13 +348,27 @@ void LSession::watcherChange(QString changed){ } } +void LSession::screensChanged(){ + qDebug() << "Screen Number Changed"; + //if(screenTimer->isActive()){ screenTimer->stop(); } + //screenTimer->start(); + updateDesktops(); +} + +void LSession::screenResized(int scrn){ + qDebug() << "Screen Resized:" << scrn << this->desktop()->screenGeometry(scrn); + for(int i=0; i<DESKTOPS.length(); i++){ + if(DESKTOPS[i]->Screen() == scrn){ DESKTOPS[i]->UpdateGeometry(); return; } + } +} + void LSession::checkWindowGeoms(){ //Only do one window per run (this will be called once per new window - with time delays between) if(checkWin.isEmpty()){ return; } - if(RunningApps.contains(checkWin[0]) ){ //just to make sure it did not close during the delay - adjustWindowGeom( checkWin[0] ); + WId win = checkWin.takeFirst(); + if(RunningApps.contains(win) ){ //just to make sure it did not close during the delay + adjustWindowGeom( win ); } - checkWin.removeAt(0); } void LSession::checkUserFiles(){ @@ -431,9 +450,22 @@ void LSession::refreshWindowManager(){ } void LSession::updateDesktops(){ - //qDebug() << " - Update Desktops"; + qDebug() << " - Update Desktops"; QDesktopWidget *DW = this->desktop(); + qDebug() << " -- Number:" << DW->screenCount(); + 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(); } for(int i=0; i<DW->screenCount(); i++){ if(!firstrun){ savedScreens << DW->screenGeometry(i); } @@ -453,23 +485,31 @@ void LSession::updateDesktops(){ } } //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() >= DW->screenCount()){ + /*if(DESKTOPS[i]->Screen()==fscreen){ + qDebug() << " - Hide desktop on screen:" << fscreen; + DESKTOPS[i]->hide(); + }else*/ 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]->show(); //QTimer::singleShot(0,DESKTOPS[i], SLOT(checkResolution())); } } - QTimer::singleShot(1000,WM, SLOT(restartWM())); //Make sure fluxbox also gets prompted to re-load screen config + //Make sure fluxbox also gets prompted to re-load screen config if the number of screens changes + if(numchange){ + qDebug() << "Update WM"; + //QTimer::singleShot(1000,WM, SLOT(restartWM())); //Note: This causes crashes in X if a full-screen app + WM->updateWM(); + } } //Make sure all the background windows are registered on the system as virtual roots QTimer::singleShot(100,this, SLOT(registerDesktopWindows())); @@ -485,7 +525,9 @@ void LSession::registerDesktopWindows(){ } void LSession::adjustWindowGeom(WId win, bool maximize){ - if(DEBUG){ qDebug() << "AdjustWindowGeometry():" << win << maximize; } + //return; //temporary disable + if(DEBUG){ qDebug() << "AdjustWindowGeometry():" << win << maximize << XCB->WindowClass(win); } + if(XCB->WindowIsFullscreen(win) >=0 ){ return; } //don't touch it //Quick hack for making sure that new windows are not located underneath any panels // Get the window location QRect geom = XCB->WindowGeometry(win, false); @@ -568,7 +610,7 @@ QRect LSession::screenGeom(int num){ if(num < 0 || num >= this->desktop()->screenCount() ){ return QRect(); } QRect geom = this->desktop()->screenGeometry(num); QScreen* scrn = this->screens().at(num); - if(DEBUG){ qDebug() << "Screen Geometry:" << num << geom << scrn->geometry() << scrn->virtualGeometry(); } + //if(DEBUG){ qDebug() << "Screen Geometry:" << num << geom << scrn->geometry() << scrn->virtualGeometry(); } if(geom.isNull() ){ if( !scrn->geometry().isNull() ){ geom = scrn->geometry(); } else if( !scrn->virtualGeometry().isNull() ){ geom = scrn->virtualGeometry(); } @@ -635,11 +677,13 @@ void LSession::WindowPropertyEvent(){ QList<WId> newapps = XCB->WindowList(); if(RunningApps.length() < newapps.length()){ //New Window found + qDebug() << "New window found"; LSession::restoreOverrideCursor(); //restore the mouse cursor back to normal (new window opened?) //Perform sanity checks on any new window geometries for(int i=0; i<newapps.length() && !TrayStopping; i++){ if(!RunningApps.contains(newapps[i])){ checkWin << newapps[i]; + if(DEBUG){ qDebug() << "New Window - check geom in a moment:" << XCB->WindowClass(newapps[i]); } QTimer::singleShot(100, this, SLOT(checkWindowGeoms()) ); } } @@ -770,6 +814,7 @@ void LSession::attachTrayWindow(WId win){ //static int appnum = 0; if(TrayStopping){ return; } if(RunningTrayApps.contains(win)){ return; } //already managed + qDebug() << "Session Tray: Window Added"; RunningTrayApps << win; LSession::restoreOverrideCursor(); if(DEBUG){ qDebug() << "Tray List Changed"; } @@ -780,6 +825,7 @@ void LSession::removeTrayWindow(WId win){ if(SystemTrayID==0){ return; } for(int i=0; i<RunningTrayApps.length(); i++){ if(win==RunningTrayApps[i]){ + qDebug() << "Session Tray: Window Removed"; RunningTrayApps.removeAt(i); emit TrayListChanged(); break; diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h index 52da2e6f..9edaf195 100644 --- a/lumina-desktop/LSession.h +++ b/lumina-desktop/LSession.h @@ -98,6 +98,7 @@ private: WMProcess *WM; QList<LDesktop*> DESKTOPS; QFileSystemWatcher *watcher; + QTimer *screenTimer; //Internal variable for global usage AppMenu *appmenu; @@ -134,6 +135,8 @@ public slots: private slots: void watcherChange(QString); + void screensChanged(); + void screenResized(int); void checkWindowGeoms(); //System Tray Functions diff --git a/lumina-desktop/WMProcess.cpp b/lumina-desktop/WMProcess.cpp index 9e398f93..32aee8ea 100644 --- a/lumina-desktop/WMProcess.cpp +++ b/lumina-desktop/WMProcess.cpp @@ -44,6 +44,7 @@ void WMProcess::stopWM(){ } void WMProcess::restartWM(){ + qDebug() << "Restarting WM"; if(isRunning()){ inShutdown = true; this->kill(); @@ -55,6 +56,7 @@ void WMProcess::restartWM(){ void WMProcess::updateWM(){ if(isRunning()){ + qDebug() << "Updating WM"; ::kill(this->pid(), SIGUSR2); //send fluxbox the signal to reload it's configuration } } diff --git a/lumina-desktop/WMProcess.h b/lumina-desktop/WMProcess.h index 287a8967..ff1b3963 100644 --- a/lumina-desktop/WMProcess.h +++ b/lumina-desktop/WMProcess.h @@ -23,9 +23,12 @@ public: void startWM(); void stopWM(); - void restartWM(); + void updateWM(); - + +public slots: + void restartWM(); + private: bool inShutdown; bool isRunning(); diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp index 519a5e23..d6a87c72 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp @@ -161,12 +161,13 @@ void LSysTray::UpdateTrayWindow(WId win){ if(!isRunning || stopping || checking){ return; } for(int i=0; i<trayIcons.length(); i++){ if(trayIcons[i]->appID()==win){ - //qDebug() << "System Tray: Update Window " << win; + qDebug() << "System Tray: Update Window " << win; trayIcons[i]->update(); return; //finished now } } //Could not find tray in the list, run the checkall routine to make sure we are not missing any + qDebug() << "System Tray: Missing Window - check all"; QTimer::singleShot(0,this, SLOT(checkAll()) ); } |