problem with screen update optimization in curses

Brandon S. Allbery KB8JRR allbery at NCoast.ORG
Thu Jan 24 12:23:22 AEST 1991


As quoted from <1991Jan23.202536.1406 at IRO.UMontreal.CA> by babin at IRO.UMontreal.CA (Gilbert Babin):
+---------------
| on UNIX (SUN).  Unfortunately, when refreshing the screen in Unix,
| it optimizes the flow of characters sent to the screen, which
| does not occur under VMS, which will always completely refresh.
| I tried using touchwin() before refreshing evry window, but for
| each window update the 3 or 4 layered windows flicker.  This
| becomes annoying when it occurs every time you type a character...
+---------------

Depends on the version of SunOS.  If you have a version with System V
libraries, use the System V curses:  it has two ways of optimizing output.
Sufficiently recent versions of the BSD curses may also possess one of these
mechanisms.

The first way of doing this is to use delayed refresh.  Refresh each window by
calling wnoutrefresh(win), then call doupdate() when you're done; this allows
curses to optimize *between* the window refreshes, and thereby do no output
for obsured parts of windows.

The second, which is fairly recent and likely not to be in the BSD-style
curses that is probably the default on SunOS, is to use echochar().  This
function is used exactly like addch(), but it sends output to the screen
*immediately* if other refresh operations are not needed.  It bypasses the
refresh() mechanism when it can, so output is very rapid.  (wechochar(win, ch)
is the version used on windows other than stdscr.)

If neither is available, you're stuck unless you hand-optimize by only
refreshing the current window and letting pending refreshes to other windows
sit until you absolutely need them.  Unfortunately, if you *do* want
"background updates" of partially visible windows, you're stuck.  (This is why
the wnoutrefresh()/doupdate() mechanism was developed.)

++Brandon
-- 
Me: Brandon S. Allbery			    VHF/UHF: KB8JRR on 220, 2m, 440
Internet: allbery at NCoast.ORG		    Packet: KB8JRR @ WA8BXN
America OnLine: KB8JRR			    AMPR: KB8JRR.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery    Delphi: ALLBERY



More information about the Comp.unix.programmer mailing list