From 9e49d37f822e03955c670c8170fe0e0e1656ba15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 24 Sep 2003 11:00:40 +0000 Subject: [PATCH] Fix workarea restrictions when moving/resizing windows. CCMAIL: 64672-done@bugs.kde.org svn path=/trunk/kdebase/kwin/; revision=253540 --- geometry.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index e0be6c8fb6..bf415470bc 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1266,14 +1266,16 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root ) QPoint pp = globalPos - moveOffset; if( !unrestrictedMoveResize ) - { // TODO this is broken + { int left_overlap = width() - border_left - 100; int right_overlap = width() - border_right - 100; - int bottom_overlap = - border_top; - p.setX( QMIN( desktopArea.right() + right_overlap, QMAX( desktopArea.left() - left_overlap, p.x()))); - p.setY( QMIN( desktopArea.bottom() + bottom_overlap, QMAX( desktopArea.top(), p.y()))); - pp.setX( QMIN( desktopArea.right() + right_overlap, QMAX( desktopArea.left() - left_overlap, pp.x()))); - pp.setY( QMIN( desktopArea.bottom() + bottom_overlap, QMAX( desktopArea.top(), pp.y()))); + int top_overlap = 0; + int bottom_overlap = height() - border_top; + // 'pp' is top left corner, 'p' is bottom right corner + pp.setX( QMIN( desktopArea.right() + right_overlap - width(), QMAX( desktopArea.left() - left_overlap, pp.x()))); + pp.setY( QMIN( desktopArea.bottom() + bottom_overlap - height(), QMAX( desktopArea.top() - top_overlap, pp.y()))); + p.setX( QMIN( desktopArea.right() + right_overlap, QMAX( desktopArea.left() - left_overlap + width(), p.x()))); + p.setY( QMIN( desktopArea.bottom() + bottom_overlap, QMAX( desktopArea.top() - top_overlap + height(), p.y()))); } QSize mpsize( geometry().right() - pp.x() + 1, geometry().bottom() - pp.y() + 1 );