Menu

#62 touchwin() after endwin()

open
None
5
2015-02-25
2008-05-15
No

When a curses mode program calls def_prog_mode() to
save the tty settings, and then calls endwin(),
external commands can be run that "alter the
physical" screen.

Upon exit from that, the same curses program would
then call reset_prog_mode() to restore the tty
settings for curses use, and all is good up to
this point.

From this point on, the screen is foo-barred
with the previous external program's output.

Ncurses seems to switch from one screen back to the
"curses screen", thus restoring the content (assuming
the terminal has this capability). However, in PDCurses,
this does not happen. This is ok, but...

To recover the former content, I tried to use,
touchwin(stdscr) followed by a refresh, but this
has no effect at all.

At present, it appears that the only option
available to me to set PDCurses right again,
is to call wclear().

I would have expected that the touchwin() approach
would have fixed this.

Warren.

Discussion

  • William McBrine

    William McBrine - 2008-05-16

    Logged In: YES
    user_id=27933
    Originator: NO

    It should work better if you _don't_ call def_prog_mode() and reset_prog_mode(). First, they're called automatically. Second, calling reset_prog_mode() before refresh() trashes the flag that lets PDCurses know you're coming back from endwin(). You should just call refresh().

    But I'm not sure why touchwin() wouldn't work for you. I'll check that.

     
  • William McBrine

    William McBrine - 2008-05-16
    • assigned_to: nobody --> wmcbrine
     
  • Warren W. Gay VE3WWG

    Logged In: YES
    user_id=560482
    Originator: YES

    Ok, I see that you're correct about def_prog_mode() being redundant. I have
    removed that and confirmed that to ok with cygwin/ncurses.

    Unfortunately, I just realized that I broke my MinGW environement.
    I installed a new Berkeley DB, which isn't compatible with the 32-bit
    only gcc under MinGW (I need BDB to build this project). Once
    I get this resolved, I'll retest. But that may be a few weeks from
    now.

    Warren.

     
MongoDB Logo MongoDB