aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-08-16 16:06:01 -0400
committerKen Moore <ken@ixsystems.com>2017-08-16 16:06:01 -0400
commit671c2e8a4d65648e0c6747799a5a5ff0c0846cee (patch)
tree6b0fd30e2ca33836deb198d641adb6989ce93ba8
parentFix up a bit more of the new lumina-xconfig. (diff)
downloadlumina-671c2e8a4d65648e0c6747799a5a5ff0c0846cee.tar.gz
lumina-671c2e8a4d65648e0c6747799a5a5ff0c0846cee.tar.bz2
lumina-671c2e8a4d65648e0c6747799a5a5ff0c0846cee.zip
Get rudimentary y-dimension tiling working.
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.cpp44
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.h2
2 files changed, 33 insertions, 13 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
index 246fba62..b97d1b3b 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
@@ -197,26 +197,46 @@ void MainUI::updateNewScreenResolutions(){
}
void MainUI::tileScreens(bool activeonly){
+ qDebug() << "Tile Windows in Y Dimension";
QList<QMdiSubWindow*> wins = ui->mdiArea->subWindowList();
QRegion total;
int xpos, ypos;
xpos = ypos = 0;
QMdiSubWindow *cur = 0;
- float diff;
while(!wins.isEmpty()){
cur=0;
- diff = -1;
- //Scan for the window closest to the current X value
- for(x=0; x<wins.length(); x++){
- //Scan for the window closest to the current Y value
- for(int y=0; y<wins.length(); y++){
- if(cur==0){ cur = wins[y]; }
- else if(cur==wins[y]){ continue; } //skip it
- else if(wins[y]->geometry().y()<cur->geometry().y() && wins[y]->geometry().y()>ypos){ cur = wins[y]; }
- }
+ for(int i=0; i<wins.length(); i++){
+ if(cur==0){ cur = wins[i]; } //first one
+ else if(wins[i]->pos().y() < cur->pos().y()){ cur = wins[i]; }
}
- if(cur!=0){
-
+ if(cur==0){
+ //Note: This should **never** happen
+ qDebug() << "No windows found below y=:" << ypos;
+ //need to move the reference point
+ QRect bounding = total.boundingRect();
+ ypos+= (bounding.height()/2);
+ }else{
+ if(total.isNull()){
+ //First window handled
+ cur->move(cur->pos().x(), ypos);
+ }else{
+ int newy = ypos;
+ bool overlap = true;
+ while(overlap){
+ QRegion tmp(cur->pos().x(), newy, cur->width(), cur->height());
+ QRegion diff = tmp.subtracted(total);
+ overlap = (diff.boundingRect()!=tmp.boundingRect());
+ qDebug() << "Check Overlap:" << newy << overlap << tmp.boundingRect() << diff.boundingRect();
+ if(overlap){
+ QRect bound = diff.boundingRect();
+ if(newy!=bound.top()){ newy = bound.top(); }
+ else{ newy = bound.bottom(); }
+ }
+ }
+ cur->move(cur->pos().x(), newy);
+ }
+ total = total.united(cur->geometry());
+ wins.removeAll(cur);
}
}
}
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.h b/src-qt5/core-utils/lumina-xconfig/MainUI.h
index 9a54304a..4f02ab5c 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.h
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.h
@@ -49,7 +49,7 @@ private slots:
void UpdateScreens();
void ScreenSelected();
void updateNewScreenResolutions();
- void tileScreens();
+ void tileScreens(bool activeonly = false);
void DeactivateScreen();
void ActivateScreen();
bgstack15