Next: Illustrating ncurses Initialization and
Up: Screen Manipulation with ncurses
Previous: Screen Manipulation with ncurses
- Screen; Screen refers to the physical terminal screen in character or console mode. Under the X Window system, screen means a terminal emulator window.
- Window; Window is used to refer to an independent rectangular area displayed on a screen. It may or may not be the same size as the screen.
- stdscr; This is an ncurses data structure, a (WINDOW *), that represents what you currently see on the screen. It might be one window or a set of windows, but it fills the entire screen. You can think of it as a palette on which you paint using ncurses routines.
- curscr; Another pointer to a WINDOW data structure, curscr contains ncurses' idea of what the screen currently looks like. Like stdscr, its size is the width and height of the screen. Differences between curscr and stdscr are the changes that
appear on the screen.
- Refresh; This word refers both to an ncurses function call and a logical process. The refresh() function compares curscr, ncurses' notion of what the screen currently looks like, to stdscr, updates any changes to curscr, and then displays
those changes to the screen. Refresh is also used to denote the process of updating the screen.
- Cursor; This term, like refresh, has two similar meanings, but always refers to the location where the next character will be displayed. On a screen (the physical screen), cursor refers to the location of the physical cursor. On a window (an ncurses window), it refers to the logical location where the next character will be displayed.
Generally, in this chapter, the second meaning applies. ncurses uses a (y,x)
ordered pair to locate the cursor on a window.
- ncurses defines window layout sanely and predictably. Windows are arranged such that the upper-left corner has the coordinates (0,0) and the lower-right corner has the coordinates (LINES, COLUMNS). Rather than using these global variables, however, use the function call getmaxyx() to get the size of the window with which you are currently working.
- ncurses' Function Naming Conventions;
- the move(y,x) call, which moves the cursor to the coordinates specified by y and x on stdscr,
- but wmove(win, y, x), which moves the cursor to the specified location in the window win.
- That is, move(y, x); is equivalent to wmove(stdscr, y, x).
Next: Illustrating ncurses Initialization and
Up: Screen Manipulation with ncurses
Previous: Screen Manipulation with ncurses
Cem Ozdogan
2007-05-14