summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/place.c
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-16 05:12:01 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-16 05:12:01 +0000
commita9b59442f874582386895e4748aaa8330c8e433b (patch)
treeb7e258b8d78ef827ee70f0f07eb628210832f43d /beryl-plugins/src/place.c
parentaa698f0aab5f3a0da96e5edeef80f7572906d1e5 (diff)
downloadmarex-dev-a9b59442f874582386895e4748aaa8330c8e433b.tar.gz
marex-dev-a9b59442f874582386895e4748aaa8330c8e433b.tar.bz2
Haven't finished a decent placement algorith, this is slightly more intelligent though
git-svn-id: file:///beryl/trunk@1789 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/place.c')
-rw-r--r--beryl-plugins/src/place.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c
index 7578fa5..6cc93c4 100644
--- a/beryl-plugins/src/place.c
+++ b/beryl-plugins/src/place.c
@@ -269,6 +269,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;
+ int x_optimal, y_optimal;
+ int xloc=window->attrib.x; int yloc=window->attrib.y; int height=window->attrib.height; int width=window->attrib.width; int tr=xloc+width;
+
+ int overlaps = 0;
+ for (x = 0; x < window->screen->workArea.width; x++){
+ overlaps=0;
+ for (y = 0; y < window->screen->workArea.height;y++){
+ CompScreen *l=window->screen->windows;
+ while (l){
+ if (((xloc + width/2) < (l->attrib.x + l->attrib.width + width) && (xloc>l->attrib.x)) || (tr + width/2) < (l->attrib.x + l->attrib.width + width) && (tr>l->attrib.x)){
+ overlaps=1;
+ } else if (yloc < (l->attrib.y) && yloc > (l->attrib.y - l->attrib.height)) {
+ overlaps=1;
+ }
+ l++;
+
+ }
+ }
+ if (overlaps){break;}
+ }
+}
+
static void
find_next_cascade(CompWindow * window,
GList * windows, int x, int y, int *new_x, int *new_y)
@@ -484,15 +509,7 @@ find_most_freespace(CompWindow * window,
}
}
-static void placeIntelligent(CompWindow *window, int *x, int *y){
- int ox,oy;
- ox=*x;
- oy=*y;
- find_most_freespace(window,window->prev,ox,oy,x,y);
- /*
- TODO: Make intelligent
- */
-}
+
static void
avoid_being_obscured_as_second_modal_dialog(CompWindow * window,
int *x, int *y)
@@ -1005,7 +1022,7 @@ placeWindow(CompWindow * window, int x, int y, int *new_x, int *new_y)
placeCentered(window, &x, &y);
} else if (ps->placeMode == PlaceModeRandom) {
placeRandom(window, &x, &y);
- } else if (ps->placeMode == PlaceModeIntelligent) {
+ } else {
placeIntelligent(window, &x, &y);
}