changeset: 1736:7e4e30a1d4c8
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Feb 05 00:41:13 2007 -0500
files: area.c
description:
Fixed sizing big in create_area()
diff -r 4cf4ad19ffec -r 7e4e30a1d4c8 area.c
--- a/area.c Mon Feb 05 00:26:02 2007 -0500
+++ b/area.c Mon Feb 05 00:41:13 2007 -0500
@@ -16,12 +16,18 @@ create_area(View *v, Area *pos, unsigned
create_area(View *v, Area *pos, unsigned int w) {
static unsigned short id = 1;
unsigned int area_num, col_num, i;
- unsigned int min_width = screen->rect.width/NCOL;
- Area *ta, *a, **p = pos ? &pos->next : &v->area;
+ unsigned int min_width;
+ Area *ta, *a, **p;
+
+ min_width = screen->rect.width/NCOL;
+ p = pos ? &pos->next : &v->area;
area_num = 0;
- for(a = v->area; a && a != *p; a=a->next)
- area_num++;
+ i = 0;
+ for(a = v->area; a && a != *p; a = a->next)
+ area_num++, i++;
+ for(; a; a = a->next) area_num++;
+
col_num = area_num ? area_num - 1 : 0;
if(!w) {
if(area_num)
@@ -33,8 +39,9 @@ create_area(View *v, Area *pos, unsigned
w = min_width;
if(col_num && col_num * min_width + w > screen->rect.width)
return nil;
- if(area_num > 1)
+ if(i > 1)
scale_view(v, screen->rect.width - w);
+
a = ixp_emallocz(sizeof(Area));
a->view = v;
a->id = id++;
@@ -47,7 +54,8 @@ create_area(View *v, Area *pos, unsigned
a->next = *p;
*p = a;
v->sel = a;
- if(area_num) write_event("CreateColumn %d\n", area_num);
+
+ if(i) write_event("CreateColumn %d\n", i);
i = 0;
for(ta=v->area; ta && ta != v->sel; ta=ta->next) i++;
Received on Mon Feb 05 2007 - 06:50:04 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:53 UTC