--- rxvt-unicode/src/init.C 2011/12/20 02:52:39 1.309 +++ rxvt-unicode/src/init.C 2012/05/31 05:53:46 1.325 @@ -40,7 +40,7 @@ #include -#include +#include #include @@ -48,9 +48,7 @@ # define X_LOCALE # include #else -# ifdef HAVE_SETLOCALE -# include -# endif +# include #endif #ifdef HAVE_NL_LANGINFO @@ -80,7 +78,7 @@ #include #include -static char * +static char * ecb_cold rxvt_network_display (const char *display) { char buffer[1024], *rval = NULL; @@ -795,11 +793,6 @@ pty = ptytty::create (); -#ifdef HAVE_AFTERIMAGE - set_application_name ((char *)rs[Rs_name]); - set_output_threshold (OUTPUT_LEVEL_WARNING); -#endif - // must be called before create_windows, because the latter may call set_icon #ifdef HAVE_PIXBUF g_type_init (); @@ -827,26 +820,19 @@ bg_set_transparent (); if (rs [Rs_blurradius]) - bg_set_blur (rs [Rs_blurradius]); + root_effects.set_blur (rs [Rs_blurradius]); if (ISSET_PIXCOLOR (Color_tint)) - bg_set_tint (pix_colors_focused [Color_tint]); + root_effects.set_tint (pix_colors_focused [Color_tint]); if (rs [Rs_shade]) - bg_set_shade (rs [Rs_shade]); + root_effects.set_shade (rs [Rs_shade]); bg_set_root_pixmap (); XSelectInput (dpy, display->root, PropertyChangeMask); rootwin_ev.start (display, display->root); } #endif - -#ifdef BG_IMAGE_FROM_FILE - if (rs[Rs_backgroundPixmap]) - if (bg_set_file (rs[Rs_backgroundPixmap])) - if (!bg_window_position_sensitive ()) - update_background (); -#endif } #endif @@ -854,7 +840,7 @@ rootwin_ev.start (display, display->root); #endif - set_colorfgbg (); + init_done = 1; init_command (cmd_argv); @@ -908,6 +894,10 @@ rxvt_term::init_env () { char *val; + char *env_display; + char *env_windowid; + char *env_colorfgbg; + char *env_term; #ifdef DISPLAY_IS_IP /* Fixup display_name for export over pty to any interested terminal @@ -934,6 +924,7 @@ sprintf (env_display, "DISPLAY=%s", val); + env_windowid = (char *)rxvt_malloc (21); sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent); /* add entries to the environment: @@ -947,8 +938,8 @@ putenv (env_display); putenv (env_windowid); - if (env_colorfgbg) - putenv (env_colorfgbg); + env_colorfgbg = get_colorfgbg (); + putenv (env_colorfgbg); #ifdef RXVT_TERMINFO putenv ("TERMINFO=" RXVT_TERMINFO); @@ -982,7 +973,6 @@ { set_environ (envv); -#if HAVE_XSETLOCALE || HAVE_SETLOCALE free (this->locale); this->locale = setlocale (LC_CTYPE, locale); @@ -1003,7 +993,6 @@ this->locale = strdup (this->locale); SET_LOCALE (this->locale); mbstate.reset (); -#endif #if HAVE_NL_LANGINFO char *codeset = nl_langinfo (CODESET); @@ -1190,7 +1179,7 @@ void rxvt_term::color_aliases (int idx) { - if (rs[Rs_color + idx] && isdigit (* (rs[Rs_color + idx]))) + if (rs[Rs_color + idx] && isdigit (*rs[Rs_color + idx])) { int i = atoi (rs[Rs_color + idx]); @@ -1295,57 +1284,6 @@ void rxvt_term::set_icon (const char *file) { -#ifdef HAVE_AFTERIMAGE - init_asv (); - - ASImage *im = file2ASImage (file, 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); - if (!im) - { - rxvt_warn ("Loading image icon failed, continuing without.\n"); - return; - } - - unsigned int w = im->width; - unsigned int h = im->height; - - if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383)) - { - rxvt_warn ("Icon image too big, continuing without.\n"); - destroy_asimage (&im); - return; - } - - ASImage *result = scale_asimage (asv, im, - w, h, ASA_ARGB32, - 100, ASIMAGE_QUALITY_DEFAULT); - destroy_asimage (&im); - - if (!result) - { - rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); - return; - } - - long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)); - if (buffer) - { - ARGB32 *asbuf = result->alt.argb32; - buffer [0] = w; - buffer [1] = h; - - for (unsigned int i = 0; i < w * h; ++i) - buffer [i + 2] = asbuf [i]; - - XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, - PropModeReplace, (const unsigned char *) buffer, 2 + w * h); - free (buffer); - } - else - rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); - - destroy_asimage (&result); -#endif - #ifdef HAVE_PIXBUF GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file, NULL); if (!pixbuf) @@ -1476,9 +1414,6 @@ this->parent = top; - old_width = szHint.width; - old_height = szHint.height; - set_title (rs [Rs_title]); set_icon_name (rs [Rs_iconName]); @@ -1550,7 +1485,7 @@ /* the vt window */ vt = XCreateSimpleWindow (dpy, top, window_vt_x, window_vt_y, - width, height, + vt_width, vt_height, 0, pix_colors_focused[Color_fg], pix_colors_focused[Color_bg]); @@ -1678,7 +1613,14 @@ default: if (!option (Opt_utmpInhibit)) - pty->login (cmd_pid, option (Opt_loginShell), rs[Rs_display_name]); + { +#ifdef LOG_ONLY_ON_LOGIN + bool login_shell = option (Opt_loginShell); +#else + bool login_shell = true; +#endif + pty->login (cmd_pid, login_shell, rs[Rs_display_name]); + } pty->close_tty (); @@ -1713,8 +1655,10 @@ fd = open (CONSOLE, O_WRONLY, 0); if (fd >= 0) - if (ioctl (fd, SRIOCSREDIR, NULL) < 0) + { + ioctl (fd, SRIOCSREDIR, STDIN_FILENO); close (fd); + } #endif /* SRIOCSREDIR */ }