From d653417387293db321aab826fb3dbf4b2a7092ce Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Thu, 13 Jul 2000 20:31:36 +0000 Subject: [PATCH] help ugly motif apps or nasty java programs to position windows halfway decent svn path=/trunk/kdebase/kwin/; revision=56648 --- client.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client.cpp b/client.cpp index f3b691ccad..8e6d944ac2 100644 --- a/client.cpp +++ b/client.cpp @@ -503,6 +503,20 @@ void Client::manage( bool isMapped ) geom.setRect( xSizeHint.x, geom.y(), geom.width(), geom.height() ); if ( xSizeHint.y != 0 && geom.y() == 0 ) geom.setRect( geom.x(), xSizeHint.y, geom.width(), geom.height() ); + + if ( (xSizeHint.flags & USPosition) == 0 ) { + QRect area = workspace()->clientArea(); + if ( !area.contains( geom.topLeft() ) ) { + int tx = geom.x(); + int ty = geom.y(); + if ( tx >= 0 && tx < area.x() ) + tx = area.x(); + if ( ty >= 0 && ty < area.y() ) + ty = area.y(); + geom.moveTopLeft( QPoint( tx, ty ) ); + } + } + placementDone = TRUE; } if ( (xSizeHint.flags & USSize) || (xSizeHint.flags & PSize) ) { @@ -519,6 +533,7 @@ void Client::manage( bool isMapped ) activateLayout(); resize ( sizeForWindowSize( geom.size() ) ); activateLayout(); + move( geom.x(), geom.y() ); gravitate( FALSE ); @@ -1022,7 +1037,7 @@ QSize Client::sizeForWindowSize( const QSize& wsize, bool ignore_height) const } -/*! +/*! Returns whether the window is resizable or has a fixed size. */ bool Client::isResizable() const