check tty in can_set_perm_invent

During very early startup, Windows may not have loaded
the tty window procs yet, and it is running with safeprocs.
It will eventually load the tty stuff. If the currently
operating window port fails in can_set_perm_invent(),
try the check for WC_PERM_INVENT again explicitly on
the tty windowport.
This commit is contained in:
nhmall
2023-12-09 01:31:08 -05:00
parent 0c88c91c83
commit 0ef2f15f51
3 changed files with 41 additions and 4 deletions

View File

@@ -3410,6 +3410,10 @@ extern void choose_windows(const char *);
void addto_windowchain(const char *s);
void commit_windowchain(void);
#endif
#ifdef TTY_GRAPHICS
extern boolean check_tty_wincap(unsigned long);
extern boolean check_tty_wincap2(unsigned long);
#endif
extern boolean genl_can_suspend_no(void);
extern boolean genl_can_suspend_yes(void);
extern char genl_message_menu(char, int, const char *);

View File

@@ -5155,9 +5155,16 @@ can_set_perm_invent(void)
* and is about to be changed to True.
*/
uchar old_perminv_mode = iflags.perminv_mode;
if (!(windowprocs.wincap & WC_PERM_INVENT))
return FALSE; /* should never happen */
if (!(windowprocs.wincap & WC_PERM_INVENT)) {
#ifdef TTY_GRAPHICS
#ifdef TTY_PERM_INVENT
/* check tty, not necessarily the active window port;
windows early startup can still be set to safeprocs */
if (!check_tty_wincap(WC_PERM_INVENT))
#endif
#endif
return FALSE; /* should never happen */
}
if (iflags.perminv_mode == InvOptNone)
iflags.perminv_mode = InvOptOn;

View File

@@ -59,6 +59,10 @@ extern void trace_procs_init(int);
extern void *trace_procs_chain(int, int, void *, void *, void *);
#endif
#if defined(WINCHAIN) || defined(TTY_GRAPHICS)
static struct win_choices *win_choices_find(const char *s);
#endif
static void def_raw_print(const char *s);
static void def_wait_synch(void);
static boolean get_menu_coloring(const char *, int *, int *);
@@ -222,7 +226,29 @@ def_wait_synch(void)
return;
}
#ifdef WINCHAIN
#ifdef TTY_GRAPHICS
boolean
check_tty_wincap(unsigned long wincap)
{
struct win_choices *wc = win_choices_find("tty");
if (wc)
return ((wc->procs->wincap & wincap) == wincap);
return FALSE;
}
boolean
check_tty_wincap2(unsigned long wincap2)
{
struct win_choices *wc = win_choices_find("tty");
if (wc)
return ((wc->procs->wincap2 & wincap2) == wincap2);
return FALSE;
}
#endif
#if defined(WINCHAIN) || defined(TTY_GRAPHICS)
static struct win_choices *
win_choices_find(const char *s)
{