summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/place.c
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-18 07:49:55 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-18 07:49:55 +0000
commit31348055e5a5c0b627907305c156bc2e88638146 (patch)
tree382143b7795fbf6e6c78662d403f82ed8ba8586c /beryl-plugins/src/place.c
parent131d00dda55b86ffdc4d5f613ae54cf6f44baf21 (diff)
downloadmarex-dev-31348055e5a5c0b627907305c156bc2e88638146.tar.gz
marex-dev-31348055e5a5c0b627907305c156bc2e88638146.tar.bz2
place: Better fallback
git-svn-id: file:///beryl/trunk@1852 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/place.c')
-rw-r--r--beryl-plugins/src/place.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c
index b0e5cb3..db28b75 100644
--- a/beryl-plugins/src/place.c
+++ b/beryl-plugins/src/place.c
@@ -573,14 +573,17 @@ rectangle_overlaps_some_window (XRectangle * rect, GList * windows)
return FALSE;
}
+
+
static void
placeIntelligent (CompWindow * w, int *x, int *y, GList * windows)
{
-
+ int tries = 0;
XRectangle wRect = RECTANGLE_FROM_WINDOW (w);
XRectangle sRect = { 0, 0, 0, 0 };
wRect.height += w->serverBorderWidth;
-
+ int wIter = wRect.width/10;
+ int hIter = wRect.height/10;
CompScreen *screen = w->screen;
get_workarea_of_current_output_device (screen, &sRect);
@@ -592,6 +595,8 @@ placeIntelligent (CompWindow * w, int *x, int *y, GList * windows)
int xi;
int yi;
+ thisisdisgusting:
+
for (xi = 0; xi < (sRect.width - sRect.x); xi += 10)
{
wRect.x = xi;
@@ -611,14 +616,15 @@ placeIntelligent (CompWindow * w, int *x, int *y, GList * windows)
}
}
}
- if (wRect.width > ((sRect.width - sRect.x) / 2))
- {
- placeCentered (w, x, y);
- }
- else
- {
- placeRandom (w, x, y);
- }
+
+
+ if(tries < 10 && wRect.width>0 && wRect.height>0) {
+ tries++;
+ wRect.width-=wIter;
+ wRect.height-=hIter;
+ goto thisisdisgusting;
+ }
+ placeCentered(w,x,y);
}
static gint