smarter maximize detection, also provide the windows with a reasonable restore
geometry svn path=/trunk/kdebase/kwin/; revision=66722
This commit is contained in:
parent
a8a059a53d
commit
fb4a09d4ab
1 changed files with 18 additions and 4 deletions
22
client.cpp
22
client.cpp
|
@ -624,11 +624,25 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial )
|
||||||
else if ( info->state() & NET::MaxHoriz )
|
else if ( info->state() & NET::MaxHoriz )
|
||||||
maximize( Client::MaximizeHorizontal );
|
maximize( Client::MaximizeHorizontal );
|
||||||
|
|
||||||
|
if ( isMaximizable() && !isMaximized()
|
||||||
if ( isMaximizable() && !isMaximized() && width() >= area.width() && height() >= area.height()
|
&& ( width() >= area.width() || height() >= area.height() ) ) {
|
||||||
&& ( geom.topLeft() == area.topLeft() ||
|
// window is too large for the screen, maximize in the
|
||||||
geom.topLeft() == workspace()->geometry().topLeft() ) ) {
|
// directions necessary and generate a suitable restore
|
||||||
|
// geometry.
|
||||||
|
QSize s = adjustedSize( QSize( width()*2/3, height()*2/3 ) );
|
||||||
|
if ( width() >= area.width() && height() >= area.height() ) {
|
||||||
maximize( Client::MaximizeFull );
|
maximize( Client::MaximizeFull );
|
||||||
|
geom_restore.setSize( s );
|
||||||
|
geom_restore.moveCenter( geometry().center() );
|
||||||
|
} else if ( width() >= area.width() ) {
|
||||||
|
maximize( Client::MaximizeHorizontal );
|
||||||
|
geom_restore.setWidth( s.width() );
|
||||||
|
geom_restore.moveCenter( geometry().center() );
|
||||||
|
} else if ( height() >= area.height() ) {
|
||||||
|
maximize( Client::MaximizeVertical );
|
||||||
|
geom_restore.setHeight( s.height() );
|
||||||
|
geom_restore.moveCenter( geometry().center() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue