From caea68731fac0339e512457d6d2506b3f4e88a06 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 5 Oct 2016 08:20:21 -0400 Subject: Convert over the desktop/panel settings to be based on screen ID instead of screen number. It seems like X randomly assigns numbers to screens in some instances - resulting in multi-monitor arrays occasionally getting rotated/scrambled. After the automatic conversion of the settings to the new system (the first time the user logs into the updated version of Lumina), screen settings are tied to that particular monitor now (HDMI-0, DP-1, etc...) --- src-qt5/core/lumina-desktop/LPanel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index bf063a31..b0abf498 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -6,6 +6,8 @@ //=========================================== #include "LPanel.h" #include "LSession.h" +#include + #include "panel-plugins/systemtray/LSysTray.h" #define DEBUG 0 @@ -26,7 +28,8 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ screennum = scr; panelnum = num; //save for later screen = LSession::desktop(); - PPREFIX = "panel"+QString::number(screennum)+"."+QString::number(num)+"/"; + QString screenID = QApplication::screens().at(screennum)->name(); + PPREFIX = "panel_"+screenID+"."+QString::number(num)+"/"; defaultpanel = (LSession::handle()->screenGeom(screennum).x()==0 && num==0); horizontal=true; //use this by default initially hidden = false; //use this by default -- cgit From c816fad1b4462b979d7b60c4e510fab3896a6bf1 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 17 Oct 2016 10:31:51 -0400 Subject: Fix the painting routines for the desktop/panel. Make sure we only paint the *requested* rectangle, and not the whole thing on every request. --- src-qt5/core/lumina-desktop/LPanel.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index b0abf498..6e07f624 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -324,12 +324,12 @@ void LPanel::paintEvent(QPaintEvent *event){ QPainter *painter = new QPainter(this); //qDebug() << "Paint Panel:" << PPREFIX; //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow - QRect rec = this->geometry(); //start with the global geometry of the panel + QRect rec = event->rect();//this->geometry(); //start with the global geometry of the panel //Need to translate that rectangle to the background image coordinates - //qDebug() << " - Rec:" << rec << hidden << this->geometry(); - rec.moveTo( rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y()-LSession::handle()->screenGeom(screennum).y() ); - //qDebug() << " - Adjusted Global Rec:" << rec; - painter->drawPixmap(QRect(0,0,this->width(), this->height()), bgWindow->grab(rec) ); + qDebug() << " - Rec:" << rec << hidden << this->geometry() << bgWindow->geometry(); + rec.moveTo( bgWindow->mapFromGlobal( this->mapToGlobal(rec.topLeft()) ) ); //(rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y()-LSession::handle()->screenGeom(screennum).y() ); + qDebug() << " - Adjusted Window Rec:" << rec; + painter->drawPixmap(event->rect(), bgWindow->grab(rec) ); } QWidget::paintEvent(event); //now pass the event along to the normal painting event } -- cgit From 8691662461303fe6ab195df5aa2f23ed4dc8eedb Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 17 Oct 2016 10:43:26 -0400 Subject: Turn off some debugging and fix the repaint of the entire wallpaper on change. --- src-qt5/core/lumina-desktop/LPanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 6e07f624..1308d61f 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -326,9 +326,9 @@ void LPanel::paintEvent(QPaintEvent *event){ //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow QRect rec = event->rect();//this->geometry(); //start with the global geometry of the panel //Need to translate that rectangle to the background image coordinates - qDebug() << " - Rec:" << rec << hidden << this->geometry() << bgWindow->geometry(); + //qDebug() << " - Rec:" << rec << hidden << this->geometry() << bgWindow->geometry(); rec.moveTo( bgWindow->mapFromGlobal( this->mapToGlobal(rec.topLeft()) ) ); //(rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y()-LSession::handle()->screenGeom(screennum).y() ); - qDebug() << " - Adjusted Window Rec:" << rec; + //qDebug() << " - Adjusted Window Rec:" << rec; painter->drawPixmap(event->rect(), bgWindow->grab(rec) ); } QWidget::paintEvent(event); //now pass the event along to the normal painting event -- cgit From c7967eb9b1a25767ec29290bebb782a70a45251a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 17 Oct 2016 11:09:05 -0400 Subject: Some more painting cleanup for the wallpaper/panels. --- src-qt5/core/lumina-desktop/LPanel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 1308d61f..67cba7f4 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -325,11 +325,12 @@ void LPanel::paintEvent(QPaintEvent *event){ //qDebug() << "Paint Panel:" << PPREFIX; //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow QRect rec = event->rect();//this->geometry(); //start with the global geometry of the panel + rec.adjust(-1,-1,2,2); //add 1 more pixel on each side //Need to translate that rectangle to the background image coordinates //qDebug() << " - Rec:" << rec << hidden << this->geometry() << bgWindow->geometry(); rec.moveTo( bgWindow->mapFromGlobal( this->mapToGlobal(rec.topLeft()) ) ); //(rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y()-LSession::handle()->screenGeom(screennum).y() ); //qDebug() << " - Adjusted Window Rec:" << rec; - painter->drawPixmap(event->rect(), bgWindow->grab(rec) ); + painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), bgWindow->grab(rec) ); } QWidget::paintEvent(event); //now pass the event along to the normal painting event } -- cgit From ded6e4e13a6a98c3793f73cbb286fcc73caf5bf7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Oct 2016 10:40:01 -0400 Subject: Large update/refactor of desktop widgets. This reduces the number of widgets in the stack by 1, and seems to help performance a bit. --- src-qt5/core/lumina-desktop/LPanel.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 67cba7f4..933dc778 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -20,6 +20,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ bgWindow = parent; //save for later //Setup the widget overlay for the entire panel to provide transparency effects panelArea = new QWidget(this); + //panelArea->setAttribute(Qt::WA_TranslucentBackground); QBoxLayout *tmp = new QBoxLayout(QBoxLayout::LeftToRight); tmp->setContentsMargins(0,0,0,0); this->setLayout(tmp); @@ -38,9 +39,12 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->setContentsMargins(0,0,0,0); this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); //panels cannot get keyboard focus otherwise it upsets the task manager window detection - this->setAttribute(Qt::WA_X11DoNotAcceptFocus); + //this->setAttribute(Qt::WA_X11DoNotAcceptFocus); this->setAttribute(Qt::WA_X11NetWmWindowTypeDock); this->setAttribute(Qt::WA_AlwaysShowToolTips); + this->setAttribute(Qt::WA_TranslucentBackground); + //this->setAttribute(Qt::WA_NoSystemBackground); + this->setAutoFillBackground(false); this->setWindowFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); //this->setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); @@ -59,8 +63,9 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ LSession::handle()->XCB->SetAsSticky(this->winId()); if(hascompositer){ //qDebug() << "Enable Panel compositing"; - this->setWindowOpacity(0.0); //fully transparent background for the main widget - panelArea->setWindowOpacity(0.0); + //this->setStyleSheet("QWidget#LuminaPanelBackgroundWidget{ background: transparent; }"); + //this->setWindowOpacity(0.5); //fully transparent background for the main widget + //panelArea->setWindowOpacity(1.0); //fully opaque for the widget on top (apply stylesheet transparencies) } 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 @@ -330,7 +335,8 @@ void LPanel::paintEvent(QPaintEvent *event){ //qDebug() << " - Rec:" << rec << hidden << this->geometry() << bgWindow->geometry(); rec.moveTo( bgWindow->mapFromGlobal( this->mapToGlobal(rec.topLeft()) ) ); //(rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y()-LSession::handle()->screenGeom(screennum).y() ); //qDebug() << " - Adjusted Window Rec:" << rec; - painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), bgWindow->grab(rec) ); + painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), bgWindow->grab(rec)); + //painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), QApplication::screens().at(screennum)->grabWindow(QX11Info::appRootWindow(), rec.x(), rec.y(), rec.width(), rec.height()) ); } QWidget::paintEvent(event); //now pass the event along to the normal painting event } @@ -342,7 +348,7 @@ void LPanel::enterEvent(QEvent *event){ this->move(showpoint); this->update(); } - this->activateWindow(); + //this->activateWindow(); event->accept(); //just to quiet the compile warning } @@ -355,5 +361,6 @@ void LPanel::leaveEvent(QEvent *event){ //qDebug() << "Mouse Point (local):" << pt.x() << pt.y(); qDebug() << "Contained:" << this->geometry().contains(pt);*/ checkPanelFocus(); - event->accept(); //just to quiet the compile warning + QWidget::leaveEvent(event); + //event->accept(); //just to quiet the compile warning } -- cgit From 522e8444ec27ff825a33d7447a0011cc8b5749c1 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 11 Nov 2016 17:31:40 -0500 Subject: Fix up the panel autohide routine so it actually resizes the panels instead of just moving them around. --- src-qt5/core/lumina-desktop/LPanel.cpp | 44 ++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 933dc778..62534acb 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -121,6 +121,7 @@ void LPanel::UpdatePanel(bool geomonly){ layout->setDirection(QBoxLayout::TopToBottom); } int ht = qRound(settings->value(PPREFIX+"height", 30).toDouble()); //this is technically the distance into the screen from the edge + fullwidth = ht; //save this for later if(ht<=1){ ht = 30; } //some kind of error in the saved height - use the default value int hidesize = qRound(ht*0.01); //use 1% of the panel size if(hidesize<2){ hidesize=2; } //minimum of 2 pixels (need space for the mouse to go over it) @@ -151,9 +152,10 @@ void LPanel::UpdatePanel(bool geomonly){ if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "top"); } else{ LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc, yloc, this->width(), hidesize), "top"); - hidepoint = QPoint(xloc, yloc+hidesize-ht); + hidepoint = QPoint(xloc, yloc); showpoint = QPoint(xloc, yloc); - this->move(hidepoint); //Could bleed over onto the screen above + this->move(hidepoint); + this->resize( this->width(), viswidth); } }else if(loc=="bottom"){ //bottom of screen QSize sz = QSize(xwid*panelPercent, ht); @@ -169,6 +171,7 @@ void LPanel::UpdatePanel(bool geomonly){ hidepoint = QPoint(xloc, yloc+xhi-hidesize); showpoint = QPoint(xloc, yloc+xhi-ht); this->move(hidepoint); //Could bleed over onto the screen below + this->resize( this->width(), viswidth); } }else if(loc=="left"){ //left side of screen QSize sz = QSize(ht, xhi*panelPercent); @@ -181,9 +184,10 @@ void LPanel::UpdatePanel(bool geomonly){ if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "left"); } else{ LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc, yloc, hidesize, sz.height()), "left"); - hidepoint = QPoint(xloc-ht+hidesize, yloc); + hidepoint = QPoint(xloc, yloc); showpoint = QPoint(xloc, yloc); this->move(hidepoint); //Could bleed over onto the screen left + this->resize( viswidth, this->height()); } }else{ //right side of screen QSize sz = QSize(ht, xhi*panelPercent); @@ -199,6 +203,7 @@ void LPanel::UpdatePanel(bool geomonly){ hidepoint = QPoint(xloc+xwid-hidesize, yloc); showpoint = QPoint(xloc+xwid-ht, yloc); this->move(hidepoint); //Could bleed over onto the screen right + this->resize( viswidth, this->height()); } } if(DEBUG){ qDebug() << " - Done with panel geometry"; } @@ -265,7 +270,7 @@ void LPanel::UpdatePanel(bool geomonly){ i--; //make sure we don't miss the next item with the re-order } } - LSession::processEvents(); + //LSession::processEvents(); } //Now remove any extra plugins from the end //qDebug() << "plugins:" << plugins; @@ -279,7 +284,7 @@ void LPanel::UpdatePanel(bool geomonly){ } layout->takeAt(i); //remove from the layout PLUGINS.takeAt(i)->deleteLater(); //delete the actual widget - LSession::processEvents(); + //LSession::processEvents(); i--; //need to back up one space to not miss another plugin } this->update(); @@ -289,7 +294,8 @@ void LPanel::UpdatePanel(bool geomonly){ for(int i=0; isize(); if( !this->geometry().contains(QCursor::pos()) ){ //Move the panel back to it's "hiding" spot - if(hidden){ this->move(hidepoint); this->update(); } + if(hidden){ + QSize sz(horizontal ? this->width() : viswidth, horizontal ? viswidth : this->height() ); + this->setMinimumSize(sz); + this->setMaximumSize(sz); + this->setGeometry( QRect(hidepoint, sz) ); + } //Re-active the old window if(LSession::handle()->activeWindow()!=0){ LSession::handle()->XCB->ActivateWindow(LSession::handle()->activeWindow()); } + }else if(hidden){ + QSize sz(horizontal ? this->width() : fullwidth, horizontal ? fullwidth : this->height() ); + this->setMinimumSize(sz); + this->setMaximumSize(sz); + this->setGeometry( QRect(showpoint, sz) ); } } @@ -324,10 +341,15 @@ void LPanel::checkPanelFocus(){ //=========== // PROTECTED //=========== +void LPanel::resizeEvent(QResizeEvent *event){ + QWidget::resizeEvent(event); + for(int i=0; iOrientationChange(); } +} + void LPanel::paintEvent(QPaintEvent *event){ if(!hascompositer){ QPainter *painter = new QPainter(this); - //qDebug() << "Paint Panel:" << PPREFIX; + qDebug() << "Paint Panel:" << PPREFIX; //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow QRect rec = event->rect();//this->geometry(); //start with the global geometry of the panel rec.adjust(-1,-1,2,2); //add 1 more pixel on each side @@ -343,11 +365,13 @@ void LPanel::paintEvent(QPaintEvent *event){ void LPanel::enterEvent(QEvent *event){ //qDebug() << "Panel Enter Event:"; - if(hidden){ + checkPanelFocus(); + /*if(hidden){ //Move the panel out so it is fully available this->move(showpoint); + this->resize( horizontal ? this->width() : fullwidth, horizontal ? fullwidth : this->height() ); this->update(); - } + }*/ //this->activateWindow(); event->accept(); //just to quiet the compile warning } -- cgit From 3464e681e6eebe8022b75750405770e8dfe7db87 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Sat, 12 Nov 2016 09:19:29 -0500 Subject: Speed up the initial loading of the desktop at start, and delay the auto-started apps by 1/2 second. --- src-qt5/core/lumina-desktop/LPanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-desktop/LPanel.cpp') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 62534acb..43584ffc 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -67,7 +67,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ //this->setWindowOpacity(0.5); //fully transparent background for the main widget //panelArea->setWindowOpacity(1.0); //fully opaque for the widget on top (apply stylesheet transparencies) } - QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread + QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes } @@ -246,7 +246,7 @@ void LPanel::UpdatePanel(bool geomonly){ //Make sure the plugin layout has the correct orientation if(horizontal){PLUGINS[p]->layout()->setDirection(QBoxLayout::LeftToRight); } else{ PLUGINS[p]->layout()->setDirection(QBoxLayout::TopToBottom); } - QTimer::singleShot(0,PLUGINS[p], SLOT( OrientationChange() ) ); + PLUGINS[p]->OrientationChange(); //Now check the location of the plugin in the panel if(p!=i){ //wrong place in the panel layout->takeAt(p); //remove the item from the current location -- cgit