Merge branch 'master' into resize
authorTimo Korvola <tkorvola@iki.fi>
Tue, 20 Feb 2018 16:56:07 +0000 (18:56 +0200)
committerTimo Korvola <tkorvola@iki.fi>
Tue, 20 Feb 2018 16:56:07 +0000 (18:56 +0200)
1  2 
src/common/frotz.h
src/curses/ux_init.c
src/curses/ux_input.c

index de8ea449cec53ced8afe3991f5c71682fd9e1e9b,5794e4b7f2bd26fdd81e8cd4846208bae41a8419..b465d79f15b309099d8f7820acec9e7133a56262
@@@ -788,10 -789,4 +789,11 @@@ void     os_stop_sample ()
  int   os_string_width (const zchar *);
  void  os_init_setup (void);
  void  os_warn (const char *, ...);
+ void  os_quit (void);
 +
 +/* Front ends call this if the terminal size changes. */
 +void    resize_screen(void);
 +
 +/* This is callable only from resize_screen. */
 +bool    os_repaint_window (int win, int ypos_old, int ypos_new, int xpos,
 +                           int ysize, int xsize);
Simple merge
index 877e0f19e3e0c510dc58299c80dc20117c049d67,b6bec9c1f14cdf2eb61328312cdf0e87972dfe45..9268e300e19f1e11bcc2cbf98ea188e0eeaf3f4d
@@@ -185,20 -144,30 +185,18 @@@ static int unix_read_char(int extkeys
        /* On many terminals the backspace key returns DEL. */
        if (c == erasechar()) return ZC_BACKSPACE;;
  
-       if (c == killchar()) return ZC_ESCAPE;
        switch(c) {
 -      /* Normally ERR means timeout.  I suppose we might also get
 -         ERR if a signal hits getch. */
 +      /* This should not happen because select said we have input. */
        case ERR:
 -          if (timeout_to_ms() == 0)
 -              return ZC_TIME_OUT;
 -          else
 -              continue;
 -
 -/*
 - * Under ncurses, getch() will return OK (defined to 0) when Ctrl-@ or
 - * Ctrl-Space is pressed.  0 is also the ZSCII character code for
 - * ZC_TIME_OUT.  This causes a fatal error "Call to non-routine", after
 - * which Frotz aborts.  This doesn't happen with all games nor is the
 - * crashing consistent.  Sometimes repeated tests on a single game will
 - * yield some crashes and some non-crashes.  When linked with ncurses,
 - * we must make sure that unix_read_char() does not return a bogus
 - * ZC_TIME_OUT.
 - *
 - */
 -#ifdef USE_NCURSES_H
 +      /* Ignore NUL (ctrl+space or ctrl+@ on many terminals) because it
 +         would be misinterpreted as timeout (ZC_TIME_OUT == 0). */
        case 0:
 -              continue;
 -#endif /* USE_NCURSES_H */
 +      /* Ncurses appears to produce KEY_RESIZE even if we handle SIGWINCH
 +         ourselves. */
 +#ifdef KEY_RESIZE
 +      case KEY_RESIZE:
 +#endif
 +          continue;
  
        /* Screen decluttering. */
        case MOD_CTRL ^ 'L': case MOD_CTRL ^ 'R':