--- rxvt-unicode/src/init.C 2004/02/24 00:02:44 1.34 +++ rxvt-unicode/src/init.C 2004/03/22 17:18:25 1.45 @@ -386,21 +386,10 @@ TermWin.saveLines = SAVELINES; numPixColors = TOTAL_COLORS; -#ifndef NO_NEW_SELECTION - selection_style = NEW_SELECT; -#else - selection_style = OLD_SELECT; -#endif - #ifndef NO_BRIGHTCOLOR colorfgbg = DEFAULT_RSTYLE; #endif -#if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - ks_bigfont = XK_greater; - ks_smallfont = XK_less; -#endif - refresh_limit = 1; refresh_type = SLOW_REFRESH; prev_nrow = prev_ncol = 0; @@ -507,10 +496,6 @@ cmd_argv[i] = NULL; } - /* clear all resources */ - for (i = 0; i < NUM_RESOURCES;) - rs[i++] = NULL; - rs[Rs_name] = rxvt_r_basename (argv[0]); /* @@ -535,10 +520,7 @@ if (!display && ! (display = displays.get (rs[Rs_display_name]))) - { - rxvt_print_error ("can't open display %s", rs[Rs_display_name]); - exit (EXIT_FAILURE); - } + rxvt_fatal ("can't open display %s", rs[Rs_display_name]); extract_resources (display->display, rs[Rs_name]); @@ -594,18 +576,6 @@ if (!rs[Rs_cutchars]) rs[Rs_cutchars] = CUTCHARS; -#ifdef ACS_ASCII - if (!rs[Rs_acs_chars]) - rs[Rs_acs_chars] = ACS_CHARS; - if ((i = STRLEN (rs[Rs_acs_chars])) < 0x20) - { - val = rxvt_realloc ((void *)rs[Rs_acs_chars], 0x20); - for (; i < 0x20; ) - val[i] = ' '; - rs[Rs_acs_chars] = val; - } -#endif - #ifndef NO_BACKSPACE_KEY if (!rs[Rs_backspace_key]) # ifdef DEFAULT_BACKSPACE @@ -643,18 +613,6 @@ rxvt_Str_escaped ((char *)rs[Rs_answerbackstring]); } - if (rs[Rs_selectstyle]) - { - if (STRNCASECMP (rs[Rs_selectstyle], "oldword", 7) == 0) - selection_style = OLD_WORD_SELECT; -#ifndef NO_OLD_SELECTION - - else if (STRNCASECMP (rs[Rs_selectstyle], "old", 3) == 0) - selection_style = OLD_SELECT; -#endif - - } - #ifdef HAVE_SCROLLBARS setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]); @@ -796,6 +754,7 @@ SET_LOCALE (this->locale); mbstate.reset (); #endif +#if 0 #if HAVE_NL_LANGINFO free (codeset); codeset = strdup (nl_langinfo (CODESET)); @@ -804,6 +763,7 @@ #else enc_utf8 = 1; #endif +#endif } void @@ -811,7 +771,7 @@ { #ifdef USE_XIM if (!locale) - rxvt_print_error ("Setting locale failed."); + rxvt_warn ("setting locale failed, working without locale support.\n"); else { Atom wmlocale; @@ -823,7 +783,7 @@ if (!XSupportsLocale ()) { - rxvt_print_error ("The locale is not supported by Xlib"); + rxvt_warn ("the locale is not supported by Xlib, working withotu locale support.\n"); return; } @@ -893,10 +853,7 @@ #endif if ((cmd_fd = run_command (argv)) < 0) - { - rxvt_print_error ("aborting"); - exit (EXIT_FAILURE); - } + rxvt_fatal ("failure while running command, aborting"); } /*----------------------------------------------------------------------*/ @@ -931,8 +888,7 @@ case Color_fg: case Color_bg: /* fatal: need bg/fg color */ - rxvt_print_error ("aborting"); - exit (EXIT_FAILURE); + rxvt_fatal ("unable to get foreground/background colour, aborting"); /* NOTREACHED */ break; #ifndef NO_CURSORCOLOR @@ -1169,7 +1125,7 @@ xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); classHint.res_name = (char *)rs[Rs_name]; - classHint.res_class = (char *)APL_CLASS; + classHint.res_class = (char *)RESCLASS; wmHint.flags = (InputHint | StateHint | WindowGroupHint); wmHint.input = True; @@ -1242,16 +1198,19 @@ if (menuBar_height ()) { menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], - window_vt_x, 0, - TermWin_TotalWidth (), - menuBar_TotalHeight (), - 0, - PixColors[Color_fg], - PixColors[Color_scroll]); + window_vt_x, 0, + TermWin_TotalWidth (), + menuBar_TotalHeight (), + 0, + PixColors[Color_fg], + PixColors[Color_scroll]); + #ifdef DEBUG_X XStoreName (display->display, menuBar.win, "menubar"); #endif + menuBar.drawable = new rxvt_drawable (display, menuBar.win); + XDefineCursor (display->display, menuBar.win, XCreateFontCursor (display->display, XC_left_ptr)); @@ -1283,20 +1242,18 @@ gcvalue.background = PixColors[Color_bg]; gcvalue.graphics_exposures = 1; TermWin.gc = XCreateGC (display->display, TermWin.vt, - GCForeground | GCBackground - | GCGraphicsExposures, &gcvalue); + GCForeground | GCBackground | GCGraphicsExposures, + &gcvalue); + + TermWin.drawable = new rxvt_drawable (display, TermWin.vt); #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) gcvalue.foreground = PixColors[Color_topShadow]; - topShadowGC = XCreateGC (display->display, TermWin.vt, - GCForeground, &gcvalue); + topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); gcvalue.foreground = PixColors[Color_bottomShadow]; - botShadowGC = XCreateGC (display->display, TermWin.vt, - GCForeground, &gcvalue); - gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg - : Color_scroll)]; - scrollbarGC = XCreateGC (display->display, TermWin.vt, - GCForeground, &gcvalue); + botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); + gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; + scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); #endif } @@ -1313,10 +1270,7 @@ /* get master (pty) */ if ((cfd = rxvt_get_pty (& (tty_fd), & (ttydev))) < 0) - { - rxvt_print_error ("can't open pseudo-tty"); - return -1; - } + rxvt_fatal ("can't open pseudo-tty"); fcntl (cfd, F_SETFL, O_NONBLOCK); @@ -1330,8 +1284,7 @@ if ((tty_fd = rxvt_get_tty (ttydev)) < 0) { close (cfd); - rxvt_print_error ("can't open slave tty %s", ttydev); - return -1; + rxvt_fatal ("can't open slave tty %s", ttydev); } } #ifndef NO_BACKSPACE_KEY @@ -1351,15 +1304,14 @@ switch (cmd_pid = fork ()) { case -1: - rxvt_print_error ("can't fork"); - return -1; + rxvt_fatal ("can't fork"); case 0: close (cfd); /* only keep tty_fd and STDERR open */ init_env (); if (rxvt_control_tty (tty_fd, ttydev) < 0) - rxvt_print_error ("could not obtain control of tty"); + fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); else { /* Reopen stdin, stdout and stderr over the tty file descriptor */ @@ -1371,9 +1323,11 @@ close (tty_fd); run_child (argv); + fprintf (stderr, "%s: unable to exec child.", RESNAME); } - exit (EXIT_FAILURE); - /* NOTREACHED */ + + _exit (EXIT_FAILURE); + default: { #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) @@ -1392,8 +1346,8 @@ dup2 (fdstdin, STDIN_FILENO); close (fdstdin); #endif - } + close (tty_fd); /* keep STDERR_FILENO, cmd_fd, display->fd () open */ break; }