122684Sdist /* 234677Sbostic * Copyright (c) 1981 Regents of the University of California. 334677Sbostic * All rights reserved. 434677Sbostic * 542657Sbostic * %sccs.include.redist.c% 622684Sdist */ 722684Sdist 822684Sdist #ifndef lint 9*55980Sbostic static char sccsid[] = "@(#)toucholap.c 5.5 (Berkeley) 08/23/92"; 1034677Sbostic #endif /* not lint */ 1122684Sdist 12*55980Sbostic #include <curses.h> 1319897Sbloom 1419897Sbloom /* 15*55980Sbostic * touchoverlap -- 1619897Sbloom * Touch, on win2, the part that overlaps with win1. 1719897Sbloom */ 18*55980Sbostic int 1919897Sbloom touchoverlap(win1, win2) 20*55980Sbostic register WINDOW *win1, *win2; 21*55980Sbostic { 22*55980Sbostic register int x, y, endy, endx, starty, startx; 2319897Sbloom 24*55980Sbostic #ifdef DEBUG 25*55980Sbostic __TRACE("touchoverlap: (%0.2o, %0.2o);\n", win1, win2); 26*55980Sbostic #endif 2719897Sbloom starty = max(win1->_begy, win2->_begy); 2819897Sbloom startx = max(win1->_begx, win2->_begx); 2919897Sbloom endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begx); 3019897Sbloom endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); 31*55980Sbostic #ifdef DEBUG 32*55980Sbostic __TRACE("touchoverlap: from (%d,%d) to (%d,%d)\n", 33*55980Sbostic starty, startx, endy, endx); 34*55980Sbostic __TRACE("touchoverlap: win1 (%d,%d) to (%d,%d)\n", 35*55980Sbostic win1->_begy, win1->_begx, win1->_begy + win1->_maxy, 36*55980Sbostic win1->_begx + win1->_maxx); 37*55980Sbostic __TRACE("touchoverlap: win2 (%d,%d) to (%d,%d)\n", 38*55980Sbostic win2->_begy, win2->_begx, win2->_begy + win2->_maxy, 39*55980Sbostic win2->_begx + win2->_maxx); 40*55980Sbostic #endif 4119897Sbloom if (starty >= endy || startx >= endx) 42*55980Sbostic return (OK); 4319897Sbloom starty -= win2->_begy; 4419897Sbloom startx -= win2->_begx; 4519897Sbloom endy -= win2->_begy; 4619897Sbloom endx -= win2->_begx; 47*55980Sbostic for (--endx, y = starty; y < endy; y++) 4819897Sbloom touchline(win2, y, startx, endx); 49*55980Sbostic return (OK); 5019897Sbloom } 51