void init_boe(int argc, char* argv[]) { init_directories(argv[0]); init_menubar(); // Do this first of all because otherwise a default File and Window menu will be seen sync_prefs(); init_graph_tool(); init_snd_tool(); cDialog::init(); init_sbar(text_sbar, sbar_rect, 58, 11, 58); init_sbar(item_sbar, item_sbar_rect, 16, 8); init_sbar(shop_sbar, shop_sbar_rect, 16, 8); init_btn(done_btn, BTN_DONE); init_btn(help_btn, BTN_HELP); adjust_window_mode(); // If we don't do this now it'll flash white to start with mainPtr.clear(sf::Color::Black); mainPtr.display(); make_cursor_watch(); boost::thread init_thread([]() { init_buf(); check_for_intel(); srand(time(nullptr)); init_screen_locs(); Set_up_win(); init_startup(); flushingInput = true; }); show_logo(); if(get_bool_pref("ShowStartupSplash", true)) plop_fancy_startup(); init_thread.join(); cUniverse::print_result = iLiving::print_result = add_string_to_buf; cPlayer::give_help = give_help; set_up_apple_events(argc, argv); init_fileio(); init_spell_menus(); init_mini_map(); redraw_screen(REFRESH_NONE); showMenuBar(); }
int main(int argc, char *argv[]) { enum wavemon_screen cur, next; sigset_t blockmask, oldmask; getconf(argc, argv); if (!isatty(STDIN_FILENO)) errx(1, "input is not from a terminal"); /* honour numeric separators if the environment defines them */ setlocale(LC_NUMERIC, ""); /* initialize the ncurses interface */ initscr(); noecho(); nonl(); cbreak(); curs_set(0); clear(); check_geometry(); start_color(); init_pair(CP_STANDARD, COLOR_WHITE, COLOR_BLACK); init_pair(CP_SCALEHI, COLOR_RED, COLOR_BLACK); init_pair(CP_SCALEMID, COLOR_YELLOW, COLOR_BLACK); init_pair(CP_SCALELOW, COLOR_GREEN, COLOR_BLACK); init_pair(CP_WTITLE, COLOR_CYAN, COLOR_BLACK); init_pair(CP_INACTIVE, COLOR_CYAN, COLOR_BLACK); init_pair(CP_ACTIVE, COLOR_CYAN, COLOR_BLUE); init_pair(CP_STATSIG, COLOR_GREEN, COLOR_BLACK); init_pair(CP_STATNOISE, COLOR_RED, COLOR_BLACK); init_pair(CP_STATSNR, COLOR_BLUE, COLOR_BLUE); init_pair(CP_STATBKG, COLOR_BLUE, COLOR_BLACK); init_pair(CP_STATSIG_S, COLOR_GREEN, COLOR_BLUE); init_pair(CP_STATNOISE_S, COLOR_RED, COLOR_BLUE); init_pair(CP_PREF_NORMAL, COLOR_WHITE, COLOR_BLACK); init_pair(CP_PREF_SELECT, COLOR_WHITE, COLOR_BLUE); init_pair(CP_PREF_ARROW, COLOR_RED, COLOR_BLACK); init_pair(CP_SCAN_CRYPT, COLOR_RED, COLOR_BLACK); init_pair(CP_SCAN_UNENC, COLOR_GREEN, COLOR_BLACK); init_pair(CP_SCAN_NON_AP, COLOR_YELLOW, COLOR_BLACK); /* Override signal handlers installed during ncurses initialisation. */ xsignal(SIGCHLD, SIG_IGN); xsignal(SIGWINCH, sig_winch); /* triggers only when env_winch_ready */ sigemptyset(&blockmask); sigaddset(&blockmask, SIGWINCH); for (cur = conf.startup_scr; cur != SCR_QUIT; cur = next) { WINDOW *w_menu; int escape = 0; if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) < 0) err_sys("cannot block SIGWINCH"); next = cur; w_menu = init_menubar(cur); (*screens[cur].init)(); if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) err_sys("cannot unblock SIGWINCH"); if (sigsetjmp(env_winch, true) == 0) { env_winch_ready = true; do { int key = (*screens[cur].loop)(w_menu); if (key <= 0) usleep(5000); /* * Translate vt100 PF1..4 escape sequences sent * by some X terminals (e.g. aterm) into F1..F4. */ switch (key) { case 033: escape = 1; break; case 'O': escape = 2; break; case 'P' ... 'S': if (escape == 2) key = KEY_F(key - 'P' + 1); /* fall through */ default: escape = 0; } /* Main menu */ switch (key) { case 'i': case KEY_F(1): next = SCR_INFO; break; case 'l': case KEY_F(2): next = SCR_LHIST; break; case 's': case KEY_F(3): next = SCR_SCAN; break; case 'p': case KEY_F(7): next = SCR_PREFS; break; case 'h': case KEY_F(8): next = SCR_HELP; break; case 'a': case KEY_F(9): next = SCR_ABOUT; break; case 'q': case KEY_F(10): next = SCR_QUIT; } } while (next == cur); } delwin(w_menu); (*screens[cur].fini)(); /* * next = cur is set in the protected critical section before * sigsetjmp. Due to the loop condition, it can not occur when * no SIGWINCH occurred, hence it indicates a resizing event. */ if (next == cur) { struct winsize size; if (ioctl(STDIN_FILENO, TIOCGWINSZ, &size) < 0) err_sys("can not determine terminal size"); resizeterm(size.ws_row, size.ws_col); check_geometry(); } clear(); refresh(); }