test whether 'perm_invent' can be toggled On */
| 5485 | |
| 5486 | /* test whether 'perm_invent' can be toggled On */ |
| 5487 | staticfn boolean |
| 5488 | can_set_perm_invent(void) |
| 5489 | { |
| 5490 | /* |
| 5491 | * Assumption: only called when iflags.perm_invent is False |
| 5492 | * and is about to be changed to True. |
| 5493 | */ |
| 5494 | uchar old_perminv_mode = iflags.perminv_mode; |
| 5495 | |
| 5496 | if (!(windowprocs.wincap & WC_PERM_INVENT)) { |
| 5497 | #ifdef TTY_GRAPHICS |
| 5498 | #ifdef TTY_PERM_INVENT |
| 5499 | /* check tty, not necessarily the active window port; |
| 5500 | windows early startup can still be set to safeprocs */ |
| 5501 | if (!check_tty_wincap(WC_PERM_INVENT)) |
| 5502 | #endif |
| 5503 | #endif |
| 5504 | return FALSE; |
| 5505 | } |
| 5506 | |
| 5507 | if (iflags.perminv_mode == InvOptNone) |
| 5508 | iflags.perminv_mode = InvOptOn; |
| 5509 | |
| 5510 | #ifdef TTY_PERM_INVENT |
| 5511 | if ((WINDOWPORT(tty) |
| 5512 | ) && !go.opt_initial) { |
| 5513 | perm_invent_toggled(FALSE); |
| 5514 | /* perm_invent_toggled() |
| 5515 | -> sync_perminvent() |
| 5516 | -> tty_create_nhwindow(NHW_PERMINVENT) |
| 5517 | gives feedback for failure (terminal too small) */ |
| 5518 | if (WIN_INVEN == WIN_ERR) { |
| 5519 | iflags.perminv_mode = old_perminv_mode; |
| 5520 | return FALSE; |
| 5521 | } |
| 5522 | } |
| 5523 | #else |
| 5524 | nhUse(old_perminv_mode); |
| 5525 | #endif |
| 5526 | return TRUE; |
| 5527 | } |
| 5528 | |
| 5529 | |
| 5530 | #ifdef TTY_PERM_INVENT |
no test coverage detected