aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaX11.cpp19
-rw-r--r--libLumina/LuminaX11.h2
-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
7 files changed, 65 insertions, 16 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp
index ba091771..71346e19 100644
--- a/libLumina/LuminaX11.cpp
+++ b/libLumina/LuminaX11.cpp
@@ -895,6 +895,22 @@ WId LXCB::ActiveWindow(){
}
}
+// === CheckDisableXinerama() ===
+bool LXCB::CheckDisableXinerama(){
+ //returns true if Xinerama was initially set but now disabled
+ return false;
+ // TO-DO - not complete yet
+
+ /*xcb_query_extension_cookie_t cookie = xcb_query_extension_unchecked(QX11Info::connection(), 8, "Xinerama");
+ xcb_query_extension_reply_t *reply = xcb_query_extension_reply(QX11Info::connection(), cookie, NULL);
+
+ if(reply!=0){
+
+ free(reply);
+ }
+ */
+}
+
// === RegisterVirtualRoots() ===
void LXCB::RegisterVirtualRoots(QList<WId> roots){
if(DEBUG){ qDebug() << "XCB: RegisterVirtualRoots()"; }
@@ -1294,6 +1310,7 @@ void LXCB::SetAsPanel(WId win){
}
+// === SetAsDesktop() ===
void LXCB::SetAsDesktop(WId win){
if(DEBUG){ qDebug() << "XCB: SetAsDesktop()"; }
if(win==0){ return; }
@@ -1311,12 +1328,14 @@ void LXCB::CloseWindow(WId win){
xcb_ewmh_request_close_window(&EWMH, 0, win, QX11Info::getTimestamp(), XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER);
}
+// === KillClient() ===
void LXCB::KillClient(WId win){
if(DEBUG){ qDebug() << "XCB: KillClient()"; }
if(win==0){ return; }
//This will forcibly close the application which created WIN
xcb_kill_client(QX11Info::connection(), win);
}
+
// === MinimizeWindow() ===
void LXCB::MinimizeWindow(WId win){ //request that the window be unmapped/minimized
if(DEBUG){ qDebug() << "XCB: MinimizeWindow()"; }
diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h
index d098a740..d41cbca1 100644
--- a/libLumina/LuminaX11.h
+++ b/libLumina/LuminaX11.h
@@ -126,7 +126,9 @@ public:
WId ActiveWindow(); //fetch the ID for the currently active window
//Session Modification
+ bool CheckDisableXinerama(); //returns true if Xinerama was initially set but now disabled
void RegisterVirtualRoots(QList<WId> roots);
+
//Window Information
QString WindowClass(WId);
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