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*55983Sbostic static char sccsid[] = "@(#)toucholap.c 5.6 (Berkeley) 08/23/92"; 1034677Sbostic #endif /* not lint */ 1122684Sdist 1255980Sbostic #include <curses.h> 1319897Sbloom 1419897Sbloom /* 1555980Sbostic * touchoverlap -- 1619897Sbloom * Touch, on win2, the part that overlaps with win1. 1719897Sbloom */ 1855980Sbostic int 1919897Sbloom touchoverlap(win1, win2) 2055980Sbostic register WINDOW *win1, *win2; 2155980Sbostic { 22*55983Sbostic register int y, endy, endx, starty, startx; 2319897Sbloom 2455980Sbostic #ifdef DEBUG 2555980Sbostic __TRACE("touchoverlap: (%0.2o, %0.2o);\n", win1, win2); 2655980Sbostic #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); 3155980Sbostic #ifdef DEBUG 3255980Sbostic __TRACE("touchoverlap: from (%d,%d) to (%d,%d)\n", 3355980Sbostic starty, startx, endy, endx); 3455980Sbostic __TRACE("touchoverlap: win1 (%d,%d) to (%d,%d)\n", 3555980Sbostic win1->_begy, win1->_begx, win1->_begy + win1->_maxy, 3655980Sbostic win1->_begx + win1->_maxx); 3755980Sbostic __TRACE("touchoverlap: win2 (%d,%d) to (%d,%d)\n", 3855980Sbostic win2->_begy, win2->_begx, win2->_begy + win2->_maxy, 3955980Sbostic win2->_begx + win2->_maxx); 4055980Sbostic #endif 4119897Sbloom if (starty >= endy || startx >= endx) 4255980Sbostic return (OK); 4319897Sbloom starty -= win2->_begy; 4419897Sbloom startx -= win2->_begx; 4519897Sbloom endy -= win2->_begy; 4619897Sbloom endx -= win2->_begx; 4755980Sbostic for (--endx, y = starty; y < endy; y++) 4819897Sbloom touchline(win2, y, startx, endx); 4955980Sbostic return (OK); 5019897Sbloom } 51