commit eee18d7bc9c0200e6728032f65a7f117c10ae15e parent 722d23bf52626418850d9372abcc7739062cfc9f Author: Kris Maglione <jg@suckless.org> Date: Mon, 5 Feb 2007 02:36:18 -0500 Ok, I *really* fixed the swapping bug this time. Diffstat:
| frame.c | | | 20 | +++++++++++++++----- |
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/frame.c b/frame.c @@ -75,11 +75,21 @@ swap_frames(Frame *fa, Frame *fb) { for(fp_b = &a->frame; *fp_b; fp_b=&(*fp_b)->anext) if(*fp_b == fb) break; - ft = fa->anext; - *fp_a = fb; - fa->anext = fb->anext; - *fp_b = fa; - fb->anext = ft; + if(fa->anext == fb) { + *fp_a = fb; + fa->anext = fb->anext; + fb->anext = fa; + } else if(fb->anext == fa) { + *fp_b = fa; + fb->anext = fa->anext; + fa->anext = fb; + } else { + *fp_a = fb; + *fp_b = fa; + ft = fb->anext; + fb->anext = fa->anext; + fa->anext = ft; + } fb->area = fa->area; fa->area = a;