|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)toucholap.c 5.1 (Berkeley) 6/7/85"; ! 9: #endif not lint ! 10: ! 11: # include "curses.ext" ! 12: ! 13: # define min(a,b) (a < b ? a : b) ! 14: # define max(a,b) (a > b ? a : b) ! 15: ! 16: /* ! 17: * Touch, on win2, the part that overlaps with win1. ! 18: * ! 19: */ ! 20: touchoverlap(win1, win2) ! 21: reg WINDOW *win1, *win2; { ! 22: ! 23: reg int x, y, endy, endx, starty, startx; ! 24: ! 25: # ifdef DEBUG ! 26: fprintf(outf, "TOUCHOVERLAP(%0.2o, %0.2o);\n", win1, win2); ! 27: # endif ! 28: starty = max(win1->_begy, win2->_begy); ! 29: startx = max(win1->_begx, win2->_begx); ! 30: endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begx); ! 31: endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); ! 32: # ifdef DEBUG ! 33: fprintf(outf, "TOUCHOVERLAP:from (%d,%d) to (%d,%d)\n", starty, startx, endy, endx); ! 34: fprintf(outf, "TOUCHOVERLAP:win1 (%d,%d) to (%d,%d)\n", win1->_begy, win1->_begx, win1->_begy + win1->_maxy, win1->_begx + win1->_maxx); ! 35: fprintf(outf, "TOUCHOVERLAP:win2 (%d,%d) to (%d,%d)\n", win2->_begy, win2->_begx, win2->_begy + win2->_maxy, win2->_begx + win2->_maxx); ! 36: # endif ! 37: if (starty >= endy || startx >= endx) ! 38: return; ! 39: starty -= win2->_begy; ! 40: startx -= win2->_begx; ! 41: endy -= win2->_begy; ! 42: endx -= win2->_begx; ! 43: endx--; ! 44: for (y = starty; y < endy; y++) ! 45: touchline(win2, y, startx, endx); ! 46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.