--- rxvt-unicode/src/init.C 2006/01/11 02:24:12 1.138 +++ rxvt-unicode/src/init.C 2006/01/17 16:50:42 1.147 @@ -258,13 +258,6 @@ last_bot = last_state = -1; -#ifdef MENUBAR - menu_readonly = 1; -# if ! (MENUBAR_MAX > 1) - CurrentBar = &BarList; -# endif /* (MENUBAR_MAX > 1) */ -#endif - return true; } @@ -341,19 +334,17 @@ /* * Open display, get options/resources and create the window */ - { - TEMP_ENV; - if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) - rs[Rs_display_name] = ":0"; + if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) + rs[Rs_display_name] = ":0"; - get_options (r_argc, r_argv); + get_options (r_argc, r_argv); - if (!(display = displays.get (rs[Rs_display_name]))) - rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); - } + if (!(display = displays.get (rs[Rs_display_name]))) + rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); extract_resources (); + free (r_argv); /* @@ -582,7 +573,7 @@ void rxvt_term::set_locale (const char *locale) { - TEMP_ENV; + set_environ (envv); #if HAVE_XSETLOCALE || HAVE_SETLOCALE free (this->locale); @@ -623,7 +614,7 @@ void rxvt_term::init_xlocale () { - TEMP_ENV; + set_environ (envv); #ifdef USE_XIM if (!locale) @@ -674,18 +665,12 @@ #endif /* add value for scrollBar */ - if (scrollbar_visible ()) + if (scrollBar.state) { priv_modes |= PrivMode_scrollBar; SavedModes |= PrivMode_scrollBar; } - if (menubar_visible ()) - { - priv_modes |= PrivMode_menuBar; - SavedModes |= PrivMode_menuBar; - } - run_command (argv); } @@ -761,7 +746,7 @@ } /* - * get scrollBar/menuBar shadow colors + * get scrollBar shadow colors * * The calculations of topShadow/bottomShadow values are adapted * from the fvwm window manager. @@ -926,7 +911,6 @@ MWMHints mwmhints; #endif XGCValues gcvalue; - long vt_emask; XSetWindowAttributes attributes; XWindowAttributes gattr; Window top, parent; @@ -1076,8 +1060,8 @@ /* vt cursor: Black-on-White is standard, but this is more popular */ TermWin_cursor = XCreateFontCursor (disp, XC_xterm); -#if defined(HAVE_SCROLLBARS) || defined(MENUBAR) - /* cursor (menuBar/scrollBar): Black-on-White */ +#ifdef HAVE_SCROLLBARS + /* cursor scrollBar: Black-on-White */ leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); #endif @@ -1099,43 +1083,14 @@ vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; - if (OPTION (Opt_pointerBlank) -#ifdef ENABLE_PERL - || perl.self -#endif - ) + if (OPTION (Opt_pointerBlank)) vt_emask |= PointerMotionMask; else vt_emask |= Button1MotionMask | Button3MotionMask; - XSelectInput (disp, vt, vt_emask); - vt_ev.start (display, vt); - -#if defined(MENUBAR) && (MENUBAR_MAX > 1) - if (menuBar_height ()) - { - menuBar.win = XCreateSimpleWindow (disp, top, - window_vt_x, 0, - width, - menuBar_TotalHeight (), - 0, - pix_colors_focused[Color_fg], - pix_colors_focused[Color_scroll]); - -#ifdef DEBUG_X - XStoreName (disp, menuBar.win, "menubar"); -#endif - - menuBar.drawable = new rxvt_drawable (display, menuBar.win); + vt_select_input (); - XDefineCursor (disp, menuBar.win, - XCreateFontCursor (disp, XC_left_ptr)); - - XSelectInput (disp, menuBar.win, - (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask)); - menubar_ev.start (display, menuBar.win); - } -#endif + vt_ev.start (display, vt); #ifdef XPM_BACKGROUND if (rs[Rs_backgroundPixmap] != NULL @@ -1164,7 +1119,7 @@ drawable = new rxvt_drawable (display, vt); -#if defined(MENUBAR) || defined(RXVT_SCROLLBAR) +#ifdef RXVT_SCROLLBAR gcvalue.foreground = pix_colors[Color_topShadow]; topShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); gcvalue.foreground = pix_colors[Color_bottomShadow]; @@ -1414,28 +1369,26 @@ void rxvt_term::run_command (const char *const *argv) { - TEMP_ENV; // not very temporary... - #if ENABLE_FRILLS if (rs[Rs_pty_fd]) { - pty.pty = atoi (rs[Rs_pty_fd]); + pty->pty = atoi (rs[Rs_pty_fd]); - if (pty.pty >= 0) + if (pty->pty >= 0) { if (getfd_hook) - pty.pty = (*getfd_hook) (pty.pty); + pty->pty = (*getfd_hook) (pty->pty); - if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK)) + if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); } } else #endif - if (!pty.get ()) + if (!pty->get ()) rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); - pty.set_utf8_mode (enc_utf8); + pty->set_utf8_mode (enc_utf8); /* set initial window size */ tt_winch (); @@ -1458,7 +1411,6 @@ return; #endif -#ifndef __QNX__ /* spin off the command interpreter */ switch (cmd_pid = fork ()) { @@ -1470,20 +1422,20 @@ case 0: init_env (); - if (!pty.make_controlling_tty ()) + if (!pty->make_controlling_tty ()) fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); else { /* Reopen stdin, stdout and stderr over the tty file descriptor */ - dup2 (pty.tty, STDIN_FILENO); - dup2 (pty.tty, STDOUT_FILENO); - dup2 (pty.tty, STDERR_FILENO); + dup2 (pty->tty, STDIN_FILENO); + dup2 (pty->tty, STDOUT_FILENO); + dup2 (pty->tty, STDERR_FILENO); // close all our file handles that we do no longer need for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) { - if ((*t)->pty.pty > 2) close ((*t)->pty.pty); - if ((*t)->pty.tty > 2) close ((*t)->pty.tty); + if ((*t)->pty->pty > 2) close ((*t)->pty->pty); + if ((*t)->pty->tty > 2) close ((*t)->pty->tty); } run_child (argv); @@ -1493,36 +1445,14 @@ _exit (EXIT_FAILURE); default: - { -#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) - int fdstdin; - - fdstdin = dup (STDIN_FILENO); - dup2 (pty.tty, STDIN_FILENO); +#if UTMP_SUPPORT + if (!OPTION (Opt_utmpInhibit)) + pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); #endif -#ifdef UTMP_SUPPORT - privileged_utmp (SAVE); -#endif - -#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) - - dup2 (fdstdin, STDIN_FILENO); - close (fdstdin); -#endif - } - - pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */ + pty->close_tty (); break; } -#else /* __QNX__ uses qnxspawn () */ - fchmod (pty.tty, 0622); - fcntl (pty.tty, F_SETFD, FD_CLOEXEC); - fcntl (pty.pty, F_SETFD, FD_CLOEXEC); - - if (run_child (argv) == -1) - exit (EXIT_FAILURE); -#endif } /* ------------------------------------------------------------------------- * @@ -1576,7 +1506,6 @@ sigemptyset (&ss); sigprocmask (SIG_SETMASK, &ss, 0); -#ifndef __QNX__ /* command interpreter path */ if (argv != NULL) { @@ -1612,62 +1541,6 @@ /* no error message: STDERR is closed! */ } -#else /* __QNX__ uses qnxspawn () */ - - char iov_a[10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - char *command = NULL, fullcommand[_MAX_PATH]; - char **arg_v, *arg_a[2] = { NULL, NULL }; - - if (argv != NULL) - { - if (access (argv[0], X_OK) == -1) - { - if (strchr (argv[0], '/') == NULL) - { - searchenv (argv[0], "PATH", fullcommand); - - if (fullcommand[0] != '\0') - command = fullcommand; - } - - if (access (command, X_OK) == -1) - return -1; - } - else - command = argv[0]; - - arg_v = argv; - } - else - { - if ((command = getenv ("SHELL")) == NULL || *command == '\0') - command = "/bin/sh"; - - arg_a[0] = my_basename (command); - - if (OPTION (Opt_loginShell)) - { - login = rxvt_malloc ((strlen (arg_a[0]) + 2) * sizeof (char)); - - login[0] = '-'; - strcpy (&login[1], arg_a[0]); - arg_a[0] = login; - } - - arg_v = arg_a; - } - - iov_a[0] = iov_a[1] = iov_a[2] = pty.tty; - cmd_pid = qnx_spawn (0, 0, 0, -1, -1, - _SPAWN_SETSID | _SPAWN_TCSETPGRP, - command, arg_v, environ, iov_a, 0); - if (login) - free (login); - - pty.close_tty (); - return pty.pty; -#endif - return -1; }