diff options
Diffstat (limited to 'scripts/kconfig/libcurses/touch.c')
-rw-r--r-- | scripts/kconfig/libcurses/touch.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/scripts/kconfig/libcurses/touch.c b/scripts/kconfig/libcurses/touch.c index 619fbc6e1..2fd03cce5 100644 --- a/scripts/kconfig/libcurses/touch.c +++ b/scripts/kconfig/libcurses/touch.c | |||
@@ -168,31 +168,40 @@ bool is_wintouched(WINDOW *win) | |||
168 | 168 | ||
169 | int touchoverlap(const WINDOW *win1, WINDOW *win2) | 169 | int touchoverlap(const WINDOW *win1, WINDOW *win2) |
170 | { | 170 | { |
171 | int y, endy, endx, starty, startx; | 171 | int y, endy, endx, starty, startx, begy1, begx1, begy2, begx2; |
172 | 172 | ||
173 | PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); | 173 | PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); |
174 | 174 | ||
175 | if (!win1 || !win2) | 175 | if (!win1 || !win2) |
176 | return ERR; | 176 | return ERR; |
177 | 177 | ||
178 | starty = max(win1->_begy, win2->_begy); | 178 | begy1 = win1->_begy; |
179 | startx = max(win1->_begx, win2->_begx); | 179 | begx1 = win1->_begx; |
180 | endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begy); | 180 | begy2 = win2->_begy; |
181 | endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); | 181 | begx2 = win2->_begy; |
182 | |||
183 | starty = max(begy1, begy2); | ||
184 | startx = max(begx1, begx2); | ||
185 | endy = min(win1->_maxy + begy1, win2->_maxy + begy2); | ||
186 | endx = min(win1->_maxx + begx1, win2->_maxx + begx2); | ||
182 | 187 | ||
183 | if (starty >= endy || startx >= endx) | 188 | if (starty >= endy || startx >= endx) |
184 | return OK; | 189 | return OK; |
185 | 190 | ||
186 | starty -= win2->_begy; | 191 | starty -= begy2; |
187 | startx -= win2->_begx; | 192 | startx -= begx2; |
188 | endy -= win2->_begy; | 193 | endy -= begy2; |
189 | endx -= win2->_begx; | 194 | endx -= begx2; |
190 | endx -= 1; | 195 | endx -= 1; |
191 | 196 | ||
192 | for (y = starty; y < endy; y++) | 197 | for (y = starty; y < endy; y++) |
193 | { | 198 | { |
194 | win2->_firstch[y] = startx; | 199 | int first = win2->_firstch[y]; |
195 | win2->_lastch[y] = endx; | 200 | |
201 | if (first == _NO_CHANGE || win2->_lastch[y] < endx) | ||
202 | win2->_lastch[y] = endx; | ||
203 | if (first == _NO_CHANGE || first > startx) | ||
204 | win2->_firstch[y] = startx; | ||
196 | } | 205 | } |
197 | 206 | ||
198 | return OK; | 207 | return OK; |