Module Name: src
Committed By: roy
Date: Wed Oct 3 13:22:29 UTC 2018
Modified Files:
src/lib/libcurses: curses_private.h resize.c ripoffline.c
Log Message:
curses: resize ripped off windows
The application must still redraw them though.
To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.28 -r1.29 src/lib/libcurses/resize.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/ripoffline.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcurses/curses_private.h
diff -u src/lib/libcurses/curses_private.h:1.64 src/lib/libcurses/curses_private.h:1.65
--- src/lib/libcurses/curses_private.h:1.64 Tue Oct 2 17:35:44 2018
+++ src/lib/libcurses/curses_private.h Wed Oct 3 13:22:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: curses_private.h,v 1.64 2018/10/02 17:35:44 roy Exp $ */
+/* $NetBSD: curses_private.h,v 1.65 2018/10/03 13:22:29 roy Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@@ -379,7 +379,7 @@ void __restore_termios(void);
void __restore_stophandler(void);
void __restore_winchhandler(void);
int __ripoffscreen(SCREEN *);
-void __ripoffresize(SCREEN *);
+int __ripoffresize(SCREEN *);
void __ripofftouch(SCREEN *);
int __rippedlines(const SCREEN *, int);
void __save_termios(void);
Index: src/lib/libcurses/resize.c
diff -u src/lib/libcurses/resize.c:1.28 src/lib/libcurses/resize.c:1.29
--- src/lib/libcurses/resize.c:1.28 Tue Oct 2 17:35:44 2018
+++ src/lib/libcurses/resize.c Wed Oct 3 13:22:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: resize.c,v 1.28 2018/10/02 17:35:44 roy Exp $ */
+/* $NetBSD: resize.c,v 1.29 2018/10/03 13:22:29 roy Exp $ */
/*
* Copyright (c) 2001
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)resize.c blymn 2001/08/26";
#else
-__RCSID("$NetBSD: resize.c,v 1.28 2018/10/02 17:35:44 roy Exp $");
+__RCSID("$NetBSD: resize.c,v 1.29 2018/10/03 13:22:29 roy Exp $");
#endif
#endif /* not lint */
@@ -176,10 +176,7 @@ resizeterm(int nlines, int ncols)
clearok(curscr, TRUE);
if (result == OK) {
- /* We know how to repaint the ripoffs */
- __ripoffresize(_cursesi_screen);
-
- /* We do need to reposition our slks. */
+ /* Redraw the soft label keys to the new size. */
__slk_resize(_cursesi_screen, ncols);
__slk_noutrefresh(_cursesi_screen);
}
@@ -218,12 +215,7 @@ resize_term(int nlines, int ncols)
LINES = nlines;
COLS = ncols;
- if (_cursesi_screen->slk_window != NULL &&
- __resizewin(_cursesi_screen->slk_window,
- _cursesi_screen->slk_window->reqy, ncols) == ERR)
- return ERR;
-
- /* tweak the flags now that we have updated the LINES and COLS */
+ /* tweak the flags now that we have updated the LINES and COLS */
for (list = _cursesi_screen->winlistp; list != NULL; list = list->nextp) {
win = list->winp;
@@ -231,6 +223,10 @@ resize_term(int nlines, int ncols)
__swflags(win);
}
+ /* Resize and re-position the ripped off windows. */
+ if (__ripoffresize(_cursesi_screen) == ERR)
+ return ERR;
+
return OK;
}
Index: src/lib/libcurses/ripoffline.c
diff -u src/lib/libcurses/ripoffline.c:1.4 src/lib/libcurses/ripoffline.c:1.5
--- src/lib/libcurses/ripoffline.c:1.4 Tue Oct 2 17:35:44 2018
+++ src/lib/libcurses/ripoffline.c Wed Oct 3 13:22:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ripoffline.c,v 1.4 2018/10/02 17:35:44 roy Exp $ */
+/* $NetBSD: ripoffline.c,v 1.5 2018/10/03 13:22:29 roy Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ripoffline.c,v 1.4 2018/10/02 17:35:44 roy Exp $");
+__RCSID("$NetBSD: ripoffline.c,v 1.5 2018/10/03 13:22:29 roy Exp $");
#endif /* not lint */
#include "curses.h"
@@ -138,22 +138,28 @@ __ripoffscreen(SCREEN *screen)
* Called from resizeterm to ensure the ripped off lines are correctly
* placed and refreshed.
*/
-void
+int
__ripoffresize(SCREEN *screen)
{
- int rbot = screen->LINES, i;
+ int rbot = screen->LINES, i, nlines, ret = OK;
struct __ripoff *rip;
for (i = 0, rip = screen->ripped; i < screen->nripped; i++, rip++) {
- if (rip->nlines > 0)
- touchwin(rip->win);
- else {
+ if (rip->nlines == 0)
+ continue;
+ nlines = rip->nlines < 0 ? -rip->nlines : rip->nlines;
+ if (wresize(rip->win, nlines, screen->COLS) == ERR)
+ ret = ERR;
+ if (rip->nlines < 0) {
/* Reposition the lower windows. */
- mvwin(rip->win, rbot + rip->nlines, 0);
- rbot += rip->nlines;
+ if (mvwin(rip->win, rbot + rip->nlines, 0) == ERR)
+ ret = ERR;
+ else
+ rbot += rip->nlines;
}
- wnoutrefresh(rip->win);
}
+
+ return ret;
}
/*