aboutsummaryrefslogtreecommitdiff
path: root/lumina-wm-INCOMPLETE/LWindowManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-wm-INCOMPLETE/LWindowManager.cpp')
-rw-r--r--lumina-wm-INCOMPLETE/LWindowManager.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/lumina-wm-INCOMPLETE/LWindowManager.cpp b/lumina-wm-INCOMPLETE/LWindowManager.cpp
index 725bc18e..14ce6897 100644
--- a/lumina-wm-INCOMPLETE/LWindowManager.cpp
+++ b/lumina-wm-INCOMPLETE/LWindowManager.cpp
@@ -17,6 +17,22 @@ LWindowManager::~LWindowManager(){
}
bool LWindowManager::start(){
+ //Setup the initial screen/session values
+ LWM::SYSTEM->WM_Set_Root_Supported();
+ LWM::SYSTEM->WM_SetNumber_Desktops(1);
+ LWM::SYSTEM->WM_Set_Current_Desktop(0);
+ LWM::SYSTEM->WM_Set_Desktop_Names(QStringList() << "one");
+ QRect totgeom;
+ QList<QPoint> viewports;
+ QList<QRect> geoms;
+ for(int i=0; i<QApplication::desktop()->screenCount(); i++){
+ geoms << QApplication::desktop()->screen(i)->geometry();
+ viewports << QPoint(0,0);
+ totgeom = QApplication::desktop()->screen(i)->geometry();
+ }
+ LWM::SYSTEM->WM_Set_Desktop_Geometry(totgeom.size());
+ LWM::SYSTEM->WM_Set_Desktop_Viewport(viewports);
+ LWM::SYSTEM->WM_Set_Workarea(geoms);
//Should probably do a quick loop over any existing windows with the root as parent (just in case)
QList<WId> initial = LWM::SYSTEM->WM_RootWindows();
for(int i=0; i<initial.length(); i++){
@@ -55,6 +71,7 @@ void LWindowManager::NewWindow(WId win, bool requested){
if(!ok){ return; }
}
if(DEBUG){ qDebug() << "New Managed Window:" << LWM::SYSTEM->WM_ICCCM_GetClass(win); }
+ LWM::SYSTEM->WM_Set_Active_Window(win);
LWindow *lwin = new LWindow(win);
connect(lwin, SIGNAL(Finished(WId)), this, SLOT(FinishedWindow(WId)) );
WINS << lwin;
@@ -69,10 +86,8 @@ void LWindowManager::ClosedWindow(WId win){
for(int i=0; i<WINS.length(); i++){
if(WINS[i]->clientID()==win){
qDebug() << " - Closed Window";
- if(WINS[i]->hasFrame()){ WINS[i]->frame()->windowChanged(LWM::Closed); }
- else{
- FinishedWindow(win);
- }
+ if(WINS[i]->hasFrame()){ WINS[i]->frame()->windowChanged(LWM::Closed); } //do any animations/cleanup
+ else{ FinishedWindow(win); }
break;
}
}
@@ -117,6 +132,14 @@ void LWindowManager::RestackWindows(){
else{ Stack_Normal << id; }
}
}
+ //Active Window management
+ WId active = LWM::SYSTEM->WM_Get_Active_Window();
+ if(Stack_Desktop.contains(active)){ Stack_Desktop.removeAll(active); Stack_Desktop << active; }
+ else if(Stack_Below.contains(active)){ Stack_Below.removeAll(active); Stack_Below << active; }
+ else if(Stack_Normal.contains(active)){ Stack_Normal.removeAll(active); Stack_Normal << active; }
+ else if(Stack_Above.contains(active)){ Stack_Above.removeAll(active); Stack_Above << active; }
+ else if(Stack_Fullscreen.contains(active)){ Stack_Fullscreen.removeAll(active); Stack_Fullscreen << active; }
+
//Now set the root properties for these lists
LWM::SYSTEM->WM_Set_Client_List(currwins, false); //age-ordered version
LWM::SYSTEM->WM_Set_Client_List(QList<WId>() << Stack_Desktop << Stack_Below << Stack_Normal << Stack_Above << Stack_Fullscreen, true); //stacking order version
@@ -150,6 +173,11 @@ void LWindowManager::FinishedWindow(WId win){
for(int i=0; i<WINS.length(); i++){
if(WINS[i]->clientID() == win){
qDebug() << " - Finished Window";
+ if(win == LWM::SYSTEM->WM_Get_Active_Window()){
+ if(i==0 && WINS.length()>1){ LWM::SYSTEM->WM_Set_Active_Window(WINS[i+1]->clientID()); }
+ else if(i>0){ LWM::SYSTEM->WM_Set_Active_Window(WINS[i-1]->clientID()); }
+ else{ LWM::SYSTEM->WM_Set_Active_Window( QX11Info::appRootWindow()); }
+ }
delete WINS.takeAt(i); break;
}
}
bgstack15