diff --git a/client.h b/client.h index 60411558a6..0506ec4978 100644 --- a/client.h +++ b/client.h @@ -202,7 +202,7 @@ class Client : public QObject, public KDecorationDefines // plainResize() simply resizes void plainResize( int w, int h, ForceGeometry_t force = NormalGeometrySet ); void plainResize( const QSize& s, ForceGeometry_t force = NormalGeometrySet ); - void keepInArea( const QRect& area ); + void keepInArea( QRect area, bool partial = false ); void growHorizontal(); void shrinkHorizontal(); diff --git a/geometry.cpp b/geometry.cpp index f1064d5407..64d958e809 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -664,8 +664,16 @@ void Workspace::updateTopMenuGeometry( Client* c ) //******************************************** -void Client::keepInArea( const QRect& area ) +void Client::keepInArea( QRect area, bool partial ) { + if( partial ) + { + // increase the area so that can have only 100 pixels in the area + area.setLeft( QMIN( area.left() - width() + 100, area.left())); + area.setTop( QMIN( area.top() - height() + 100, area.top())); + area.setRight( QMAX( area.right() + width() - 100, area.right())); + area.setBottom( QMAX( area.bottom() + height() - 100, area.bottom())); + } if ( geometry().right() > area.right() && width() < area.width() ) move( area.right() - width(), y() ); if ( geometry().bottom() > area.bottom() && height() < area.height() ) diff --git a/manage.cpp b/manage.cpp index a90fff9ada..3e71644ced 100644 --- a/manage.cpp +++ b/manage.cpp @@ -190,6 +190,7 @@ bool Client::manage( Window w, bool isMapped ) geom = session->geometry; QRect area; + bool partial_keep_in_area = isMapped || session; if( isMapped || session ) area = workspace()->clientArea( FullArea, geom.center(), desktop()); else if( options->xineramaPlacementEnabled ) @@ -274,6 +275,9 @@ bool Client::manage( Window w, bool isMapped ) { move( forced_pos ); placementDone = true; + // don't keep inside workarea if the window has specially configured position + partial_keep_in_area = true; + area = workspace()->clientArea( FullArea, geom.center(), desktop()); } if( !placementDone ) { // placement needs to be after setting size @@ -281,9 +285,8 @@ bool Client::manage( Window w, bool isMapped ) placementDone = TRUE; } - if( !isMapped && !session // trust position from session or if already mapped - && ( !isSpecialWindow() || isToolbar()) && isMovable()) - keepInArea( area ); + if(( !isSpecialWindow() || isToolbar()) && isMovable()) + keepInArea( area, partial_keep_in_area ); XShapeSelectInput( qt_xdisplay(), window(), ShapeNotifyMask ); if ( (is_shape = Shape::hasShape( window())) )