diff options
Diffstat (limited to 'scripts/kconfig/libcurses/window.c')
-rw-r--r-- | scripts/kconfig/libcurses/window.c | 637 |
1 files changed, 637 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/window.c b/scripts/kconfig/libcurses/window.c new file mode 100644 index 000000000..4ae5b0861 --- /dev/null +++ b/scripts/kconfig/libcurses/window.c | |||
@@ -0,0 +1,637 @@ | |||
1 | /* PDCurses */ | ||
2 | |||
3 | #include "curspriv.h" | ||
4 | |||
5 | /*man-start************************************************************** | ||
6 | |||
7 | window | ||
8 | ------ | ||
9 | |||
10 | ### Synopsis | ||
11 | |||
12 | WINDOW *newwin(int nlines, int ncols, int begy, int begx); | ||
13 | WINDOW *derwin(WINDOW* orig, int nlines, int ncols, | ||
14 | int begy, int begx); | ||
15 | WINDOW *subwin(WINDOW* orig, int nlines, int ncols, | ||
16 | int begy, int begx); | ||
17 | WINDOW *dupwin(WINDOW *win); | ||
18 | WINDOW *wgetparent(const WINDOW *win); | ||
19 | int delwin(WINDOW *win); | ||
20 | int mvwin(WINDOW *win, int y, int x); | ||
21 | int mvderwin(WINDOW *win, int pary, int parx); | ||
22 | int syncok(WINDOW *win, bool bf); | ||
23 | bool is_subwin(const WINDOW *win); | ||
24 | bool is_syncok(const WINDOW *win); | ||
25 | void wsyncup(WINDOW *win); | ||
26 | void wcursyncup(WINDOW *win); | ||
27 | void wsyncdown(WINDOW *win); | ||
28 | |||
29 | WINDOW *resize_window(WINDOW *win, int nlines, int ncols); | ||
30 | int wresize(WINDOW *win, int nlines, int ncols); | ||
31 | WINDOW *PDC_makelines(WINDOW *win); | ||
32 | WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx); | ||
33 | void PDC_sync(WINDOW *win); | ||
34 | |||
35 | ### Description | ||
36 | |||
37 | newwin() creates a new window with the given number of lines, nlines | ||
38 | and columns, ncols. The upper left corner of the window is at line | ||
39 | begy, column begx. If nlines is zero, it defaults to LINES - begy; | ||
40 | ncols to COLS - begx. Create a new full-screen window by calling | ||
41 | newwin(0, 0, 0, 0). | ||
42 | |||
43 | delwin() deletes the named window, freeing all associated memory. In | ||
44 | the case of overlapping windows, subwindows should be deleted before | ||
45 | the main window. | ||
46 | |||
47 | mvwin() moves the window so that the upper left-hand corner is at | ||
48 | position (y,x). If the move would cause the window to be off the | ||
49 | screen, it is an error and the window is not moved. Moving subwindows | ||
50 | is allowed. | ||
51 | |||
52 | subwin() creates a new subwindow within a window. The dimensions of | ||
53 | the subwindow are nlines lines and ncols columns. The subwindow is at | ||
54 | position (begy, begx) on the screen. This position is relative to the | ||
55 | screen, and not to the window orig. Changes made to either window | ||
56 | will affect both. When using this routine, you will often need to | ||
57 | call touchwin() before calling wrefresh(). | ||
58 | |||
59 | derwin() is the same as subwin(), except that begy and begx are | ||
60 | relative to the origin of the window orig rather than the screen. | ||
61 | There is no difference between subwindows and derived windows. | ||
62 | |||
63 | mvderwin() moves a derived window (or subwindow) inside its parent | ||
64 | window. The screen-relative parameters of the window are not changed. | ||
65 | This routine is used to display different parts of the parent window | ||
66 | at the same physical position on the screen. | ||
67 | |||
68 | dupwin() creates an exact duplicate of the window win. | ||
69 | |||
70 | wgetparent() returns the parent WINDOW pointer for subwindows, or NULL | ||
71 | for windows having no parent. | ||
72 | |||
73 | wsyncup() causes a touchwin() of all of the window's parents. | ||
74 | |||
75 | If syncok() is called with a second argument of TRUE, this causes a | ||
76 | wsyncup() to be called every time the window is changed. | ||
77 | |||
78 | is_subwin() reports whether the specified window is a subwindow, | ||
79 | created by subwin() or derwin(). | ||
80 | |||
81 | is_syncok() reports whether the specified window is in syncok mode. | ||
82 | |||
83 | wcursyncup() causes the current cursor position of all of a window's | ||
84 | ancestors to reflect the current cursor position of the current | ||
85 | window. | ||
86 | |||
87 | wsyncdown() causes a touchwin() of the current window if any of its | ||
88 | parent's windows have been touched. | ||
89 | |||
90 | resize_window() allows the user to resize an existing window. It | ||
91 | returns the pointer to the new window, or NULL on failure. | ||
92 | |||
93 | wresize() is an ncurses-compatible wrapper for resize_window(). Note | ||
94 | that, unlike ncurses, it will NOT process any subwindows of the | ||
95 | window. (However, you still can call it _on_ subwindows.) It returns | ||
96 | OK or ERR. | ||
97 | |||
98 | PDC_makenew() allocates all data for a new WINDOW * except the actual | ||
99 | lines themselves. If it's unable to allocate memory for the window | ||
100 | structure, it will free all allocated memory and return a NULL | ||
101 | pointer. | ||
102 | |||
103 | PDC_makelines() allocates the memory for the lines. | ||
104 | |||
105 | PDC_sync() handles wrefresh() and wsyncup() calls when a window is | ||
106 | changed. | ||
107 | |||
108 | ### Return Value | ||
109 | |||
110 | newwin(), subwin(), derwin() and dupwin() return a pointer to the new | ||
111 | window, or NULL on failure. delwin(), mvwin(), mvderwin() and | ||
112 | syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown() | ||
113 | return nothing. | ||
114 | |||
115 | is_subwin() and is_syncok() returns TRUE or FALSE. | ||
116 | |||
117 | ### Errors | ||
118 | |||
119 | It is an error to call resize_window() before calling initscr(). | ||
120 | Also, an error will be generated if we fail to create a newly sized | ||
121 | replacement window for curscr, or stdscr. This could happen when | ||
122 | increasing the window size. NOTE: If this happens, the previously | ||
123 | successfully allocated windows are left alone; i.e., the resize is | ||
124 | NOT cancelled for those windows. | ||
125 | |||
126 | ### Portability | ||
127 | X/Open ncurses NetBSD | ||
128 | newwin Y Y Y | ||
129 | delwin Y Y Y | ||
130 | mvwin Y Y Y | ||
131 | subwin Y Y Y | ||
132 | derwin Y Y Y | ||
133 | mvderwin Y Y Y | ||
134 | dupwin Y Y Y | ||
135 | wgetparent - Y - | ||
136 | wsyncup Y Y Y | ||
137 | syncok Y Y Y | ||
138 | is_subwin - Y - | ||
139 | is_syncok - Y - | ||
140 | wcursyncup Y Y Y | ||
141 | wsyncdown Y Y Y | ||
142 | wresize - Y Y | ||
143 | resize_window - - - | ||
144 | PDC_makelines - - - | ||
145 | PDC_makenew - - - | ||
146 | PDC_sync - - - | ||
147 | |||
148 | **man-end****************************************************************/ | ||
149 | |||
150 | #include <stdlib.h> | ||
151 | |||
152 | WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx) | ||
153 | { | ||
154 | WINDOW *win; | ||
155 | |||
156 | PDC_LOG(("PDC_makenew() - called: lines %d cols %d begy %d begx %d\n", | ||
157 | nlines, ncols, begy, begx)); | ||
158 | |||
159 | /* allocate the window structure itself */ | ||
160 | |||
161 | win = calloc(1, sizeof(WINDOW)); | ||
162 | if (!win) | ||
163 | return win; | ||
164 | |||
165 | /* allocate the line pointer array */ | ||
166 | |||
167 | win->_y = malloc(nlines * sizeof(chtype *)); | ||
168 | if (!win->_y) | ||
169 | { | ||
170 | free(win); | ||
171 | return (WINDOW *)NULL; | ||
172 | } | ||
173 | |||
174 | /* allocate the minchng and maxchng arrays */ | ||
175 | |||
176 | win->_firstch = malloc(nlines * sizeof(int)); | ||
177 | if (!win->_firstch) | ||
178 | { | ||
179 | free(win->_y); | ||
180 | free(win); | ||
181 | return (WINDOW *)NULL; | ||
182 | } | ||
183 | |||
184 | win->_lastch = malloc(nlines * sizeof(int)); | ||
185 | if (!win->_lastch) | ||
186 | { | ||
187 | free(win->_firstch); | ||
188 | free(win->_y); | ||
189 | free(win); | ||
190 | return (WINDOW *)NULL; | ||
191 | } | ||
192 | |||
193 | /* initialize window variables */ | ||
194 | |||
195 | win->_maxy = nlines; /* real max screen size */ | ||
196 | win->_maxx = ncols; /* real max screen size */ | ||
197 | win->_begy = begy; | ||
198 | win->_begx = begx; | ||
199 | win->_bkgd = ' '; /* wrs 4/10/93 -- initialize background to blank */ | ||
200 | win->_clear = (bool) ((nlines == LINES) && (ncols == COLS)); | ||
201 | win->_bmarg = nlines - 1; | ||
202 | win->_parx = win->_pary = -1; | ||
203 | |||
204 | /* initialize pad variables*/ | ||
205 | |||
206 | win->_pad._pad_y = -1; | ||
207 | win->_pad._pad_x = -1; | ||
208 | win->_pad._pad_top = -1; | ||
209 | win->_pad._pad_left = -1; | ||
210 | win->_pad._pad_bottom = -1; | ||
211 | win->_pad._pad_right = -1; | ||
212 | |||
213 | /* init to say window all changed */ | ||
214 | |||
215 | touchwin(win); | ||
216 | |||
217 | return win; | ||
218 | } | ||
219 | |||
220 | WINDOW *PDC_makelines(WINDOW *win) | ||
221 | { | ||
222 | int i, j, nlines, ncols; | ||
223 | |||
224 | PDC_LOG(("PDC_makelines() - called\n")); | ||
225 | |||
226 | if (!win) | ||
227 | return (WINDOW *)NULL; | ||
228 | |||
229 | nlines = win->_maxy; | ||
230 | ncols = win->_maxx; | ||
231 | |||
232 | for (i = 0; i < nlines; i++) | ||
233 | { | ||
234 | win->_y[i] = malloc(ncols * sizeof(chtype)); | ||
235 | if (!win->_y[i]) | ||
236 | { | ||
237 | /* if error, free all the data */ | ||
238 | |||
239 | for (j = 0; j < i; j++) | ||
240 | free(win->_y[j]); | ||
241 | |||
242 | free(win->_firstch); | ||
243 | free(win->_lastch); | ||
244 | free(win->_y); | ||
245 | free(win); | ||
246 | |||
247 | return (WINDOW *)NULL; | ||
248 | } | ||
249 | } | ||
250 | |||
251 | return win; | ||
252 | } | ||
253 | |||
254 | void PDC_sync(WINDOW *win) | ||
255 | { | ||
256 | PDC_LOG(("PDC_sync() - called:\n")); | ||
257 | |||
258 | if (win->_immed) | ||
259 | wrefresh(win); | ||
260 | if (win->_sync) | ||
261 | wsyncup(win); | ||
262 | } | ||
263 | |||
264 | WINDOW *newwin(int nlines, int ncols, int begy, int begx) | ||
265 | { | ||
266 | WINDOW *win; | ||
267 | |||
268 | PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n", | ||
269 | nlines, ncols, begy, begx)); | ||
270 | |||
271 | if (!nlines) | ||
272 | nlines = LINES - begy; | ||
273 | if (!ncols) | ||
274 | ncols = COLS - begx; | ||
275 | |||
276 | if (!SP || begy + nlines > SP->lines || begx + ncols > SP->cols) | ||
277 | return (WINDOW *)NULL; | ||
278 | |||
279 | win = PDC_makenew(nlines, ncols, begy, begx); | ||
280 | if (win) | ||
281 | win = PDC_makelines(win); | ||
282 | |||
283 | if (win) | ||
284 | werase(win); | ||
285 | |||
286 | return win; | ||
287 | } | ||
288 | |||
289 | int delwin(WINDOW *win) | ||
290 | { | ||
291 | int i; | ||
292 | |||
293 | PDC_LOG(("delwin() - called\n")); | ||
294 | |||
295 | if (!win) | ||
296 | return ERR; | ||
297 | |||
298 | /* subwindows use parents' lines */ | ||
299 | |||
300 | if (!(win->_flags & (_SUBWIN|_SUBPAD))) | ||
301 | for (i = 0; i < win->_maxy && win->_y[i]; i++) | ||
302 | if (win->_y[i]) | ||
303 | free(win->_y[i]); | ||
304 | |||
305 | free(win->_firstch); | ||
306 | free(win->_lastch); | ||
307 | free(win->_y); | ||
308 | free(win); | ||
309 | |||
310 | return OK; | ||
311 | } | ||
312 | |||
313 | int mvwin(WINDOW *win, int y, int x) | ||
314 | { | ||
315 | PDC_LOG(("mvwin() - called\n")); | ||
316 | |||
317 | if (!win || (y + win->_maxy > LINES || y < 0) | ||
318 | || (x + win->_maxx > COLS || x < 0)) | ||
319 | return ERR; | ||
320 | |||
321 | win->_begy = y; | ||
322 | win->_begx = x; | ||
323 | touchwin(win); | ||
324 | |||
325 | return OK; | ||
326 | } | ||
327 | |||
328 | WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) | ||
329 | { | ||
330 | WINDOW *win; | ||
331 | int i, j, k; | ||
332 | |||
333 | PDC_LOG(("subwin() - called: lines %d cols %d begy %d begx %d\n", | ||
334 | nlines, ncols, begy, begx)); | ||
335 | |||
336 | /* make sure window fits inside the original one */ | ||
337 | |||
338 | if (!orig || (begy < orig->_begy) || (begx < orig->_begx) || | ||
339 | (begy + nlines) > (orig->_begy + orig->_maxy) || | ||
340 | (begx + ncols) > (orig->_begx + orig->_maxx)) | ||
341 | return (WINDOW *)NULL; | ||
342 | |||
343 | j = begy - orig->_begy; | ||
344 | k = begx - orig->_begx; | ||
345 | |||
346 | if (!nlines) | ||
347 | nlines = orig->_maxy - j; | ||
348 | if (!ncols) | ||
349 | ncols = orig->_maxx - k; | ||
350 | |||
351 | win = PDC_makenew(nlines, ncols, begy, begx); | ||
352 | if (!win) | ||
353 | return (WINDOW *)NULL; | ||
354 | |||
355 | /* initialize window variables */ | ||
356 | |||
357 | win->_attrs = orig->_attrs; | ||
358 | win->_bkgd = orig->_bkgd; | ||
359 | win->_leaveit = orig->_leaveit; | ||
360 | win->_scroll = orig->_scroll; | ||
361 | win->_nodelay = orig->_nodelay; | ||
362 | win->_delayms = orig->_delayms; | ||
363 | win->_use_keypad = orig->_use_keypad; | ||
364 | win->_immed = orig->_immed; | ||
365 | win->_sync = orig->_sync; | ||
366 | win->_pary = j; | ||
367 | win->_parx = k; | ||
368 | win->_parent = orig; | ||
369 | |||
370 | for (i = 0; i < nlines; i++, j++) | ||
371 | win->_y[i] = orig->_y[j] + k; | ||
372 | |||
373 | win->_flags |= _SUBWIN; | ||
374 | |||
375 | return win; | ||
376 | } | ||
377 | |||
378 | WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) | ||
379 | { | ||
380 | return subwin(orig, nlines, ncols, begy + orig->_begy, begx + orig->_begx); | ||
381 | } | ||
382 | |||
383 | int mvderwin(WINDOW *win, int pary, int parx) | ||
384 | { | ||
385 | int i, j; | ||
386 | WINDOW *mypar; | ||
387 | |||
388 | if (!win || !(win->_parent)) | ||
389 | return ERR; | ||
390 | |||
391 | mypar = win->_parent; | ||
392 | |||
393 | if (pary < 0 || parx < 0 || (pary + win->_maxy) > mypar->_maxy || | ||
394 | (parx + win->_maxx) > mypar->_maxx) | ||
395 | return ERR; | ||
396 | |||
397 | j = pary; | ||
398 | |||
399 | for (i = 0; i < win->_maxy; i++) | ||
400 | win->_y[i] = (mypar->_y[j++]) + parx; | ||
401 | |||
402 | win->_pary = pary; | ||
403 | win->_parx = parx; | ||
404 | |||
405 | return OK; | ||
406 | } | ||
407 | |||
408 | WINDOW *dupwin(WINDOW *win) | ||
409 | { | ||
410 | WINDOW *new; | ||
411 | chtype *ptr, *ptr1; | ||
412 | int nlines, ncols, begy, begx, i; | ||
413 | |||
414 | if (!win) | ||
415 | return (WINDOW *)NULL; | ||
416 | |||
417 | nlines = win->_maxy; | ||
418 | ncols = win->_maxx; | ||
419 | begy = win->_begy; | ||
420 | begx = win->_begx; | ||
421 | |||
422 | new = PDC_makenew(nlines, ncols, begy, begx); | ||
423 | if (new) | ||
424 | new = PDC_makelines(new); | ||
425 | |||
426 | if (!new) | ||
427 | return (WINDOW *)NULL; | ||
428 | |||
429 | /* copy the contents of win into new */ | ||
430 | |||
431 | for (i = 0; i < nlines; i++) | ||
432 | { | ||
433 | for (ptr = new->_y[i], ptr1 = win->_y[i]; | ||
434 | ptr < new->_y[i] + ncols; ptr++, ptr1++) | ||
435 | *ptr = *ptr1; | ||
436 | |||
437 | new->_firstch[i] = 0; | ||
438 | new->_lastch[i] = ncols - 1; | ||
439 | } | ||
440 | |||
441 | new->_curx = win->_curx; | ||
442 | new->_cury = win->_cury; | ||
443 | new->_maxy = win->_maxy; | ||
444 | new->_maxx = win->_maxx; | ||
445 | new->_begy = win->_begy; | ||
446 | new->_begx = win->_begx; | ||
447 | new->_flags = win->_flags; | ||
448 | new->_attrs = win->_attrs; | ||
449 | new->_clear = win->_clear; | ||
450 | new->_leaveit = win->_leaveit; | ||
451 | new->_scroll = win->_scroll; | ||
452 | new->_nodelay = win->_nodelay; | ||
453 | new->_delayms = win->_delayms; | ||
454 | new->_use_keypad = win->_use_keypad; | ||
455 | new->_tmarg = win->_tmarg; | ||
456 | new->_bmarg = win->_bmarg; | ||
457 | new->_parx = win->_parx; | ||
458 | new->_pary = win->_pary; | ||
459 | new->_parent = win->_parent; | ||
460 | new->_bkgd = win->_bkgd; | ||
461 | new->_flags = win->_flags; | ||
462 | |||
463 | return new; | ||
464 | } | ||
465 | |||
466 | WINDOW *wgetparent(const WINDOW *win) | ||
467 | { | ||
468 | PDC_LOG(("wgetparent() - called\n")); | ||
469 | |||
470 | if (!win || !win->_parent) | ||
471 | return NULL; | ||
472 | |||
473 | return win->_parent; | ||
474 | } | ||
475 | |||
476 | WINDOW *resize_window(WINDOW *win, int nlines, int ncols) | ||
477 | { | ||
478 | WINDOW *new; | ||
479 | int i, save_cury, save_curx, new_begy, new_begx; | ||
480 | |||
481 | PDC_LOG(("resize_window() - called: nlines %d ncols %d\n", | ||
482 | nlines, ncols)); | ||
483 | |||
484 | if (!win || !SP) | ||
485 | return (WINDOW *)NULL; | ||
486 | |||
487 | if (win->_flags & _SUBPAD) | ||
488 | { | ||
489 | new = subpad(win->_parent, nlines, ncols, win->_begy, win->_begx); | ||
490 | if (!new) | ||
491 | return (WINDOW *)NULL; | ||
492 | } | ||
493 | else if (win->_flags & _SUBWIN) | ||
494 | { | ||
495 | new = subwin(win->_parent, nlines, ncols, win->_begy, win->_begx); | ||
496 | if (!new) | ||
497 | return (WINDOW *)NULL; | ||
498 | } | ||
499 | else | ||
500 | { | ||
501 | if (win == SP->slk_winptr) | ||
502 | { | ||
503 | new_begy = SP->lines - SP->slklines; | ||
504 | new_begx = 0; | ||
505 | } | ||
506 | else | ||
507 | { | ||
508 | new_begy = win->_begy; | ||
509 | new_begx = win->_begx; | ||
510 | } | ||
511 | |||
512 | new = PDC_makenew(nlines, ncols, new_begy, new_begx); | ||
513 | if (!new) | ||
514 | return (WINDOW *)NULL; | ||
515 | } | ||
516 | |||
517 | save_curx = min(win->_curx, (new->_maxx - 1)); | ||
518 | save_cury = min(win->_cury, (new->_maxy - 1)); | ||
519 | |||
520 | if (!(win->_flags & (_SUBPAD|_SUBWIN))) | ||
521 | { | ||
522 | new = PDC_makelines(new); | ||
523 | if (!new) | ||
524 | return (WINDOW *)NULL; | ||
525 | |||
526 | new->_bkgd = win->_bkgd; | ||
527 | werase(new); | ||
528 | |||
529 | copywin(win, new, 0, 0, 0, 0, min(win->_maxy, new->_maxy) - 1, | ||
530 | min(win->_maxx, new->_maxx) - 1, FALSE); | ||
531 | |||
532 | for (i = 0; i < win->_maxy && win->_y[i]; i++) | ||
533 | if (win->_y[i]) | ||
534 | free(win->_y[i]); | ||
535 | } | ||
536 | |||
537 | new->_flags = win->_flags; | ||
538 | new->_attrs = win->_attrs; | ||
539 | new->_clear = win->_clear; | ||
540 | new->_leaveit = win->_leaveit; | ||
541 | new->_scroll = win->_scroll; | ||
542 | new->_nodelay = win->_nodelay; | ||
543 | new->_delayms = win->_delayms; | ||
544 | new->_use_keypad = win->_use_keypad; | ||
545 | new->_tmarg = (win->_tmarg > new->_maxy - 1) ? 0 : win->_tmarg; | ||
546 | new->_bmarg = (win->_bmarg == win->_maxy - 1) ? | ||
547 | new->_maxy - 1 : min(win->_bmarg, (new->_maxy - 1)); | ||
548 | new->_parent = win->_parent; | ||
549 | new->_immed = win->_immed; | ||
550 | new->_sync = win->_sync; | ||
551 | new->_bkgd = win->_bkgd; | ||
552 | |||
553 | new->_curx = save_curx; | ||
554 | new->_cury = save_cury; | ||
555 | |||
556 | free(win->_firstch); | ||
557 | free(win->_lastch); | ||
558 | free(win->_y); | ||
559 | |||
560 | *win = *new; | ||
561 | free(new); | ||
562 | |||
563 | return win; | ||
564 | } | ||
565 | |||
566 | int wresize(WINDOW *win, int nlines, int ncols) | ||
567 | { | ||
568 | return (resize_window(win, nlines, ncols) ? OK : ERR); | ||
569 | } | ||
570 | |||
571 | void wsyncup(WINDOW *win) | ||
572 | { | ||
573 | WINDOW *tmp; | ||
574 | |||
575 | PDC_LOG(("wsyncup() - called\n")); | ||
576 | |||
577 | for (tmp = win; tmp; tmp = tmp->_parent) | ||
578 | touchwin(tmp); | ||
579 | } | ||
580 | |||
581 | int syncok(WINDOW *win, bool bf) | ||
582 | { | ||
583 | PDC_LOG(("syncok() - called\n")); | ||
584 | |||
585 | if (!win) | ||
586 | return ERR; | ||
587 | |||
588 | win->_sync = bf; | ||
589 | |||
590 | return OK; | ||
591 | } | ||
592 | |||
593 | bool is_subwin(const WINDOW *win) | ||
594 | { | ||
595 | PDC_LOG(("is_subwin() - called\n")); | ||
596 | |||
597 | if (!win) | ||
598 | return FALSE; | ||
599 | |||
600 | return ((win->_flags & _SUBWIN) ? TRUE : FALSE); | ||
601 | } | ||
602 | |||
603 | bool is_syncok(const WINDOW *win) | ||
604 | { | ||
605 | PDC_LOG(("is_syncok() - called\n")); | ||
606 | |||
607 | if (!win) | ||
608 | return FALSE; | ||
609 | |||
610 | return win->_sync; | ||
611 | } | ||
612 | |||
613 | void wcursyncup(WINDOW *win) | ||
614 | { | ||
615 | WINDOW *tmp; | ||
616 | |||
617 | PDC_LOG(("wcursyncup() - called\n")); | ||
618 | |||
619 | for (tmp = win; tmp && tmp->_parent; tmp = tmp->_parent) | ||
620 | wmove(tmp->_parent, tmp->_pary + tmp->_cury, tmp->_parx + tmp->_curx); | ||
621 | } | ||
622 | |||
623 | void wsyncdown(WINDOW *win) | ||
624 | { | ||
625 | WINDOW *tmp; | ||
626 | |||
627 | PDC_LOG(("wsyncdown() - called\n")); | ||
628 | |||
629 | for (tmp = win; tmp; tmp = tmp->_parent) | ||
630 | { | ||
631 | if (is_wintouched(tmp)) | ||
632 | { | ||
633 | touchwin(win); | ||
634 | break; | ||
635 | } | ||
636 | } | ||
637 | } | ||