From c11b1a89ba65dc6f9b7205c7dcb1c7fbd09735c1 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Thu, 3 Feb 2011 21:28:47 +0800 Subject: [PATCH 2/2] Be a little bit smarter about that - work with stretched windows too and don't accumulate pointer motion if the window is already constrained --- plugins/resize/src/resize.cpp | 39 +++++++++++++++++++++++++-------------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp index e2283e7..12fc866 100644 --- a/plugins/resize/src/resize.cpp +++ b/plugins/resize/src/resize.cpp @@ -841,20 +841,31 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot) * in the opposite direction. (So the apparant x / y * mixup here is intentional) */ - - if (mask == ResizeLeftMask && - xRoot == grabWindowWorkArea->left ()) - pointerDx += abs (yRoot - lastPointerY) * -1; - else if (mask == ResizeRightMask && - xRoot == grabWindowWorkArea->right ()) - pointerDx += abs (yRoot - lastPointerY); - else if (mask == ResizeUpMask && - yRoot == grabWindowWorkArea->top ()) - pointerDy += abs (xRoot - lastPointerX); - else if (mask == ResizeUpMask && - yRoot == grabWindowWorkArea->bottom ()) - pointerDy += abs (xRoot - lastPointerX) * -1; - + + if (mask == ResizeLeftMask) + { + if (xRoot == 0 && + geometry.x - w->input ().left > grabWindowWorkArea->left ()) + pointerDx += abs (yRoot - lastPointerY) * -1; + } + else if (mask == ResizeRightMask) + { + if (xRoot == screen->width () -1 && + geometry.x + geometry.width + w->input ().right < grabWindowWorkArea->right ()) + pointerDx += abs (yRoot - lastPointerY); + } + if (mask == ResizeUpMask) + { + if (yRoot == 0 && + geometry.y - w->input ().top > grabWindowWorkArea->top ()) + pointerDy += abs (xRoot - lastPointerX) * -1; + } + else if (mask == ResizeDownMask) + { + if (yRoot == screen->height () -1 && + geometry.y + geometry.height + w->input ().bottom < grabWindowWorkArea->bottom ()) + pointerDx += abs (yRoot - lastPointerY); + } } if (mask & ResizeLeftMask) -- 1.7.2.3