aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop')
-rw-r--r--src-qt5/core/lumina-desktop/LDesktop.cpp75
-rw-r--r--src-qt5/core/lumina-desktop/LDesktop.h8
-rw-r--r--src-qt5/core/lumina-desktop/LPanel.cpp40
-rw-r--r--src-qt5/core/lumina-desktop/LPanel.h6
-rw-r--r--src-qt5/core/lumina-desktop/LSession.cpp5
5 files changed, 77 insertions, 57 deletions
diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp
index 5031fb96..de7d086e 100644
--- a/src-qt5/core/lumina-desktop/LDesktop.cpp
+++ b/src-qt5/core/lumina-desktop/LDesktop.cpp
@@ -17,12 +17,12 @@
#define DEBUG 0
LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){
- QString screenID = QApplication::screens().at(deskNum)->name();
+ screenID = QApplication::screens().at(deskNum)->name();
DPREFIX = "desktop-"+screenID+"/";
- desktopnumber = deskNum;
- desktop = QApplication::desktop();
+ //desktopnumber = deskNum;
+ //desktop = QApplication::desktop();
defaultdesktop = setdefault; //(desktop->screenGeometry(desktopnumber).x()==0);
- desktoplocked = true;
+ //desktoplocked = true;
issyncing = bgupdating = false;
usewinmenu=false;
@@ -45,7 +45,11 @@ LDesktop::~LDesktop(){
}
int LDesktop::Screen(){
- return desktopnumber;
+ QList<QScreen*> scrns = QApplication::screens();
+ for(int i=0; i<scrns.length(); i++){
+ if(scrns[i]->name()==screenID){ return i; }
+ }
+ return -1;
}
void LDesktop::show(){
@@ -65,7 +69,7 @@ void LDesktop::prepareToClose(){
issyncing = true; //Stop handling any watcher events
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->prepareToClose(); PANELS.takeAt(i)->deleteLater(); i--; }
//Now close down any desktop plugins
- desktoplocked = true; //make sure that plugin settings are preserved during removal
+ //desktoplocked = true; //make sure that plugin settings are preserved during removal
//Remove all the current containers
bgDesktop->cleanup();
}
@@ -80,17 +84,20 @@ QRect LDesktop::availableScreenGeom(){
if(bgDesktop!=0){
return globalWorkRect; //saved from previous calculations
}else{
- return LSession::handle()->screenGeom(desktopnumber);
+ return LSession::handle()->screenGeom( Screen() );
}
}
void LDesktop::UpdateGeometry(){
//First make sure there is something different about the geometry
- //if(desktop->screenGeometry(desktopnumber)==bgWindow->geometry()){ return; }
+ //if(desktop->screenGeometry(Screen())==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() << "Changing Desktop Geom:" << Screen();
+ //bgWindow->setGeometry(desktop->screenGeometry(Screen()));
+ /*for(int i=0; i<PANELS.length(); i++){
+ PANELS[i]->UpdatePanel(true); //geom only updates - do this before adjusting the background
+ }*/
//qDebug() << " - Update Desktop Plugin Area";
UpdateDesktopPluginArea();
//qDebug() << " - Done With Desktop Geom Updates";
@@ -129,7 +136,7 @@ void LDesktop::checkResolution(){
//NOTE: This is only run the first time this desktop is created (before loading all the interface) - not on each desktop change
int oldWidth = settings->value(DPREFIX+"screen/lastWidth",-1).toInt();
int oldHeight = settings->value(DPREFIX+"screen/lastHeight",-1).toInt();
- QRect scrn = LSession::handle()->screenGeom(desktopnumber);
+ QRect scrn = LSession::handle()->screenGeom( Screen() );
if(scrn.isNull()){ return; }
issyncing = true;
settings->setValue(DPREFIX+"screen/lastWidth",scrn.width());
@@ -145,14 +152,14 @@ void LDesktop::checkResolution(){
double xscale = scrn.width()/((double) oldWidth);
double yscale = scrn.height()/((double) oldHeight);
if(DEBUG){
- qDebug() << "Screen Resolution Changed:" << desktopnumber;
+ qDebug() << "Screen Resolution Changed:" << screenID;
qDebug() << " - Old:" << QString::number(oldWidth)+"x"+QString::number(oldHeight);
qDebug() << " - New:" << QString::number(scrn.width())+"x"+QString::number(scrn.height());
qDebug() << " - Scale Factors:" << xscale << yscale;
}
//Update any panels in the config file
for(int i=0; i<4; i++){
- QString PPREFIX = "panel"+QString::number(desktopnumber)+"."+QString::number(i)+"/";
+ QString PPREFIX = "panel"+QString::number(Screen())+"."+QString::number(i)+"/";
int ht = settings->value(PPREFIX+"height",-1).toInt();
if(ht<1){ continue; } //no panel height defined
QString loc = settings->value(PPREFIX+"location","top").toString().toLower();
@@ -195,9 +202,9 @@ void LDesktop::checkResolution(){
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; }
+ if(DEBUG){ qDebug() << "Init Desktop:" << Screen(); }
//connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
- if(DEBUG){ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber) << LSession::handle()->screenGeom(desktopnumber); }
+ if(DEBUG){ qDebug() << "Desktop #"<<Screen()<<" -> "<< LSession::desktop()->screenGeometry(Screen()) << LSession::handle()->screenGeom(Screen()); }
deskMenu = new QMenu(0);
connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
winMenu = new QMenu(0);
@@ -216,7 +223,6 @@ void LDesktop::InitDesktop(){
connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(UpdateDesktop()) );
connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChanged()) );
connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(UpdateBackground()) );
-
//if(DEBUG){ qDebug() << "Create bgWindow"; }
/*bgWindow = new QWidget(); //LDesktopBackground();
bgWindow->setObjectName("bgWindow");
@@ -224,13 +230,13 @@ void LDesktop::InitDesktop(){
bgWindow->setFocusPolicy(Qt::StrongFocus);
bgWindow->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
LSession::handle()->XCB->SetAsDesktop(bgWindow->winId());
- bgWindow->setGeometry(LSession::handle()->screenGeom(desktopnumber));
+ bgWindow->setGeometry(LSession::handle()->screenGeom(Screen()));
bgWindow->setWindowOpacity(0.0);
connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );*/
if(DEBUG){ qDebug() << "Create bgDesktop"; }
bgDesktop = new LDesktopPluginSpace();
int grid = settings->value(DPREFIX+"GridSize",-1).toInt();
- if(grid<0 &&desktop->screenGeometry(desktopnumber).height() > 2000){ grid = 200; }
+ if(grid<0 && LSession::desktop()->screenGeometry(Screen()).height() > 2000){ grid = 200; }
else if(grid<0){ grid = 100; }
bgDesktop->SetIconSize( grid );
bgDesktop->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -240,7 +246,7 @@ void LDesktop::InitDesktop(){
connect(bgDesktop, SIGNAL(DecreaseIcons()), this, SLOT(DecreaseDesktopPluginIcons()) );
connect(bgDesktop, SIGNAL(HideDesktopMenu()), deskMenu, SLOT(hide()));
connect(bgDesktop, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );
- if(DEBUG){ qDebug() << " - Desktop Init Done:" << desktopnumber; }
+ if(DEBUG){ qDebug() << " - Desktop Init Done:" << screenID; }
//Start the update processes
QTimer::singleShot(10,this, SLOT(UpdateMenu()) );
QTimer::singleShot(0,this, SLOT(UpdateBackground()) );
@@ -251,7 +257,7 @@ void LDesktop::InitDesktop(){
void LDesktop::SettingsChanged(){
if(issyncing){ return; } //don't refresh for internal modifications to the
issyncing = true;
- qDebug() << "Found Settings Change:" << desktopnumber;
+ qDebug() << "Found Settings Change:" << screenID;
settings->sync(); //make sure to sync with external settings changes
UpdateBackground();
UpdateDesktop();
@@ -267,7 +273,7 @@ void LDesktop::LocaleChanged(){
}
void LDesktop::UpdateMenu(bool fast){
- if(DEBUG){ qDebug() << " - Update Menu:" << desktopnumber; }
+ if(DEBUG){ qDebug() << " - Update Menu:" << screenID; }
//Put a label at the top
int num = LSession::handle()->XCB->CurrentWorkspace(); //LX11::GetCurrentDesktop();
if(DEBUG){ qDebug() << "Found workspace number:" << num; }
@@ -334,7 +340,7 @@ void LDesktop::winClicked(QAction* act){
}
void LDesktop::UpdateDesktop(){
- if(DEBUG){ qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber; }
+ if(DEBUG){ qDebug() << " - Update Desktop Plugins for screen:" << screenID; }
QStringList plugins = settings->value(DPREFIX+"pluginlist", QStringList()).toStringList();
if(defaultdesktop && plugins.isEmpty()){
//plugins << "sample" << "sample" << "sample";
@@ -344,10 +350,11 @@ void LDesktop::UpdateDesktop(){
for(int i=0; i<plugins.length(); i++){
if(!plugins[i].contains("---") ){
int num=1;
- while( plugins.contains(plugins[i]+"---"+QString::number(desktopnumber)+"."+QString::number(num)) ){
+ while( plugins.contains(plugins[i]+"---"+QString::number(Screen())+"."+QString::number(num)) ){
num++;
}
- plugins[i] = plugins[i]+"---"+QString::number(desktopnumber)+"."+QString::number(num);
+ plugins[i] = plugins[i]+"---"+screenID+"."+QString::number(num);
+ //plugins[i] = plugins[i]+"---"+QString::number(Screen())+"."+QString::number(num);
changed=true;
}
}
@@ -385,7 +392,7 @@ void LDesktop::RemoveDeskPlugin(QString ID){
void LDesktop::IncreaseDesktopPluginIcons(){
int cur = settings->value(DPREFIX+"GridSize",-1).toInt();
- if(cur<0 && desktop->screenGeometry(desktopnumber).height() > 2000){ cur = 200; }
+ if(cur<0 &&LSession::desktop()->screenGeometry(Screen()).height() > 2000){ cur = 200; }
else if(cur<0){ cur = 100; }
cur+=16;
issyncing=true; //don't let the change cause a refresh
@@ -397,7 +404,7 @@ void LDesktop::IncreaseDesktopPluginIcons(){
void LDesktop::DecreaseDesktopPluginIcons(){
int cur = settings->value(DPREFIX+"GridSize",-1).toInt();
- if(cur<0 && desktop->screenGeometry(desktopnumber).height() > 2000){ cur = 200; }
+ if(cur<0 &&LSession::desktop()->screenGeometry(Screen()).height() > 2000){ cur = 200; }
else if(cur<0){ cur = 100; }
if(cur<32){ return; } //cannot get smaller than 16x16
cur-=16;
@@ -409,7 +416,7 @@ void LDesktop::DecreaseDesktopPluginIcons(){
}
void LDesktop::UpdatePanels(){
- if(DEBUG){ qDebug() << " - Update Panels For Screen:" << desktopnumber; }
+ if(DEBUG){ qDebug() << " - Update Panels For Screen:" << Screen(); }
int panels = settings->value(DPREFIX+"panels", -1).toInt();
//if(panels==-1 && defaultdesktop){ panels=1; } //need at least 1 panel on the primary desktop
//Remove all extra panels
@@ -435,7 +442,7 @@ void LDesktop::UpdatePanels(){
if(!found){
if(DEBUG){ qDebug() << " -- Create panel "<< i; }
//New panel
- LPanel *pan = new LPanel(settings, desktopnumber, i, bgDesktop);
+ LPanel *pan = new LPanel(settings, screenID, i, bgDesktop);
PANELS << pan;
pan->show();
}
@@ -445,7 +452,7 @@ void LDesktop::UpdatePanels(){
}
void LDesktop::UpdateDesktopPluginArea(){
- QRegion visReg( desktop->screenGeometry(desktopnumber) ); //visible region (not hidden behind a panel)
+ QRegion visReg(LSession::desktop()->screenGeometry(Screen()) ); //visible region (not hidden behind a panel)
QRect rawRect = visReg.boundingRect(); //initial value (screen size)
//qDebug() << "Update Desktop Plugin Area:" << bgWindow->geometry();
for(int i=0; i<PANELS.length(); i++){
@@ -470,13 +477,13 @@ void LDesktop::UpdateDesktopPluginArea(){
//Now make sure the desktop plugin area is only the visible area
QRect rec = visReg.boundingRect();
//qDebug() << " - DPArea: Panel-Adjusted rectangle:" << rec;
- //LSession::handle()->XCB->SetScreenWorkArea((unsigned int) desktopnumber, rec);
+ //LSession::handle()->XCB->SetScreenWorkArea((unsigned int) Screen(), rec);
//Now remove the X offset to place it on the current screen (needs widget-coords, not global)
globalWorkRect = rec; //save this for later
- rec.moveTopLeft( QPoint( rec.x()-desktop->screenGeometry(desktopnumber).x() , rec.y()-desktop->screenGeometry(desktopnumber).y() ) );
+ rec.moveTopLeft( QPoint( rec.x()-LSession::desktop()->screenGeometry(Screen()).x() , rec.y()-LSession::desktop()->screenGeometry(Screen()).y() ) );
//qDebug() << "DPlug Area:" << rec << bgDesktop->geometry() << LSession::handle()->desktop()->availableGeometry(bgDesktop);
if(rec.size().isNull() || rec == bgDesktop->geometry()){return; } //nothing changed
- bgDesktop->setGeometry(desktop->screenGeometry(desktopnumber));
+ bgDesktop->setGeometry( LSession::desktop()->screenGeometry(Screen()));
bgDesktop->setDesktopArea( rec );
bgDesktop->UpdateGeom(); //just in case the plugin space itself needs to do anything
QTimer::singleShot(10, this, SLOT(UpdateBackground()) );
@@ -490,7 +497,7 @@ void LDesktop::UpdateBackground(){
//Get the current Background
if(bgupdating || bgDesktop==0){ return; } //prevent multiple calls to this at the same time
bgupdating = true;
- if(DEBUG){ qDebug() << " - Update Desktop Background for screen:" << desktopnumber; }
+ if(DEBUG){ qDebug() << " - Update Desktop Background for screen:" << Screen(); }
//Get the list of background(s) to show
QStringList bgL = settings->value(DPREFIX+"background/filelist-workspace-"+QString::number( LSession::handle()->XCB->CurrentWorkspace()), QStringList()).toStringList();
if(bgL.isEmpty()){ bgL = settings->value(DPREFIX+"background/filelist", QStringList()).toStringList(); }
@@ -525,7 +532,7 @@ void LDesktop::UpdateBackground(){
//Now set this file as the current background
QString format = settings->value(DPREFIX+"background/format","stretch").toString();
//bgWindow->setBackground(bgFile, format);
- QPixmap backPix = LDesktopBackground::setBackground(bgFile, format, LSession::handle()->screenGeom(desktopnumber));
+ QPixmap backPix = LDesktopBackground::setBackground(bgFile, format, LSession::handle()->screenGeom(Screen()));
bgDesktop->setBackground(backPix);
//Now reset the timer for the next change (if appropriate)
if(bgtimer->isActive()){ bgtimer->stop(); }
diff --git a/src-qt5/core/lumina-desktop/LDesktop.h b/src-qt5/core/lumina-desktop/LDesktop.h
index 378db75b..b6034c18 100644
--- a/src-qt5/core/lumina-desktop/LDesktop.h
+++ b/src-qt5/core/lumina-desktop/LDesktop.h
@@ -61,11 +61,11 @@ public slots:
private:
QSettings *settings;
QTimer *bgtimer;
- QDesktopWidget *desktop;
- QString DPREFIX;
- int desktopnumber;
+ //QDesktopWidget *desktop;
+ QString DPREFIX, screenID;
+ //int desktopnumber;
QRegion availDPArea;
- bool defaultdesktop, desktoplocked, issyncing, usewinmenu, bgupdating;
+ bool defaultdesktop, issyncing, usewinmenu, bgupdating;
QStringList oldBGL;
QList<LPanel*> PANELS;
LDesktopPluginSpace *bgDesktop; //desktop plugin area
diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp
index 43584ffc..2330d6b5 100644
--- a/src-qt5/core/lumina-desktop/LPanel.cpp
+++ b/src-qt5/core/lumina-desktop/LPanel.cpp
@@ -12,7 +12,7 @@
#define DEBUG 0
-LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
+LPanel::LPanel(QSettings *file, QString scr, int num, QWidget *parent) : QWidget(){
//Take care of inputs
this->setMouseTracking(true);
hascompositer = false; //LUtils::isValidBinary("xcompmgr"); //NOT WORKING YET - xcompmgr issue with special window flags?
@@ -26,12 +26,12 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
this->setLayout(tmp);
tmp->addWidget(panelArea);
settings = file;
- screennum = scr;
+ screenID = scr;
panelnum = num; //save for later
screen = LSession::desktop();
- QString screenID = QApplication::screens().at(screennum)->name();
+ QString screenID = QApplication::screens().at(Screen())->name();
PPREFIX = "panel_"+screenID+"."+QString::number(num)+"/";
- defaultpanel = (LSession::handle()->screenGeom(screennum).x()==0 && num==0);
+ defaultpanel = (LSession::handle()->screenGeom(Screen()).x()==0 && num==0);
horizontal=true; //use this by default initially
hidden = false; //use this by default
//Setup the panel
@@ -75,6 +75,15 @@ LPanel::~LPanel(){
}
+int LPanel::Screen(){
+ // Find the screen number associated with this ID
+ QList<QScreen*> scrns = QApplication::screens();
+ for(int i=0; i<scrns.length(); i++){
+ if(scrns[i]->name() == screenID){ return i; }
+ }
+ return -1;
+}
+
void LPanel::prepareToClose(){
//Go through and remove all the plugins
for(int i=0; i<PLUGINS.length(); i++){
@@ -107,7 +116,7 @@ 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: Geometry only=" << geomonly << "Screen Size:" << LSession::handle()->screenGeom(screennum); }
+ if(DEBUG){ qDebug() << "Update Panel: Geometry only=" << geomonly << "Screen Size:" << LSession::handle()->screenGeom(Screen()); }
hidden = settings->value(PPREFIX+"hidepanel",false).toBool();
QString loc = settings->value(PPREFIX+"location","").toString().toLower();
if(loc.isEmpty() && defaultpanel){ loc="top"; }
@@ -129,10 +138,10 @@ void LPanel::UpdatePanel(bool geomonly){
else{ viswidth = ht; }
if(DEBUG){ qDebug() << "Hidden Panel size:" << hidesize << "pixels"; }
//qDebug() << " - set Geometry";
- int xwid = LSession::handle()->screenGeom(screennum).width();
- int xhi = LSession::handle()->screenGeom(screennum).height();
- int xloc = LSession::handle()->screenGeom(screennum).x();
- int yloc = LSession::handle()->screenGeom(screennum).y();
+ int xwid = LSession::handle()->screenGeom(Screen()).width();
+ int xhi = LSession::handle()->screenGeom(Screen()).height();
+ int xloc = LSession::handle()->screenGeom(Screen()).x();
+ int yloc = LSession::handle()->screenGeom(Screen()).y();
double panelPercent = settings->value(PPREFIX+"lengthPercent",100).toInt();
if(panelPercent<1 || panelPercent>100){ panelPercent = 100; }
panelPercent = panelPercent/100.0;
@@ -231,11 +240,11 @@ void LPanel::UpdatePanel(bool geomonly){
//Ensure this plugin has a unique ID (NOTE: this numbering does not persist between sessions)
if(!plugins[i].contains("---")){
int num=1;
- while( plugins.contains(plugins[i]+"---"+QString::number(screennum)+"."+QString::number(this->number())+"."+QString::number(num)) ){
+ while( plugins.contains(plugins[i]+"---"+QString::number(Screen())+"."+QString::number(this->number())+"."+QString::number(num)) ){
num++;
}
- plugins[i] = plugins[i]+"---"+QString::number(screennum)+"."+QString::number(this->number())+"."+QString::number(num);
+ plugins[i] = plugins[i]+"---"+QString::number(Screen())+"."+QString::number(this->number())+"."+QString::number(num);
//qDebug() << "Adjust Plugin ID:" << plugins[i];
}
//See if this plugin is already there or in a different spot
@@ -334,8 +343,7 @@ void LPanel::checkPanelFocus(){
this->setMinimumSize(sz);
this->setMaximumSize(sz);
this->setGeometry( QRect(showpoint, sz) );
- }
-
+ }
}
//===========
@@ -349,16 +357,16 @@ void LPanel::resizeEvent(QResizeEvent *event){
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
//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() );
+ rec.moveTo( bgWindow->mapFromGlobal( this->mapToGlobal(rec.topLeft()) ) ); //(rec.x()-LSession::handle()->screenGeom(Screen()).x(), rec.y()-LSession::handle()->screenGeom(Screen()).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), QApplication::screens().at(screennum)->grabWindow(QX11Info::appRootWindow(), rec.x(), rec.y(), rec.width(), rec.height()) );
+ //painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), QApplication::screens().at(Screen())->grabWindow(QX11Info::appRootWindow(), rec.x(), rec.y(), rec.width(), rec.height()) );
}
QWidget::paintEvent(event); //now pass the event along to the normal painting event
}
diff --git a/src-qt5/core/lumina-desktop/LPanel.h b/src-qt5/core/lumina-desktop/LPanel.h
index 2828161c..bcea8eaf 100644
--- a/src-qt5/core/lumina-desktop/LPanel.h
+++ b/src-qt5/core/lumina-desktop/LPanel.h
@@ -38,13 +38,15 @@ private:
//QRect hidegeom, showgeom; //for hidden panels
QPoint hidepoint, showpoint; //for hidden panels: locations when hidden/visible
bool defaultpanel, horizontal, hidden, hascompositer;
- int screennum;
+ QString screenID;
int panelnum;
int viswidth, fullwidth;
QList<LPPlugin*> PLUGINS;
+ int Screen(); //Turn the screenID into the appropriate number
+
public:
- LPanel(QSettings *file, int scr = 0, int num =0, QWidget *parent=0); //settings file, screen number, panel number
+ LPanel(QSettings *file, QString scr = 0, int num =0, QWidget *parent=0); //settings file, screen number, panel number
~LPanel();
int number(){
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp
index 0b5d9409..0387555a 100644
--- a/src-qt5/core/lumina-desktop/LSession.cpp
+++ b/src-qt5/core/lumina-desktop/LSession.cpp
@@ -63,6 +63,9 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
//Setup the event filter for Qt5
evFilter = new XCBEventFilter(this);
this->installNativeEventFilter( evFilter );
+ connect(this, SIGNAL(screenAdded(QScreen*)), this, SLOT(screensChanged()) );
+ connect(this, SIGNAL(screenRemoved(QScreen*)), this, SLOT(screensChanged()) );
+ connect(this, SIGNAL(primaryScreenChanged(QScreen*)), this, SLOT(screensChanged()) );
} //end check for primary process
}
@@ -404,7 +407,7 @@ void LSession::updateDesktops(){
QList<int> dnums; //keep track of which screens are already managed
QList<QRect> geoms;
for(int i=0; i<DESKTOPS.length(); i++){
- if (DESKTOPS[i]->Screen() >= sC || geoms.contains(DW->screenGeometry(DESKTOPS[i]->Screen())) ) {
+ if ( DESKTOPS[i]->Screen() < 0 || DESKTOPS[i]->Screen() >= sC || geoms.contains(DW->screenGeometry(DESKTOPS[i]->Screen())) ) {
//qDebug() << " - Close desktop:" << i;
qDebug() << " - Close desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->prepareToClose();
bgstack15