aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-07-28 14:21:48 -0400
committerKen Moore <moorekou@gmail.com>2015-07-28 14:21:48 -0400
commit33b2e0ec1c3810ccfac177e311fea2b03db8e47c (patch)
tree013ac6fdd53507cd97b9f7dc8698a6fdc5154bfa /lumina-desktop
parentJust a minor update to some debugging (when turned on) for checking icons wit... (diff)
downloadlumina-33b2e0ec1c3810ccfac177e311fea2b03db8e47c.tar.gz
lumina-33b2e0ec1c3810ccfac177e311fea2b03db8e47c.tar.bz2
lumina-33b2e0ec1c3810ccfac177e311fea2b03db8e47c.zip
Add some work that make the Lumina desktop/panels appear in the proper locations when XINERAMA is used for combining monitors. However, the interface is still completely unresponsive because the Qt backend is completely screwed up by Xinerama (returns 0's for everything related to screens, geometries, etc, preventing menus from opening up even when manually started). This might be something where we just have to say that Xinerama is not supported for Lumina (at least until lumina-wm get finished up).
Diffstat (limited to 'lumina-desktop')
-rw-r--r--lumina-desktop/LDesktop.cpp13
-rw-r--r--lumina-desktop/LDesktop.h6
-rw-r--r--lumina-desktop/LPanel.cpp10
-rw-r--r--lumina-desktop/LSession.cpp28
-rw-r--r--lumina-desktop/LSession.h3
5 files changed, 44 insertions, 16 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index 9a8c2a6b..31ac47c3 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -85,7 +85,7 @@ QRect LDesktop::availableScreenGeom(){
if(bgDesktop!=0){
return globalWorkRect; //saved from previous calculations
}else{
- return desktop->screenGeometry(desktopnumber);
+ return LSession::handle()->screenGeom(desktopnumber);
}
}
@@ -119,7 +119,8 @@ 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::desktop()->screenGeometry(desktopnumber);
+ QRect scrn = LSession::handle()->screenGeom(desktopnumber);
+ if(scrn.isNull()){ return; }
issyncing = true;
settings->setValue(DPREFIX+"screen/lastWidth",scrn.width());
settings->setValue(DPREFIX+"screen/lastHeight",scrn.height());
@@ -268,7 +269,7 @@ void LDesktop::InitDesktop(){
checkResolution(); //Adjust the desktop config file first (if necessary)
if(DEBUG){ qDebug() << "Init Desktop:" << desktopnumber; }
connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
- if(DEBUG){ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height(); }
+ 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*)) );
winMenu = new QMenu(0);
@@ -293,8 +294,8 @@ void LDesktop::InitDesktop(){
bgWindow->setContextMenuPolicy(Qt::CustomContextMenu);
bgWindow->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
LSession::handle()->XCB->SetAsDesktop(bgWindow->winId());
- bgWindow->setGeometry(desktop->screenGeometry(desktopnumber));
- connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );
+ bgWindow->setGeometry(LSession::handle()->screenGeom(desktopnumber));
+ connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu(const QPoint&)) );
if(DEBUG){ qDebug() << "Create bgDesktop"; }
bgDesktop = new QMdiArea(bgWindow);
//Make sure the desktop area is transparent to show the background
@@ -430,7 +431,7 @@ void LDesktop::UpdateDesktop(){
}
}
//Now get an accounting of all the available/used space (overwriting the private variable)
- QSize ssize = desktop->screenGeometry(desktopnumber).size();
+ QSize ssize = LSession::handle()->screenGeom(desktopnumber).size();
//qDebug() << "Screen Size:" << ssize << desktopnumber;
if(bgDesktop->isVisible() && ( (bgDesktop->size().height() <= ssize.height()) && (bgDesktop->size().width() <= ssize.width()) )){ ssize = bgDesktop->size(); qDebug() << " - Adjusted:" << ssize; }
availDPArea = QRegion(QRect(QPoint(0,0), ssize)); //Note that this is child-geometry space
diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h
index c602b3f2..c2089c7b 100644
--- a/lumina-desktop/LDesktop.h
+++ b/lumina-desktop/LDesktop.h
@@ -85,9 +85,11 @@ private slots:
//Menu functions
void UpdateMenu(bool fast = false);
- void ShowMenu(){
+ void ShowMenu(const QPoint &pt = QPoint()){
UpdateMenu(true); //run the fast version
- deskMenu->popup(QCursor::pos());
+ qDebug() << "Show Context Menu:" << QCursor::pos() << pt;
+ if(pt.isNull()){ deskMenu->popup(QCursor::pos()); }
+ else{ deskMenu->popup(pt); }
}
void UpdateWinMenu();
void winClicked(QAction*);
diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp
index 94db8ce0..7767d004 100644
--- a/lumina-desktop/LPanel.cpp
+++ b/lumina-desktop/LPanel.cpp
@@ -27,7 +27,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
panelnum = num; //save for later
screen = LSession::desktop();
PPREFIX = "panel"+QString::number(screennum)+"."+QString::number(num)+"/";
- defaultpanel = (screen->screenGeometry(screennum).x()==0 && num==0);
+ defaultpanel = (LSession::handle()->screenGeom(screennum).x()==0 && num==0);
horizontal=true; //use this by default initially
hidden = false; //use this by default
//Setup the panel
@@ -115,9 +115,9 @@ void LPanel::UpdatePanel(){
else{ viswidth = ht; }
if(DEBUG){ qDebug() << "Hidden Panel size:" << hidesize << "pixels"; }
//qDebug() << " - set Geometry";
- int xwid = screen->screenGeometry(screennum).width();
- int xhi = screen->screenGeometry(screennum).height();
- int xloc = screen->screenGeometry(screennum).x();
+ int xwid = LSession::handle()->screenGeom(screennum).width();
+ int xhi = LSession::handle()->screenGeom(screennum).height();
+ int xloc = LSession::handle()->screenGeom(screennum).x();
double panelPercent = settings->value(PPREFIX+"lengthPercent",100).toInt();
if(panelPercent<1 || panelPercent>100){ panelPercent = 100; }
panelPercent = panelPercent/100.0;
@@ -303,7 +303,7 @@ void LPanel::paintEvent(QPaintEvent *event){
if(hidden && (this->pos()==hidepoint) ){ rec.moveTo( this->mapToGlobal(rec.topLeft()-hidepoint+showpoint) ); }
else{ rec.moveTo( this->mapToGlobal(rec.topLeft()) ); }
//qDebug() << "Global Rec:" << rec.x() << rec.y() << screennum;
- rec.moveTo( rec.x()-screen->screenGeometry(screennum).x(), rec.y() );
+ rec.moveTo( rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y() );
//qDebug() << "Adjusted Global Rec:" << rec.x() << rec.y();
painter->drawPixmap(event->rect(), bgWindow->grab(rec) );
QWidget::paintEvent(event); //now pass the event along to the normal painting event
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 6edfe5a4..1747154d 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -8,6 +8,7 @@
#include <LuminaOS.h>
#include <QTime>
+#include <QScreen>
#include "LXcbEventFilter.h"
#include "BootSplash.h"
@@ -110,7 +111,9 @@ void LSession::setupSession(){
//Initialize the internal variables
DESKTOPS.clear();
-
+ savedScreens.clear();
+ for(int i=0; i<this->desktop()->screenCount(); i++){ savedScreens << this->desktop()->screenGeometry(i); }
+
//Start the background system tray
splash.showScreen("systray");
if(DEBUG){ qDebug() << " - Init System Tray:" << timer->elapsed();}
@@ -431,7 +434,9 @@ void LSession::updateDesktops(){
//qDebug() << " - Update Desktops";
QDesktopWidget *DW = this->desktop();
bool firstrun = (DESKTOPS.length()==0);
+ if(!firstrun){ savedScreens.clear(); }
for(int i=0; i<DW->screenCount(); i++){
+ if(!firstrun){ savedScreens << DW->screenGeometry(i); }
bool found = false;
for(int j=0; j<DESKTOPS.length() && !found; j++){
//Match either the screen number or the screen location (preventing duplicates)
@@ -439,7 +444,7 @@ void LSession::updateDesktops(){
}
if(!found){
//Start the desktop on the new screen
- qDebug() << " - Start desktop on screen:" << i;
+ 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{
@@ -452,6 +457,7 @@ void LSession::updateDesktops(){
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()){
qDebug() << " - Close desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->prepareToClose();
@@ -558,6 +564,22 @@ QFileInfoList LSession::DesktopFiles(){
return desktopFiles;
}
+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(geom.isNull() ){
+ if( !scrn->geometry().isNull() ){ geom = scrn->geometry(); }
+ else if( !scrn->virtualGeometry().isNull() ){ geom = scrn->virtualGeometry(); }
+ else if(num < savedScreens.length() ){
+ //Qt is backfiring (Xinarama w/ Fluxbox?) - return the saved geometry
+ geom = savedScreens[num];
+ }
+ }
+ return geom;
+}
+
AppMenu* LSession::applicationMenu(){
return appmenu;
}
@@ -618,7 +640,7 @@ void LSession::WindowPropertyEvent(){
for(int i=0; i<newapps.length() && !TrayStopping; i++){
if(!RunningApps.contains(newapps[i])){
checkWin << newapps[i];
- QTimer::singleShot(500, this, SLOT(checkWindowGeoms()) );
+ QTimer::singleShot(100, this, SLOT(checkWindowGeoms()) );
}
}
}
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index 3a1dabbc..52da2e6f 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -76,6 +76,8 @@ public:
static void LaunchApplication(QString cmd);
QFileInfoList DesktopFiles();
+ QRect screenGeom(int num);
+
AppMenu* applicationMenu();
void systemWindow();
SettingsMenu* settingsMenu();
@@ -105,6 +107,7 @@ private:
QMediaPlayer *mediaObj;
QSettings *sessionsettings, *DPlugSettings;
bool cleansession;
+ QList<QRect> savedScreens;
//System Tray Variables
WId SystemTrayID, VisualTrayID;
bgstack15