summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/TESTS/copy.c
blob: 013f9dbe4237663f4b865df5856cdfc78805a653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <ncurses.h>

main()
{
WINDOW *win1, *win2;
int h, i;

	initscr();
	cbreak();
	noecho();
	win1 = newwin(20, 50, 0, 20);
	for (h = 0; h < 20; h++)
		for (i = 0; i < 50; i++)
			mvwaddch(win1, h, i, 'X');
	wrefresh(win1);
	getch();

	win2 = newwin(20, 50, 3, 30);
	for (h = 0; h < 20; h++)
		for (i = 0; i < 50; i++)
			mvwaddch(win2, h, i, 'Y');
	wnoutrefresh(win1);
	wnoutrefresh(win2);
	doupdate();
	getch();

	/* now, remove window 2 and restore the contents of window 1 */
	i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0);
	wnoutrefresh(win1);
	wnoutrefresh(win2);
	printw("copywin returns %d\n", i);
	wnoutrefresh(stdscr);
	doupdate();

	getch();

	endwin();
}

OpenPOWER on IntegriCloud