Lines Matching defs:win
45 static int __resizeterm(WINDOW *win, int nlines, int ncols);
46 static int __resizewin(WINDOW *win, int nlines, int ncols);
53 wresize(WINDOW *win, int req_nlines, int req_ncols)
58 if (__predict_false(win == NULL))
62 win, nlines, ncols);
63 if (win->orig != NULL) {
65 if (win->begy > win->orig->begy + win->orig->maxy)
66 win->begy = win->orig->begy + win->orig->maxy - 1;
67 if (win->begy + nlines > win->orig->begy + win->orig->maxy)
70 nlines += win->orig->begy + win->orig->maxy - win->begy;
73 if (win->begx > win->orig->begx + win->orig->maxx)
74 win->begx = win->orig->begx + win->orig->maxx - 1;
75 if (win->begx + ncols > win->orig->begx + win->orig->maxx)
78 ncols += win->orig->begx + win->orig->maxx - win->begx;
81 } else if (!(win->flags & __ISPAD)) {
83 if (win == curscr || win == __virtscr || win == stdscr) {
93 if (win->begy > LINES)
94 win->begy = 0;
95 if (win->begy + nlines > LINES)
98 nlines += LINES - win->begy;
101 if (win->begx > COLS)
102 win->begx = 0;
103 if (win->begx + ncols > COLS)
106 ncols += COLS - win->begx;
112 if ((__resizewin(win, nlines, ncols)) == ERR)
115 win->reqy = req_nlines;
116 win->reqx = req_ncols;
119 if (win == curscr) {
183 WINDOW *win;
207 win = list->winp;
209 if (!(win->flags & __ISPAD))
210 __swflags(win);
225 __resizeterm(WINDOW *win, int nlines, int ncols)
229 newlines = win->reqy;
230 if (win->begy + newlines >= nlines)
233 newlines = nlines - win->begy;
235 newcols = win->reqx;
236 if (win->begx + newcols >= ncols)
239 newcols = ncols - win->begx;
241 return __resizewin(win, newlines, newcols);
249 __resizewin(WINDOW *win, int nlines, int ncols)
258 __CTRACE(__CTRACE_WINDOW, "resize: (%p, %d, %d)\n", win, nlines, ncols);
259 __CTRACE(__CTRACE_WINDOW, "resize: win->wattr = %08x\n", win->wattr);
260 __CTRACE(__CTRACE_WINDOW, "resize: win->flags = %#.4x\n", win->flags);
261 __CTRACE(__CTRACE_WINDOW, "resize: win->maxy = %d\n", win->maxy);
262 __CTRACE(__CTRACE_WINDOW, "resize: win->maxx = %d\n", win->maxx);
263 __CTRACE(__CTRACE_WINDOW, "resize: win->begy = %d\n", win->begy);
264 __CTRACE(__CTRACE_WINDOW, "resize: win->begx = %d\n", win->begx);
265 __CTRACE(__CTRACE_WINDOW, "resize: win->scr_t = %d\n", win->scr_t);
266 __CTRACE(__CTRACE_WINDOW, "resize: win->scr_b = %d\n", win->scr_b);
273 __cursesi_win_free_nsp(win);
280 newlines = realloc(win->alines, nlines * sizeof(__LINE *));
283 win->alines = newlines;
285 newlspace = realloc(win->lspace, nlines * sizeof(__LINE));
288 win->lspace = newlspace;
292 if (win->orig == NULL) {
297 newwspace = realloc(win->wspace,
301 win->wspace = newwspace;
308 for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
309 win->alines[i] = lp;
310 lp->line = &win->wspace[i * ncols];
322 win->ch_off = win->begx - win->orig->begx;
324 for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
325 win->alines[i] = lp;
326 olp = win->orig->alines[i + win->begy - win->orig->begy];
327 lp->line = &olp->line[win->ch_off];
337 win->cury = win->curx = 0;
338 win->maxy = nlines;
339 win->maxx = ncols;
340 win->scr_b = win->maxy - 1;
341 __swflags(win);
349 for (i = 0; i < win->maxy; i++) {
350 lp = win->alines[i];
351 for (sp = lp->line, j = 0; j < win->maxx; j++, sp++) {
355 sp->ch = win->bch;
357 sp->ch = (wchar_t)btowc((int)win->bch);
359 if (_cursesi_copy_nsp(win->bnsp, sp) == ERR)
367 __CTRACE(__CTRACE_WINDOW, "resize: win->wattr = %08x\n", win->wattr);
368 __CTRACE(__CTRACE_WINDOW, "resize: win->flags = %#.4x\n", win->flags);
369 __CTRACE(__CTRACE_WINDOW, "resize: win->maxy = %d\n", win->maxy);
370 __CTRACE(__CTRACE_WINDOW, "resize: win->maxx = %d\n", win->maxx);
371 __CTRACE(__CTRACE_WINDOW, "resize: win->begy = %d\n", win->begy);
372 __CTRACE(__CTRACE_WINDOW, "resize: win->begx = %d\n", win->begx);
373 __CTRACE(__CTRACE_WINDOW, "resize: win->scr_t = %d\n", win->scr_t);
374 __CTRACE(__CTRACE_WINDOW, "resize: win->scr_b = %d\n", win->scr_b);
376 if (win->orig == NULL) {
378 for (swin = win->nextp; swin != win; swin = swin->nextp) {
380 if (swin->begy > win->begy + win->maxy)
381 swin->begy = win->begy + win->maxy - 1;
382 if (swin->begy + y > win->begy + win->maxy)
385 y += win->begy + win->maxy - swin->begy;
389 if (swin->begx > win->begx + win->maxx)
390 swin->begx = win->begx + win->maxx - 1;
391 if (swin->begx + x > win->begx + win->maxx)
394 x += win->begx + win->maxx - swin->begx;