static void edition_pre_exec (void) { if (clear_before_exec) clr_scr (); else { if (!(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)) printf ("\n\n"); } channels_down (); disable_mouse (); disable_bracketed_paste (); tty_reset_shell_mode (); tty_keypad (FALSE); tty_reset_screen (); numeric_keypad_mode (); /* on xterms: maybe endwin did not leave the terminal on the shell * screen page: do it now. * * Do not move this before endwin: in some systems rmcup includes * a call to clear screen, so it will end up clearing the shell screen. */ do_exit_ca_mode (); }
void toggle_mouse(void) { if (mouse_enabled) disable_mouse(); else enable_mouse(); }
void tty_shutdown (void) { disable_mouse (); tty_reset_shell_mode (); tty_noraw_mode (); tty_keypad (FALSE); tty_reset_screen (); do_exit_ca_mode (); }
static void free_itrm(struct itrm *itrm) { if (!itrm) return; if (!itrm->remote) { if (itrm->orig_title && *itrm->orig_title) { set_window_title(itrm->orig_title, itrm->title_codepage); } else if (itrm->touched_title) { /* Set the window title to the value of $TERM if X11 * wasn't compiled in. Should hopefully make at least * half the users happy. (debian bug #312955) */ unsigned char title[MAX_TERM_LEN]; get_terminal_name(title); if (*title) set_window_title(title, get_cp_index("US-ASCII")); } unhandle_terminal_resize(itrm->in.ctl); #ifdef CONFIG_MOUSE disable_mouse(); #endif send_done_sequence(itrm->out.std, itrm->altscreen); tcsetattr(itrm->in.ctl, TCSANOW, &itrm->t); } mem_free_set(&itrm->orig_title, NULL); /* elinks -remote may not have a valid stdin if not run from a tty (bug 938) */ if (!itrm->remote || itrm->in.std >= 0) clear_handlers(itrm->in.std); clear_handlers(itrm->in.sock); clear_handlers(itrm->out.std); clear_handlers(itrm->out.sock); kill_timer(&itrm->timer); if (itrm == ditrm) ditrm = NULL; mem_free_if(itrm->out.queue.data); mem_free_if(itrm->in.queue.data); mem_free(itrm); }
void tty_shutdown (void) { char *op_cap; disable_mouse (); tty_reset_shell_mode (); tty_noraw_mode (); tty_keypad (FALSE); tty_reset_screen (); do_exit_ca_mode (); SLang_reset_tty (); /* Load the op capability to reset the colors to those that were * active when the program was started up */ op_cap = SLtt_tgetstr ((char *) "op"); if (op_cap != NULL) { fputs (op_cap, stdout); fflush (stdout); } }
void toggle_panels (void) { #ifdef ENABLE_SUBSHELL vfs_path_t *new_dir_vpath = NULL; #endif /* ENABLE_SUBSHELL */ SIG_ATOMIC_VOLATILE_T was_sigwinch = 0; channels_down (); disable_mouse (); disable_bracketed_paste (); if (clear_before_exec) clr_scr (); if (mc_global.tty.alternate_plus_minus) numeric_keypad_mode (); #ifndef HAVE_SLANG /* With slang we don't want any of this, since there * is no raw_mode supported */ tty_reset_shell_mode (); #endif /* !HAVE_SLANG */ tty_noecho (); tty_keypad (FALSE); tty_reset_screen (); do_exit_ca_mode (); tty_raw_mode (); if (mc_global.tty.console_flag != '\0') handle_console (CONSOLE_RESTORE); #ifdef ENABLE_SUBSHELL if (mc_global.tty.use_subshell) { vfs_path_t **new_dir_p; new_dir_p = vfs_current_is_local ()? &new_dir_vpath : NULL; invoke_subshell (NULL, VISIBLY, new_dir_p); } else #endif /* ENABLE_SUBSHELL */ { if (output_starts_shell) { fprintf (stderr, _("Type 'exit' to return to the Midnight Commander")); fprintf (stderr, "\n\r\n\r"); my_system (EXECUTE_INTERNAL, mc_global.tty.shell, NULL); } else get_key_code (0); } if (mc_global.tty.console_flag != '\0') handle_console (CONSOLE_SAVE); do_enter_ca_mode (); tty_reset_prog_mode (); tty_keypad (TRUE); /* Prevent screen flash when user did 'exit' or 'logout' within subshell */ if ((quit & SUBSHELL_EXIT) != 0) { /* User did 'exit' or 'logout': quit MC */ if (quiet_quit_cmd ()) return; quit = 0; #ifdef ENABLE_SUBSHELL /* restart subshell */ if (mc_global.tty.use_subshell) init_subshell (); #endif /* ENABLE_SUBSHELL */ } enable_mouse (); enable_bracketed_paste (); channels_up (); if (mc_global.tty.alternate_plus_minus) application_keypad_mode (); /* HACK: * Save sigwinch flag that will be reset in mc_refresh() called via update_panels(). * There is some problem with screen redraw in ncurses-based mc in this situation. */ was_sigwinch = mc_global.tty.winch_flag; mc_global.tty.winch_flag = 0; #ifdef ENABLE_SUBSHELL if (mc_global.tty.use_subshell) { do_load_prompt (); if (new_dir_vpath != NULL) do_possible_cd (new_dir_vpath); if (mc_global.tty.console_flag != '\0' && output_lines) show_console_contents (output_start_y, LINES - mc_global.keybar_visible - output_lines - 1, LINES - mc_global.keybar_visible - 1); } vfs_path_free (new_dir_vpath); #endif /* ENABLE_SUBSHELL */ if (mc_global.mc_run_mode == MC_RUN_FULL) { update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_xterm_title_path (); } if (was_sigwinch != 0 || mc_global.tty.winch_flag != 0) dialog_change_screen_size (); else repaint_screen (); }
void toggle_panels (void) { #ifdef HAVE_SUBSHELL_SUPPORT char *new_dir = NULL; char **new_dir_p; #endif /* HAVE_SUBSHELL_SUPPORT */ channels_down (); disable_mouse (); if (clear_before_exec) clr_scr (); if (alternate_plus_minus) numeric_keypad_mode (); #ifndef HAVE_SLANG /* With slang we don't want any of this, since there * is no mc_raw_mode supported */ reset_shell_mode (); noecho (); #endif /* !HAVE_SLANG */ keypad (stdscr, FALSE); endwin (); do_exit_ca_mode (); mc_raw_mode (); if (console_flag) handle_console (CONSOLE_RESTORE); #ifdef HAVE_SUBSHELL_SUPPORT if (use_subshell) { new_dir_p = vfs_current_is_local ()? &new_dir : NULL; if (invoke_subshell (NULL, VISIBLY, new_dir_p)) quiet_quit_cmd (); /* User did `exit' or `logout': quit MC quietly */ } else #endif /* HAVE_SUBSHELL_SUPPORT */ { if (output_starts_shell) { fprintf (stderr, _("Type `exit' to return to the Midnight Commander")); fprintf (stderr, "\n\r\n\r"); my_system (EXECUTE_INTERNAL, shell, NULL); } else get_key_code (0); } if (console_flag) handle_console (CONSOLE_SAVE); do_enter_ca_mode (); reset_prog_mode (); keypad (stdscr, TRUE); /* Prevent screen flash when user did 'exit' or 'logout' within subshell */ if (quit) return; enable_mouse (); channels_up (); if (alternate_plus_minus) application_keypad_mode (); #ifdef HAVE_SUBSHELL_SUPPORT if (use_subshell) { load_prompt (0, 0); if (new_dir) do_possible_cd (new_dir); if (console_flag && output_lines) show_console_contents (output_start_y, LINES - keybar_visible - output_lines - 1, LINES - keybar_visible - 1); } #endif /* HAVE_SUBSHELL_SUPPORT */ update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_xterm_title_path (); do_refresh (); }