summaryrefslogtreecommitdiff
path: root/src/canvas.c
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amade@asmblr.net>2013-03-15 18:36:57 +0100
committerAmadeusz Sławiński <amade@asmblr.net>2015-06-25 17:05:31 +0200
commit272b68b2ecf935c15cac5e05062e47114e4cedd4 (patch)
treeab185a67a5b9cd378d50939632b060dff2b2802a /src/canvas.c
parentc389013e89e7b04ce43872f2e72d43f77461a3c0 (diff)
downloadscreen-272b68b2ecf935c15cac5e05062e47114e4cedd4.tar.gz
bye bye DEBUG
Diffstat (limited to 'src/canvas.c')
-rw-r--r--src/canvas.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/canvas.c b/src/canvas.c
index 94cef9a..f5e704c 100644
--- a/src/canvas.c
+++ b/src/canvas.c
@@ -213,7 +213,6 @@ void SetCanvasWindow(struct canvas *cv, struct win *win)
for (cvpp = &l->l_cvlist; (cvp = *cvpp); cvpp = &cvp->c_lnext)
if (cvp == cv)
break;
- ASSERT(cvp);
*cvpp = cvp->c_lnext;
p = Layer2Window(l);
@@ -247,7 +246,6 @@ void SetCanvasWindow(struct canvas *cv, struct win *win)
}
/* add our canvas to the layer's canvaslist */
- ASSERT(l->l_cvlist != cv);
cv->c_lnext = l->l_cvlist;
l->l_cvlist = cv;
cv->c_layer = l;
@@ -282,7 +280,6 @@ void SetCanvasWindow(struct canvas *cv, struct win *win)
for (pp = &windows; (p = *pp); pp = &p->w_next)
if (p == win)
break;
- ASSERT(p);
*pp = p->w_next;
p->w_next = windows;
windows = p;
@@ -317,14 +314,12 @@ int MakeDefaultCanvas()
{
struct canvas *cv;
- ASSERT(display);
if ((cv = calloc(1, sizeof *cv)) == 0)
return -1;
cv->c_xs = 0;
cv->c_xe = D_width - 1;
cv->c_ys = (D_has_hstatus == HSTATUS_FIRSTLINE);
cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways;
- debug("MakeDefaultCanvas 0,0 %d,%d\n", cv->c_xe, cv->c_ye);
cv->c_xoff = 0;
cv->c_yoff = 0;
cv->c_next = 0;
@@ -401,12 +396,9 @@ void ResizeCanvas(struct canvas *cv)
xe = cv->c_xe;
ye = cv->c_ye;
cv = cv->c_slperp;
- debug("ResizeCanvas: %d,%d", xs, ys);
- debug(" %d,%d\n", xe, ye);
if (cv == 0)
return;
if (cv->c_slorient == SLICE_UNKN) {
- ASSERT(!cv->c_slnext && !cv->c_slperp);
cv->c_xs = xs;
cv->c_xe = xe;
cv->c_ys = ys;
@@ -420,7 +412,6 @@ void ResizeCanvas(struct canvas *cv)
fcv = 0;
if (focusminwidth || focusminheight) {
- debug("searching for focus canvas\n");
cv2 = D_forecv;
while (cv2->c_slback) {
if (cv2->c_slback == cv->c_slback) {
@@ -430,7 +421,6 @@ void ResizeCanvas(struct canvas *cv)
focusmin--;
else if (focusmin < 0)
focusmin = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2;
- debug("found, focusmin=%d\n", focusmin);
}
cv2 = cv2->c_slback;
}
@@ -443,15 +433,12 @@ void ResizeCanvas(struct canvas *cv)
nh = 0;
if (focusmin > nh)
focusmin = nh;
- debug("corrected to %d\n", focusmin);
}
/* pass 1: calculate weight sum */
for (cv2 = cv, wsum = 0; cv2; cv2 = cv2->c_slnext) {
- debug(" weight %d\n", cv2->c_slweight);
wsum += cv2->c_slweight;
}
- debug("wsum = %d\n", wsum);
if (wsum == 0)
wsum = 1;
w = wsum;
@@ -465,13 +452,11 @@ void ResizeCanvas(struct canvas *cv)
hh = cv2->c_slweight ? nh * cv2->c_slweight / w : 0;
w -= cv2->c_slweight;
nh -= hh;
- debug(" should %d min %d\n", hh, m);
if (hh <= m + 1)
need += m + 1 - hh;
else
got += hh - m - 1;
}
- debug("need: %d, got %d\n", need, got);
if (need > got)
need = got;
@@ -501,27 +486,20 @@ void ResizeCanvas(struct canvas *cv)
hh = cv->c_slweight ? nh * cv->c_slweight / w : 0;
w -= cv->c_slweight;
nh -= hh;
- debug(" should %d min %d\n", hh, m);
if (hh <= m + 1) {
hh = m + 1;
- debug(" -> %d\n", hh);
} else {
int hx = need * (hh - m - 1) / got;
- debug(" -> %d - %d = %d\n", hh, hx, hh - hx);
got -= (hh - m - 1);
hh -= hx;
need -= hx;
- debug(" now need=%d got=%d\n", need, got);
}
- ASSERT(hh >= m + 1);
/* hh is window size plus pation line */
if (i + hh > maxi + 2) {
hh = maxi + 2 - i;
- debug(" not enough space, reducing to %d\n", hh);
}
if (i + hh == maxi + 1) {
hh++;
- debug(" incrementing as no other canvas will fit\n");
}
if (cv->c_slorient == SLICE_VERT) {
cv->c_xs = xs;
@@ -545,7 +523,6 @@ void ResizeCanvas(struct canvas *cv)
if (cv->c_slperp) {
ResizeCanvas(cv);
if (!cv->c_slperp->c_slnext) {
- debug("deleting perp node\n");
FreePerp(cv->c_slperp);
FreePerp(cv);
}
@@ -557,7 +534,6 @@ void ResizeCanvas(struct canvas *cv)
static struct canvas *AddPerp(struct canvas *cv)
{
struct canvas *pcv;
- debug("Creating new perp node\n");
if ((pcv = calloc(1, sizeof *cv)) == 0)
return 0;
@@ -598,7 +574,6 @@ int AddCanvas(int orient)
int h, num;
cv = D_forecv;
- debug("AddCanvas orient %d, forecv is %d\n", orient, cv->c_slorient);
if (cv->c_slorient != SLICE_UNKN && cv->c_slorient != orient)
if (!AddPerp(cv))
@@ -611,11 +586,8 @@ int AddCanvas(int orient)
ye = cv->c_slback->c_ye;
if (!captionalways && cv == D_canvas.c_slperp && !cv->c_slnext)
ye--; /* need space for caption */
- debug("Adding Canvas to slice %d,%d ", xs, ys);
- debug("%d,%d\n", xe, ye);
num = CountCanvas(cv->c_slback->c_slperp) + 1;
- debug("Num = %d\n", num);
if (orient == SLICE_VERT)
h = ye - ys + 1;
else
@@ -669,7 +641,6 @@ void RemCanvas()
int ye;
struct canvas *cv;
- debug("RemCanvas\n");
cv = D_forecv;
if (cv->c_slorient == SLICE_UNKN)
return;
@@ -680,7 +651,6 @@ void RemCanvas()
if (!cv->c_slnext->c_slnext && cv->c_slback->c_slback) {
/* two canvases in slice, kill perp node */
cv = D_forecv;
- debug("deleting perp node\n");
FreePerp(cv->c_slprev ? cv->c_slprev : cv->c_slnext);
FreePerp(cv->c_slback);
}
@@ -738,7 +708,6 @@ void OneCanvas()
cv->c_slback = &D_canvas;
cv->c_slnext = 0;
cv->c_slprev = 0;
- ASSERT(!cv->c_slperp);
if (!captionalways)
D_canvas.c_ye++; /* caption line no longer needed */
ResizeCanvas(&D_canvas);