Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses wresize: don't bound pads to the size of the s...



details:   https://anonhg.NetBSD.org/src/rev/0746b7695555
branches:  trunk
changeset: 983552:0746b7695555
user:      nia <nia%NetBSD.org@localhost>
date:      Sat May 29 09:11:14 2021 +0000

description:
wresize: don't bound pads to the size of the screen

allows avoiding a workaround in aiomixer,

ok blymn uwe

diffstat:

 lib/libcurses/resize.c |  42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diffs (70 lines):

diff -r 0e8ba91f4dfd -r 0746b7695555 lib/libcurses/resize.c
--- a/lib/libcurses/resize.c    Sat May 29 08:46:38 2021 +0000
+++ b/lib/libcurses/resize.c    Sat May 29 09:11:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: resize.c,v 1.30 2018/11/02 04:17:39 blymn Exp $        */
+/*     $NetBSD: resize.c,v 1.31 2021/05/29 09:11:14 nia Exp $  */
 
 /*
  * Copyright (c) 2001
@@ -33,7 +33,7 @@
 #if 0
 static char sccsid[] = "@(#)resize.c   blymn 2001/08/26";
 #else
-__RCSID("$NetBSD: resize.c,v 1.30 2018/11/02 04:17:39 blymn Exp $");
+__RCSID("$NetBSD: resize.c,v 1.31 2021/05/29 09:11:14 nia Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -62,7 +62,25 @@
        __CTRACE(__CTRACE_WINDOW, "wresize: (%p, %d, %d)\n",
            win, nlines, ncols);
 #endif
-       if (win->orig == NULL) {
+       if (win->orig != NULL) {
+               /* subwins must fit inside the parent - check this */
+               if (win->begy > win->orig->begy + win->orig->maxy)
+                       win->begy = win->orig->begy + win->orig->maxy - 1;
+               if (win->begy + nlines > win->orig->begy + win->orig->maxy)
+                       nlines = 0;
+               if (nlines <= 0)
+                       nlines += win->orig->begy + win->orig->maxy - win->begy;
+               if (nlines < 1)
+                       nlines = 1;
+               if (win->begx > win->orig->begx + win->orig->maxx)
+                       win->begx = win->orig->begx + win->orig->maxx - 1;
+               if (win->begx + ncols > win->orig->begx + win->orig->maxx)
+                       ncols = 0;
+               if (ncols <= 0)
+                       ncols += win->orig->begx + win->orig->maxx - win->begx;
+               if (ncols < 1)
+                       ncols = 1;
+       } else if (!(win->flags & __ISPAD)) {
                /* bound "our" windows by the screen size */
                if (win == curscr || win == __virtscr || win == stdscr) {
                        if (nlines > LINES)
@@ -91,24 +109,6 @@
                        if (ncols < 1)
                                ncols = 1;
                }
-       } else {
-               /* subwins must fit inside the parent - check this */
-               if (win->begy > win->orig->begy + win->orig->maxy)
-                       win->begy = win->orig->begy + win->orig->maxy - 1;
-               if (win->begy + nlines > win->orig->begy + win->orig->maxy)
-                       nlines = 0;
-               if (nlines <= 0)
-                       nlines += win->orig->begy + win->orig->maxy - win->begy;
-               if (nlines < 1)
-                       nlines = 1;
-               if (win->begx > win->orig->begx + win->orig->maxx)
-                       win->begx = win->orig->begx + win->orig->maxx - 1;
-               if (win->begx + ncols > win->orig->begx + win->orig->maxx)
-                       ncols = 0;
-               if (ncols <= 0)
-                       ncols += win->orig->begx + win->orig->maxx - win->begx;
-               if (ncols < 1)
-                       ncols = 1;
        }
 
        if ((__resizewin(win, nlines, ncols)) == ERR)



Home | Main Index | Thread Index | Old Index