combining smart placement strategy with snap_move in the the end (I dont want backport this)

This commit is contained in:
Anselm R. Garbe 2006-05-29 14:31:40 +02:00
parent b8e17113d0
commit f4f392d29f
3 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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();