diff --git a/client.h b/client.h index d00a1d3c08..80dc2b9cb3 100644 --- a/client.h +++ b/client.h @@ -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 ); diff --git a/events.cpp b/events.cpp index edf03d0dbc..c4981fb4fb 100644 --- a/events.cpp +++ b/events.cpp @@ -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 ); diff --git a/geometry.cpp b/geometry.cpp index 0dadb74d48..d57d57db7a 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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 ); } /*!