diff options
author | Ken Moore <moorekou@gmail.com> | 2015-07-17 14:59:28 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-07-17 14:59:28 -0400 |
commit | 257e7c26a9751242ed01ef5cad2d090f04b052b7 (patch) | |
tree | 22eadeb18bf03e882641a8cde4826f7ede58d6f3 /lumina-desktop | |
parent | Commit some quick fixes: (diff) | |
download | lumina-257e7c26a9751242ed01ef5cad2d090f04b052b7.tar.gz lumina-257e7c26a9751242ed01ef5cad2d090f04b052b7.tar.bz2 lumina-257e7c26a9751242ed01ef5cad2d090f04b052b7.zip |
Fix up a calculation of the new window geometry - add in checks for those strange windows (like gimp) which move the main window off-screen before showing it (causing errors/crashes in the program when moving it back).
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LSession.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 815920e5..a0424667 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -459,6 +459,7 @@ void LSession::registerDesktopWindows(){ } void LSession::adjustWindowGeom(WId win, bool maximize){ + if(DEBUG){ qDebug() << "AdjustWindowGeometry():" << win << maximize; } //Quick hack for making sure that new windows are not located underneath any panels // Get the window location QRect geom = XCB->WindowGeometry(win, false); @@ -481,6 +482,7 @@ void LSession::adjustWindowGeom(WId win, bool maximize){ break; } } + if(desk.isNull()){ return; } //Unable to deteremine screen //Adjust the window location if necessary if(maximize){ if(DEBUG){ qDebug() << " - Maximizing New Window:" << desk.width() << desk.height(); } @@ -495,12 +497,15 @@ void LSession::adjustWindowGeom(WId win, bool maximize){ //Adjust size for bottom margins (within reason, since window titles are on top normally) // if(geom.right() > desk.right() && (geom.width() > 100)){ geom.setRight(desk.right()); } if(fgeom.bottom() > desk.bottom() && geom.height() > 10){ + if(DEBUG){ qDebug() << "Adjust Y:" << fgeom << geom << desk; } int diff = fgeom.bottom()-desk.bottom(); //amount of overlap + if(DEBUG){ qDebug() << "Y-Diff:" << diff; } + if(diff < 0){ diff = -diff; } //need a positive value if( (fgeom.height()+ diff)< desk.height()){ //just move the window - there is room for it above geom.setBottom(desk.bottom()-frame[1]); fgeom.setBottom(desk.bottom()); - }else{ + }else if(geom.height() < diff){ //window bigger than the difference //Need to resize the window - keeping the origin point the same geom.setHeight( geom.height()-diff-1 ); //shrink it by the difference (need an extra pixel somewhere) fgeom.setHeight( fgeom.height()-diff ); |