Mercurial > hg > nnchat
comparison nnchat.c @ 324:ba4cc7ebe311
Twiddling on the backbuffer logic.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 11 Jun 2011 09:49:42 +0300 |
parents | 863e3a26974d |
children | c086345d176b |
comparison
equal
deleted
inserted
replaced
323:863e3a26974d | 324:ba4cc7ebe311 |
---|---|
418 } | 418 } |
419 | 419 |
420 | 420 |
421 void updateMainWin(BOOL force) | 421 void updateMainWin(BOOL force) |
422 { | 422 { |
423 int y, w, h, offs; | 423 int y, w, h, offs, o; |
424 qringbuf_t *buf; | 424 qringbuf_t *buf; |
425 | 425 |
426 if (mainWin == NULL || currWin == NULL) return; | 426 if (mainWin == NULL || currWin == NULL) return; |
427 if (!force && !currWin->dirty) return; | 427 if (!force && !currWin->dirty) return; |
428 | 428 |
429 buf = currWin->data; | 429 buf = currWin->data; |
430 getmaxyx(mainWin, h, w); | 430 getmaxyx(mainWin, h, w); |
431 werase(mainWin); | 431 werase(mainWin); |
432 | 432 |
433 offs = buf->size - h - currWin->pos; | 433 offs = (int) buf->size; |
434 offs -= (h + currWin->pos); | |
434 if (offs < 0) | 435 if (offs < 0) |
435 offs = 0; | 436 offs = 0; |
437 o = offs; | |
436 | 438 |
437 for (y = 0; y < h && offs < buf->size; offs++) { | 439 for (y = 0; y < h && offs < buf->size; offs++) { |
438 if (buf->data[offs] != NULL) | 440 if (buf->data[offs] != NULL) |
439 printWin(mainWin, (char *) buf->data[offs]); | 441 printWin(mainWin, (char *) buf->data[offs]); |
440 y = getcury(mainWin); | 442 y = getcury(mainWin); |
441 } | 443 } |
444 | |
445 //fprintf(stderr, "pos=%d, offs=%d / %d, buf.size=%d, h=%d, y=%d\n", currWin->pos, o, offs, buf->size, h, y); | |
442 | 446 |
443 currWin->dirty = FALSE; | 447 currWin->dirty = FALSE; |
444 wrefresh(mainWin); | 448 wrefresh(mainWin); |
445 } | 449 } |
446 | 450 |