diff options
author | Danny Baumann <dannybaumann@web.de> | 2008-08-27 07:34:29 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2008-08-27 07:34:29 +0200 |
commit | bd4138b9b9be5e2e73204fb41521faecbe45fb7c (patch) | |
tree | 539bcb6f7f9ca67f68814c912cd357e34606411a | |
parent | aed97c441881d9c382c7865d0305fc8f884c10ac (diff) |
Allow mouse initiated resize not only in the 4 corner, but in all directions.
-rw-r--r-- | plugins/resize.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/plugins/resize.c b/plugins/resize.c index 6cb263b4..5b8b12b3 100644 --- a/plugins/resize.c +++ b/plugins/resize.c @@ -339,7 +339,7 @@ resizeInitiate (CompDisplay *d, mask = getIntOptionNamed (option, nOption, "direction", 0); /* Initiate the resize in the direction suggested by the - * quarter of the window the mouse is in, eg drag in top left + * sector of the window the mouse is in, eg drag in top left * will resize up and to the left. Keyboard resize starts out * with the cursor in the middle of the window and then starts * resizing the edge corresponding to the next key press. */ @@ -349,11 +349,25 @@ resizeInitiate (CompDisplay *d, } else if (!mask) { - mask |= ((x - w->serverX) < (w->serverWidth / 2)) ? - ResizeLeftMask : ResizeRightMask; - - mask |= ((y - w->serverY) < (w->serverHeight / 2)) ? - ResizeUpMask : ResizeDownMask; + unsigned int sectorSizeX = w->serverWidth / 3; + unsigned int sectorSizeY = w->serverHeight / 3; + unsigned int posX = x - w->serverX; + unsigned int posY = y - w->serverY; + + if (posX < sectorSizeX) + mask |= ResizeLeftMask; + else if (posX > (2 * sectorSizeX)) + mask |= ResizeRightMask; + + if (posY < sectorSizeY) + mask |= ResizeUpMask; + else if (posY > (2 * sectorSizeY)) + mask |= ResizeDownMask; + + /* if the pointer was in the middle of the window, + do nothing */ + if (!mask) + return FALSE; } if (otherScreenGrabExist (w->screen, "resize", 0)) |