commit f4f392d29fdb91d2451177e34e18d85cbea92cbe
parent b8e17113d086ef9a325d54be86769887c194a771
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Mon, 29 May 2006 14:31:40 +0200
combining smart placement strategy with snap_move in the the end (I dont want backport this)
Diffstat:
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/cmd/wm/area.c b/cmd/wm/area.c
@@ -142,15 +142,18 @@ send_to_area(Area *to, Area *from, Client *c)
focus_client(c, True);
}
-void
+static void
place_client(Area *a, Client *c)
{
static unsigned int mx, my;
static Bool *field = nil;
Bool fit = False;
- unsigned int i, j, k, x, y, maxx, maxy, dx, dy, cx, cy, diff;
+ unsigned int i, j, k, x, y, maxx, maxy, dx, dy, cx, cy, diff, num = 0;
XPoint p1 = {0, 0}, p2 = {0, 0};
Frame *f = c->frame.data[c->sel];
+ int snapw = rect.width * def.snap / 1000;
+ int snaph = rect.height * def.snap / 1000;
+ XRectangle *rects;
if(c->trans)
return;
@@ -160,6 +163,7 @@ place_client(Area *a, Client *c)
|| c->size.flags & PPosition)
return;
+ rects = rects_of_view(a->view, &num);
if(!field) {
mx = rect.width / 8;
my = rect.height / 8;
@@ -229,6 +233,10 @@ place_client(Area *a, Client *c)
diff = a->rect.height - f->rect.height;
f->rect.y = a->rect.y + (random() % (diff ? diff : 1));
}
+
+ snap_move(&f->rect, rects, num, snapw, snaph);
+ if(rects)
+ free(rects);
}
void
diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c
@@ -29,7 +29,7 @@ check_horiz_match(XRectangle * r, XRectangle * neighbor)
&& (r->x + r->width >= neighbor->x)));
}
-static void
+void
snap_move(XRectangle *r, XRectangle *rects,
unsigned int num, int snapw, int snaph)
{
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -287,6 +287,8 @@ void do_mouse_resize(Client *c,BlitzAlign align);
void do_mouse_move(Client *c);
void grab_mouse(Window w, unsigned long mod, unsigned int button);
void ungrab_mouse(Window w, unsigned long mod, unsigned int button);
+void snap_move(XRectangle *r, XRectangle *rects, unsigned int num,
+ int snapw, int snaph);
/* rule.c */
void update_rules();