diff options
author | Ken Moore <ken@ixsystems.com> | 2018-05-23 06:58:14 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-05-23 06:58:52 -0400 |
commit | e26cf66291f760bd4ace531a69fbde3d047e8c2f (patch) | |
tree | 3207bd730ac906eaef2411ceec98a8694ce24150 | |
parent | Move the old NativeWindow and NativeEmbedWidget files into an "obsolete" dire... (diff) | |
download | lumina-e26cf66291f760bd4ace531a69fbde3d047e8c2f.tar.gz lumina-e26cf66291f760bd4ace531a69fbde3d047e8c2f.tar.bz2 lumina-e26cf66291f760bd4ace531a69fbde3d047e8c2f.zip |
A little bit of cleanup for Lumina 1, try to get better detection of when the screen session was resized.
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktop.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LPanel.cpp | 38 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 15 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.h | 1 |
4 files changed, 33 insertions, 23 deletions
diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp index 861a1aac..4f0ce447 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.cpp +++ b/src-qt5/core/lumina-desktop/LDesktop.cpp @@ -16,7 +16,7 @@ #include <QScreen> -#define DEBUG 0 +#define DEBUG 1 LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){ screenID = QApplication::screens().at(deskNum)->name(); diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 5df1fcb6..1b2157ca 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -61,7 +61,7 @@ LPanel::LPanel(QSettings *file, QString scr, int num, QWidget *parent) : QWidget this->show(); LSession::handle()->XCB->SetAsPanel(this->winId()); LSession::handle()->XCB->SetAsSticky(this->winId()); - if(hascompositer){ + if(hascompositer){ //qDebug() << "Enable Panel compositing"; //this->setStyleSheet("QWidget#LuminaPanelBackgroundWidget{ background: transparent; }"); //this->setWindowOpacity(0.5); //fully transparent background for the main widget @@ -72,7 +72,7 @@ LPanel::LPanel(QSettings *file, QString scr, int num, QWidget *parent) : QWidget } LPanel::~LPanel(){ - + } int LPanel::Screen(){ @@ -92,7 +92,7 @@ void LPanel::prepareToClose(){ PLUGINS.takeAt(i)->deleteLater(); //delete the actual widget LSession::processEvents(); i--; //need to back up one space to not miss another plugin - } + } this->hide(); } @@ -120,9 +120,9 @@ void LPanel::UpdatePanel(bool geomonly){ 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"){ - horizontal=true; - layout->setAlignment(Qt::AlignLeft); + if(loc=="top" || loc=="bottom"){ + horizontal=true; + layout->setAlignment(Qt::AlignLeft); layout->setDirection(QBoxLayout::LeftToRight); }else{ horizontal=false; @@ -175,7 +175,7 @@ void LPanel::UpdatePanel(bool geomonly){ this->setMaximumSize(sz); this->setGeometry(xloc,yloc+xhi-ht,sz.width(), ht ); if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "bottom"); } - else{ + else{ LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc,yloc+ xhi-hidesize, this->width(), hidesize), "bottom"); hidepoint = QPoint(xloc, yloc+xhi-hidesize); showpoint = QPoint(xloc, yloc+xhi-ht); @@ -191,7 +191,7 @@ void LPanel::UpdatePanel(bool geomonly){ this->setMaximumSize(sz); this->setGeometry(xloc,yloc, ht, sz.height()); if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "left"); } - else{ + else{ LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc, yloc, hidesize, sz.height()), "left"); hidepoint = QPoint(xloc, yloc); showpoint = QPoint(xloc, yloc); @@ -207,7 +207,7 @@ void LPanel::UpdatePanel(bool geomonly){ this->setMaximumSize(sz); this->setGeometry(xloc+xwid-ht,yloc,ht, sz.height()); if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "right"); } - else{ + else{ LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc+xwid-hidesize, yloc, hidesize, sz.height()), "right"); hidepoint = QPoint(xloc+xwid-hidesize, yloc); showpoint = QPoint(xloc+xwid-ht, yloc); @@ -226,10 +226,10 @@ void LPanel::UpdatePanel(bool geomonly){ QString style = "QWidget#LuminaPanelColor{ background: %1; border-radius: 3px; border: 1px solid %1; }"; style = style.arg(color); panelArea->setStyleSheet(style); - }else{ + }else{ panelArea->setStyleSheet(""); //clear it and use the one from the theme } - + //Then go through the plugins and create them as necessary QStringList plugins = settings->value(PPREFIX+"pluginlist", QStringList()).toStringList(); /*if(defaultpanel && plugins.isEmpty()){ @@ -243,7 +243,7 @@ void LPanel::UpdatePanel(bool geomonly){ while( plugins.contains(plugins[i]+"---"+QString::number(Screen())+"."+QString::number(this->number())+"."+QString::number(num)) ){ num++; } - + plugins[i] = plugins[i]+"---"+QString::number(Screen())+"."+QString::number(this->number())+"."+QString::number(num); //qDebug() << "Adjust Plugin ID:" << plugins[i]; } @@ -269,7 +269,7 @@ void LPanel::UpdatePanel(bool geomonly){ //New Plugin if(DEBUG){ qDebug() << " -- New Plugin:" << plugins[i] << i; } LPPlugin *plug = NewPP::createPlugin(plugins[i], panelArea, horizontal); - if(plug != 0){ + if(plug != 0){ PLUGINS.insert(i, plug); layout->insertWidget(i, PLUGINS[i]); connect(plug, SIGNAL(MenuClosed()), this, SLOT(checkPanelFocus())); @@ -316,19 +316,20 @@ void LPanel::UpdateLocale(){ void LPanel::UpdateTheme(){ //The panel itself has no theme-based icons, just forward the signal to all the plugins + //qDebug() << "Update Theme for plugins"; for(int i=0; i<PLUGINS.length(); i++){ QTimer::singleShot(1,PLUGINS[i], SLOT(ThemeChange())); - } + } } // =================== // PRIVATE SLOTS // =================== void LPanel::checkPanelFocus(){ - qDebug() << "Check Panel Focus:" << panelnum << viswidth << fullwidth << this->size(); + //qDebug() << "Check Panel Focus:" << panelnum << viswidth << fullwidth << this->size(); if( !this->geometry().contains(QCursor::pos()) ){ //Move the panel back to it's "hiding" spot - if(hidden){ + if(hidden){ QSize sz(horizontal ? this->width() : viswidth, horizontal ? viswidth : this->height() ); this->setMinimumSize(sz); this->setMaximumSize(sz); @@ -343,13 +344,14 @@ void LPanel::checkPanelFocus(){ this->setMinimumSize(sz); this->setMaximumSize(sz); this->setGeometry( QRect(showpoint, sz) ); - } + } + //qDebug() << " - done checking focus"; } //=========== // PROTECTED //=========== -void LPanel::resizeEvent(QResizeEvent *event){ +void LPanel::resizeEvent(QResizeEvent *event){ QWidget::resizeEvent(event); for(int i=0; i<PLUGINS.length(); i++){ PLUGINS[i]->OrientationChange(); } } diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index ea6e402b..4a8a6794 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -347,7 +347,6 @@ void LSession::NewCommunication(QStringList list){ void LSession::launchStartupApps(){ //First start any system-defined startups, then do user defined qDebug() << "Launching startup applications"; - //Enable Numlock if(LUtils::isValidBinary("numlockx")){ //make sure numlockx is installed if(sessionsettings->value("EnableNumlock",false).toBool()){ @@ -493,8 +492,11 @@ void LSession::updateDesktops(){ qDebug() << " Screen Count:" << sC; qDebug() << " DESKTOPS Length:" << DESKTOPS.length(); if(sC<1){ return; } //stop here - no screens available temporarily (displayport/4K issue) - - for(int i=0; i<sC; i++){ qDebug() << " -- Screen["+QString::number(i)+"]:" << DW->screenGeometry(i); } + screenRect = QRect(); //clear it + for(int i=0; i<sC; i++){ + screenRect = screenRect.united(DW->screenGeometry(i)); + qDebug() << " -- Screen["+QString::number(i)+"]:" << DW->screenGeometry(i); + } bool firstrun = (DESKTOPS.length()==0); bool numchange = DESKTOPS.length()!=sC; @@ -774,8 +776,13 @@ void LSession::playAudioFile(QString filepath){ // XCB EVENT FILTER FUNCTIONS // ======================= void LSession::RootSizeChange(){ + if(DESKTOPS.isEmpty() || screenRect.isNull()){ return; } //Initial setup not run yet + QDesktopWidget *DW = this->desktop(); + int sC = DW->screenCount(); + QRect tmp; + for(int i=0; i<sC; i++){ tmp = tmp.united(DW->screenGeometry(i)); } + if(tmp == screenRect){ return; } //false event - session size did not change qDebug() << "Got Root Size Change"; - if(DESKTOPS.isEmpty()){ return; } //Initial setup not run yet xchange = true; screenTimer->start(); } diff --git a/src-qt5/core/lumina-desktop/LSession.h b/src-qt5/core/lumina-desktop/LSession.h index bc36b6b8..ee17660d 100644 --- a/src-qt5/core/lumina-desktop/LSession.h +++ b/src-qt5/core/lumina-desktop/LSession.h @@ -114,6 +114,7 @@ private: QList<LDesktop*> DESKTOPS; QFileSystemWatcher *watcher; QTimer *screenTimer; + QRect screenRect; bool xchange; //flag for when the x11 session was adjusted //Internal variable for global usage |