1
/****************************************************************************
2
* Copyright (c) 2006,2007 Free Software Foundation, Inc. *
4
* Permission is hereby granted, free of charge, to any person obtaining a *
5
* copy of this software and associated documentation files (the *
6
* "Software"), to deal in the Software without restriction, including *
7
* without limitation the rights to use, copy, modify, merge, publish, *
8
* distribute, distribute with modifications, sublicense, and/or sell *
9
* copies of the Software, and to permit persons to whom the Software is *
10
* furnished to do so, subject to the following conditions: *
12
* The above copyright notice and this permission notice shall be included *
13
* in all copies or substantial portions of the Software. *
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23
* Except as contained in this notice, the name(s) of the above copyright *
24
* holders shall not be used in advertising or otherwise to promote the *
25
* sale, use or other dealings in this Software without prior written *
27
****************************************************************************/
29
* $Id: redraw.c,v 1.4 2007/06/30 17:55:06 tom Exp $
31
* Demonstrate the redrawwin() and wredrawln() functions.
32
* Thomas Dickey - 2006/11/4
35
#include <test.priv.h>
38
trash(int beg_x, int max_x, int cur_x)
42
for (x = cur_x; x > beg_x; --x) {
45
for (x = beg_x; x < max_x; ++x) {
53
for (x = max_x; x > cur_x; --x) {
59
test_redraw(WINDOW *win)
70
getmaxyx(win, max_y, max_x);
71
getbegyx(win, beg_y, beg_x);
82
win1 = newwin(max_y, max_x,
84
win2 = newwin(max_y - 2, max_x - 2,
85
beg_y + 1, beg_x + 1);
99
* redrawwin() and wredrawln() do not take into account the
100
* possibility that the cursor may have moved. That makes them
101
* cumbersome for using with a shell command. So we simply
102
* trash the current line of the window using backspace/overwrite.
104
trash(beg_x, max_x, x + beg_x);
107
#ifdef NCURSES_VERSION
110
* For a shell command, we can work around the problem noted above
111
* using mvcur(). It is ifdef'd for NCURSES, since X/Open does
112
* not define the case where the old location is unknown.
124
wredrawln(win, y, 1);
129
wmove(win, y - 1, x);
134
wmove(win, y + 1, x);
139
wmove(win, y, x - 1);
144
wmove(win, y, x + 1);
149
waddstr(win, keyname(ch));
151
waddstr(win, unctrl(UChar(ch)));
161
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
168
ExitProgram(EXIT_SUCCESS);