changeset: 2286:6d8ca81a50d3
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Feb 09 14:49:35 2008 -0500
summary: Fix bug causing random frames to float when toggling between managed/floating layer.
diff -r c1ab6fdb7fca -r 6d8ca81a50d3 cmd/wmii/_util.c
--- a/cmd/wmii/_util.c Sat Feb 09 13:23:27 2008 -0500
+++ b/cmd/wmii/_util.c Sat Feb 09 14:49:35 2008 -0500
@@ -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]);
diff -r c1ab6fdb7fca -r 6d8ca81a50d3 cmd/wmii/area.c
--- a/cmd/wmii/area.c Sat Feb 09 13:23:27 2008 -0500
+++ b/cmd/wmii/area.c Sat Feb 09 14:49:35 2008 -0500
@@ -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
diff -r c1ab6fdb7fca -r 6d8ca81a50d3 cmd/wmii/column.c
--- a/cmd/wmii/column.c Sat Feb 09 13:23:27 2008 -0500
+++ b/cmd/wmii/column.c Sat Feb 09 14:49:35 2008 -0500
@@ -163,6 +163,12 @@ column_scale(Area *a) {
else
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)
diff -r c1ab6fdb7fca -r 6d8ca81a50d3 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Sat Feb 09 13:23:27 2008 -0500
+++ b/cmd/wmii/fns.h Sat Feb 09 14:49:35 2008 -0500
@@ -11,6 +11,9 @@
# pragma varargck type "C" Client*
# 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*);
@@ -226,7 +229,7 @@ Rectangle* view_rects(View*, uint *num,
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);
diff -r c1ab6fdb7fca -r 6d8ca81a50d3 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Sat Feb 09 13:23:27 2008 -0500
+++ b/cmd/wmii/frame.c Sat Feb 09 14:49:35 2008 -0500
@@ -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);
}
Received on Sat Feb 09 2008 - 20:53:47 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:20 UTC