#53420 - don't let normal windows go out of the workarea if they request

it.

svn path=/trunk/kdebase/kwin/; revision=329883
This commit is contained in:
Luboš Luňák 2004-07-16 11:25:07 +00:00
parent 7a8eda06ff
commit 58e12da8b7
3 changed files with 8 additions and 4 deletions

View file

@ -345,7 +345,7 @@ private slots:
void updateWorkareaDiffs();
void checkDirection( int new_diff, int old_diff, QRect& rect, const QRect& area );
static int computeWorkareaDiff( int left, int right, int a_left, int a_right );
void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity = 0 );
void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
// resizeWithChecks() resizes according to gravity, and checks workarea position
void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet );
void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet );

View file

@ -805,7 +805,7 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e )
}
if( e->value_mask & ( CWX | CWY | CWHeight | CWWidth ))
configureRequest( e->value_mask, e->x, e->y, e->width, e->height );
configureRequest( e->value_mask, e->x, e->y, e->width, e->height, 0, false );
if ( e->value_mask & CWStackMode )
restackWindow( e->above, e->detail, NET::FromApplication, userTime(), false );

View file

@ -1328,7 +1328,7 @@ const QPoint Client::calculateGravitation( bool invert, int gravity ) const
return QPoint( x() - dx, y() - dy );
}
void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity )
void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool )
{
if( gravity == 0 ) // default (nonsense) value for the argument
gravity = xSizeHint.win_gravity;
@ -1367,6 +1367,8 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
++block_geometry;
move( new_pos );
plainResize( ns ); // TODO must(?) resize before gravitating?
if( !from_tool && ( !isSpecialWindow() || isToolbar()))
keepInArea( workspace()->clientArea( WorkArea, this ));
--block_geometry;
setGeometry( QRect( calculateGravitation( false, gravity ), size()), ForceGeometrySet );
@ -1400,6 +1402,8 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
xSizeHint.win_gravity = gravity;
resizeWithChecks( ns );
xSizeHint.win_gravity = save_gravity;
if( !from_tool && ( !isSpecialWindow() || isToolbar()))
keepInArea( workspace()->clientArea( WorkArea, this ));
}
}
// No need to send synthetic configure notify event here, either it's sent together
@ -1491,7 +1495,7 @@ void Client::NETMoveResizeWindow( int flags, int x, int y, int width, int height
value_mask |= CWWidth;
if( flags & ( 1 << 11 ))
value_mask |= CWHeight;
configureRequest( value_mask, x, y, width, height, gravity );
configureRequest( value_mask, x, y, width, height, gravity, true );
}
/*!