aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/tedit/display/curses/delwin.x
blob: 5b0db1923ba6e1559a42f79d13384ed9d9cd6384 (plain) (blame)
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
40
41
42
include "../curses.h"
include "window.h"

# DELWIN --Delete a window
#
# B.Simon	28-Sep-90	Original

procedure delwin (win)

int	win		# i: Window descriptor
#--
include	"window.com"

int	rect[RSIZE]
pointer pwin

begin
	# Can't free the standard screen

	if (win == STDSCR)
	    return

	pwin = warray[win]

	# Copy the screen under the window back to the terminal
	# and then free the buffer which held it

	if (WIN_BUFFER(pwin) != NULL) {
	    call wrect (win, YES, rect)
	    call putscreen (rect, WIN_BUFFER(pwin))
	    call freescreen (WIN_BUFFER(pwin))
	}

	# Free any data structure associated with the window

	if (WIN_DATA(pwin) != NULL)
	    call mfree (WIN_DATA(pwin), TY_STRUCT)

	call mfree (pwin, TY_STRUCT)
	warray[win] = NULL

end