Curses Problem

andre andre at targon.UUCP
Wed Dec 14 20:14:48 AEST 1988


In article <263 at madnix.UUCP> ray at madnix.UUCP (Ray P. Hill) writes:
>	Why does the following curses code sample produce a different output
>	on UNIX systems?
Because some implementations are not correct, the berkeley curses manual
speaks of overwrite at the same x y coordinates, but the terminfo curses
manual just speaks of overwriting. On the system I am on, a Pyramid only
the row information is used. The 'broken' picture becomes:
|------|
|      |
|------|
|      |
|      |
|------|

>/*  COMPILE WITH:
> *  cc -O -o test test.c -lcurses -ltermcap
> */
Making the name 'test' was a joke, right?

The way I 'solved' the wrong behaviour of the pyramid curses was to
make a subwin on the screen I wanted to overwrite with the same dimensions
& the same position as the source window. This will work on all curses'es

    WINDOW *w, *subw;
    initscr();
    w = newwin(10, 10, 5, 5);
    subw = subwin(stdscr, 10, 10, 5, 5);
    box(w, 0, 0);
    overwrite(w, subw);

Or, if you know the size and position of all windows in your application
you can use a function like:

    my_overwrite(src, dest, lines, cols, orgy, orgx)
    WINDOW *src, *dest;
    int lines, cols, orgy, orgx);
    {
	    WINDOW *sub = subwin(dest, lines, cols, orgy, orgx);

	    if (sub)
	    {
		overwrite(src, sub);
		delwin(sub);
	    }
    }

By the way, beware of overwrite with curscr.

	Hope this helps, Andre

-- 
~----~ |m    AAA         DDDD  It's not the kill, but the thrill of the chase.
~|d1|~@--   AA AAvv   vvDD  DD        Segment registers are for worms.
~----~  &  AAAAAAAvv vvDD  DD
~~~~~~ -- AAA   AAAvvvDDDDDD        Andre van Dalen, uunet!mcvax!targon!andre



More information about the Comp.unix.wizards mailing list