redo tty resizing
Rest of 'not PR #1102'. Resizing the terminal while getpos was in operation recalculated the map from scratch instead of redrawing what the core considers to already be shown. And it was always operating while an asynchronous signal was excuting which could potentially clobber whatever was running at the time the signal arrived. This uses same redrawing as the prior '^R during getpos()' fix. It also only performs the resize while tty_nhgetch() is waiting for input. If that is the situation at the time that the signal arrives then it will resize immediately (while in the asynchronous signal handler); if not, it will set a flag and tty_nhgetch() will do the resize the next time it gets called. This builds with TTY_PERM_INVENT enabled and doesn't seem to be any worse than before, but there are bugs with that. The only way I could get perminv to appear was to save and restore, then perm_invent was honored for both RC file and mO command. And once I managed to get it to display, moving an item from a lower case slot to slot 'A', made that item vanish; nothing appeared in the invent's right hand panel. Both of those misbehaviors already happen prior to this commit. I also saw an abort+panictrace if I resized while at the "Dump core?" prompt when running the pre-commit code and didn't see that with the post-commit code (although the prompt wasn't shown so I couldn't tell that it was waiting for an answer). The abort probably sounds scarier than it warrants; I suspect that the pre-commit code just treated the resize as answering 'y' for some reason, possibly a stale value in the variable it uses.
This commit is contained in:
@@ -381,6 +381,7 @@ struct instance_globals_g {
|
||||
coordxy gbuf_stop[ROWNO];
|
||||
|
||||
/* do_name.c */
|
||||
coordxy getposx, getposy; /* cursor position in case of async resize */
|
||||
struct selectionvar *gloc_filter_map;
|
||||
int gloc_filter_floodfill_match_glyph;
|
||||
|
||||
|
||||
@@ -3278,6 +3278,9 @@ ATTRNORETURN extern void error (const char *, ...) PRINTF_F(1, 2) NORETURN;
|
||||
#ifdef TIMED_DELAY
|
||||
extern void msleep(unsigned);
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
extern void getwindowsz(void);
|
||||
#endif
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
extern void tty_utf8graphics_fixup(void);
|
||||
#endif
|
||||
|
||||
@@ -775,6 +775,13 @@ struct sinfo {
|
||||
interface to suppress menu commands in similar conditions;
|
||||
readchar() alrways resets it to 'otherInp' prior to returning */
|
||||
int input_state; /* whether next key pressed will be entering a command */
|
||||
#ifdef TTY_GRAPHICS
|
||||
/* resize_pending only matters when handling a SIGWINCH signal for tty;
|
||||
getting_char is used along with that and also separately for UNIX;
|
||||
we minimize #if conditionals for them to avoid unnecessary clutter */
|
||||
volatile int resize_pending; /* set by signal handler */
|
||||
volatile int getting_char; /* referenced during signal handling */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* value of program_state.input_state, significant during readchar();
|
||||
|
||||
@@ -45,16 +45,17 @@ typedef struct tty_mi {
|
||||
|
||||
/* descriptor for tty-based windows */
|
||||
struct WinDesc {
|
||||
int flags; /* window flags */
|
||||
xint16 type; /* type of window */
|
||||
boolean active; /* true if window is active */
|
||||
short offx, offy; /* offset from topleft of display */
|
||||
long rows, cols; /* dimensions */
|
||||
long curx, cury; /* current cursor position */
|
||||
long maxrow, maxcol; /* the maximum size used -- for MENU wins */
|
||||
int flags; /* window flags */
|
||||
xint16 type; /* type of window */
|
||||
boolean active; /* true if window is active */
|
||||
boolean blanked; /* for erase_tty_screen(); not used [yet?] */
|
||||
short offx, offy; /* offset from topleft of display */
|
||||
long rows, cols; /* dimensions */
|
||||
long curx, cury; /* current cursor position */
|
||||
long maxrow, maxcol; /* the maximum size used -- for MENU wins;
|
||||
* maxcol is also used by WIN_MESSAGE for
|
||||
* tracking the ^P command */
|
||||
unsigned long mbehavior; /* menu behavior flags (MENU) */
|
||||
/* maxcol is also used by WIN_MESSAGE for */
|
||||
/* tracking the ^P command */
|
||||
short *datlen; /* allocation size for *data */
|
||||
char **data; /* window data [row][column] */
|
||||
char *morestr; /* string to display instead of default */
|
||||
@@ -218,6 +219,7 @@ E void g_putch(int);
|
||||
E void g_pututf8(uint8 *);
|
||||
#endif
|
||||
#endif /* ENHANCED_SYMBOLS */
|
||||
extern void erase_tty_screen(void);
|
||||
E void win_tty_init(int);
|
||||
|
||||
/* external declarations */
|
||||
|
||||
Reference in New Issue
Block a user