From 3ee1de9c98ee2d41c370674436d20f7cd0756767 Mon Sep 17 00:00:00 2001 From: racarr Date: Sat, 16 Dec 2006 07:24:41 +0000 Subject: Just going to stick a simple and functional algorithm in until I can get something better....vaugely tiles windows so they 'fit' git-svn-id: file:///beryl/trunk@1794 d7aaf104-2d23-0410-ae22-9d23157bf5a3 --- beryl-plugins/src/place.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'beryl-plugins/src/place.c') diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c index cd7b5cc..5dbbe84 100644 --- a/beryl-plugins/src/place.c +++ b/beryl-plugins/src/place.c @@ -270,29 +270,30 @@ static void placeRandom(CompWindow *window, int *x, int *y){ *y = rand() % (window->screen->workArea.height - window->screen->workArea.y); } -static Bool windowIntersectsScreen(CompWindow *window){ - CompWindow *l = window->screen->reverseWindows; - Bool returnVal=TRUE; - XRectangle wRect; - getOuterRectOfWindow(window,&wRect); - - while (l){ - XRectangle lRect; - getOuterRectOfWindow(l,&lRect); - XRectangle temp; - if (rectangleIntersect(&lRect,&wRect,&temp)) {returnVal=FALSE;} - l++; - } - return returnVal; -} -static void placeIntelligent(CompWindow *window, int *x, int *y){ +static void placeIntelligent(CompWindow *w, int *x, int *y){ + + + + static int xi,yi,max; + *x=xi + (rand() % 10); + *y=yi + (rand() % 10); + xi+=w->attrib.width; + if (w->attrib.height > max){ + max=w->attrib.height; + } + if (xi > w->screen->workArea.width) { + xi=0; + yi+=max; + } + + +} + + - placeRandom(window,x,y); - /*TODO: Intelligent */ - } -- cgit v1.1