diff options
Diffstat (limited to 'beryl-plugins/src/place.c')
-rw-r--r-- | beryl-plugins/src/place.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c index 53aeee8..cd7b5cc 100644 --- a/beryl-plugins/src/place.c +++ b/beryl-plugins/src/place.c @@ -270,33 +270,31 @@ static void placeRandom(CompWindow *window, int *x, int *y){ *y = rand() % (window->screen->workArea.height - window->screen->workArea.y); } -static void placeIntelligent(CompWindow *window, int *xo, int *yo){ - int x = 0; - int y = 0; +static Bool windowIntersectsScreen(CompWindow *window){ + CompWindow *l = window->screen->reverseWindows; + Bool returnVal=TRUE; + XRectangle wRect; + getOuterRectOfWindow(window,&wRect); - XRectangle windowRec = RECTANGLE_FROM_WINDOW(window); + 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){ + + placeRandom(window,x,y); + /*TODO: Intelligent */ - Bool overlaps = FALSE; - for (x = 0; x < window->screen->workArea.width; x+=(get_window_height(window))/10){ - overlaps=FALSE; - for (y = 0; y < window->screen->workArea.height;y+=(get_window_width(window))/10){ - CompScreen *l=window->screen->windows; - while (l){ - XRectangle dest; - XRectangle temp = RECTANGLE_FROM_WINDOW(l); - if (rectangleIntersect(&windowRec,&temp,&dest)){ - overlaps=TRUE; - } - - - } - - - } - if (overlaps) {break;} - } - *xo=300; *yo=300; } + + |