Fix bug causing random frames to float when toggling between managed/floating layer.

This commit is contained in:
Kris Maglione 2008-02-09 14:49:35 -05:00
parent 443c6cbe66
commit 756230ee93
5 changed files with 14 additions and 9 deletions

View File

@ -125,7 +125,7 @@ spawn3l(int fd[3], const char *file, ...) {
}
void
backtrace(void) {
backtrace(char *btarg) {
char *proc, *spid;
int fd[3], p[2], q[2];
int pid, status, n;
@ -153,7 +153,7 @@ backtrace(void) {
if(spawn3l(fd, "gdb", "gdb", "-batch", "-x", "/dev/fd/0", proc, spid, nil) < 0)
exit(1);
fprint(p[1], "bt full\n");
fprint(p[1], "bt %s\n", btarg);
fprint(p[1], "detach\n");
close(p[1]);

View File

@ -191,11 +191,8 @@ area_attach(Area *a, Frame *f) {
view_arrange(a->view);
if(a->frame && a->sel == nil) {
fprint(2, "a->sel == nil\n");
backtrace();
if(btassert("4 full", a->frame && a->sel == nil))
a->sel = a->frame;
}
}
void

View File

@ -164,6 +164,12 @@ column_scale(Area *a) {
nuncol++;
}
/* FIXME: Kludge. */
dy = Dy(a->view->r) - Dy(a->r);
minh = colh * (ncol + nuncol - 1) + uncolh;
if(dy && Dy(a->r) < minh)
a->r.max.y += min(dy, minh - Dy(a->r));
surplus = Dy(a->r)
- (ncol * colh)
- (nuncol * uncolh);

View File

@ -12,6 +12,9 @@
# pragma varargck type "r" void
#endif
#define btassert(arg, cond) \
(cond ? fprint(1, __FILE__":%d: failed assertion: " #cond "\n", __LINE__), backtrace(arg), true : false)
/* area.c */
void area_attach(Area*, Frame*);
Area* area_create(View*, Area *pos, uint w);
@ -226,7 +229,7 @@ void view_update_rect(View*);
Rectangle* view_rects(View*, uint *num, Frame *ignore);
/* _util.c */
void backtrace(void);
void backtrace(char*);
void closeexec(int);
char** comm(int, char**, char**);
int doublefork(void);

View File

@ -300,9 +300,8 @@ frame_resize(Frame *f, Rectangle r) {
Rectangle fr, cr;
int collapsed, dx;
if(Dx(r) <= 0 || Dy(r) <= 0) {
if(btassert("4 full", Dx(r) <= 0 || Dy(r) <= 0)) {
fprint(2, "Frame rect: %R\n", r);
backtrace();
r.max.x = min(r.min.x+1, r.max.x);
r.max.y = min(r.min.y+1, r.max.y);
}