diff --git a/geometry.cpp b/geometry.cpp index 570be0ab5c..845d5841c6 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -394,6 +394,34 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos, bool unrestricted ny = ly - ch; } } + + // Corner snapping + if( nx == lrx || nx+cw == lx ) + { + if ((sOWO?(ry>lry):true) && (qAbs(lry-ry)lrx):true) && (qAbs(lrx-rx)lry):true) \ + && (newcx == lrx || newrx == lx) \ + && qAbs(lry-newry) < deltaY ) { \ + deltaY = qAbs( lry - newry ); \ + newry=lry; \ + } + +#define SNAP_WINDOW_C_LEFT if ( (sOWO?(newcxlrx):true) \ + && (newcy == lry || newry == ly) \ + && qAbs(lrx-newrx) < deltaX ) { \ + deltaX = qAbs( lrx - newrx ); \ + newrx=lrx; \ + } + switch ( mode ) { case PositionBottomRight: SNAP_WINDOW_BOTTOM SNAP_WINDOW_RIGHT + SNAP_WINDOW_C_BOTTOM + SNAP_WINDOW_C_RIGHT break; case PositionRight: SNAP_WINDOW_RIGHT + SNAP_WINDOW_C_RIGHT break; case PositionBottom: SNAP_WINDOW_BOTTOM + SNAP_WINDOW_C_BOTTOM break; case PositionTopLeft: SNAP_WINDOW_TOP SNAP_WINDOW_LEFT + SNAP_WINDOW_C_TOP + SNAP_WINDOW_C_LEFT break; case PositionLeft: SNAP_WINDOW_LEFT + SNAP_WINDOW_C_LEFT break; case PositionTop: SNAP_WINDOW_TOP + SNAP_WINDOW_C_TOP break; case PositionTopRight: SNAP_WINDOW_TOP SNAP_WINDOW_RIGHT + SNAP_WINDOW_C_TOP + SNAP_WINDOW_C_RIGHT break; case PositionBottomLeft: SNAP_WINDOW_BOTTOM SNAP_WINDOW_LEFT + SNAP_WINDOW_C_BOTTOM + SNAP_WINDOW_C_LEFT break; default: assert( false );