--- rxvt-unicode/src/init.C 2008/02/19 18:15:26 1.251 +++ rxvt-unicode/src/init.C 2010/01/30 20:52:36 1.261 @@ -295,6 +295,7 @@ int_bwidth = INTERNALBORDERWIDTH; ext_bwidth = EXTERNALBORDERWIDTH; lineSpace = LINESPACE; + letterSpace = LETTERSPACE; saveLines = SAVELINES; refresh_type = SLOW_REFRESH; @@ -309,6 +310,7 @@ set_option (Opt_secondaryScroll); set_option (Opt_pastableTabs); set_option (Opt_intensityStyles); + set_option (Opt_iso14755); set_option (Opt_iso14755_52); set_option (Opt_buffered); } @@ -394,17 +396,17 @@ select_visual (strtol (rs[Rs_depth], 0, 0)); #endif -#ifdef HAVE_AFTERIMAGE - set_application_name ((char*)rs[Rs_name]); - set_output_threshold (OUTPUT_LEVEL_WARNING); - asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); -#endif free (r_argv); for (int i = NUM_RESOURCES; i--; ) if (rs [i] == resval_undef) rs [i] = 0; +#ifdef HAVE_AFTERIMAGE + set_application_name ((char *)rs[Rs_name]); + set_output_threshold (OUTPUT_LEVEL_WARNING); +#endif + #if ENABLE_PERL if (!rs[Rs_perl_ext_1]) rs[Rs_perl_ext_1] = "default"; @@ -425,6 +427,7 @@ { if (!rs[Rs_title]) rs[Rs_title] = rxvt_basename (cmd_argv[0]); + if (!rs[Rs_iconName]) rs[Rs_iconName] = rs[Rs_title]; } @@ -432,6 +435,7 @@ { if (!rs[Rs_title]) rs[Rs_title] = rs[Rs_name]; + if (!rs[Rs_iconName]) rs[Rs_iconName] = rs[Rs_name]; } @@ -448,6 +452,9 @@ if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0) lineSpace = min (i, std::numeric_limits::max ()); + + if (rs[Rs_letterSpace]) + letterSpace = atoi (rs[Rs_letterSpace]); #endif #ifdef POINTER_BLANK @@ -461,11 +468,6 @@ if (!saveLines) set_option (Opt_scrollBar, 0); -#ifdef PRINTPIPE - if (!rs[Rs_print_pipe]) - rs[Rs_print_pipe] = PRINTPIPE; -#endif - if (!rs[Rs_cutchars]) rs[Rs_cutchars] = CUTCHARS; @@ -541,7 +543,7 @@ SET_R (this); set_locale (""); - set_environ (envv); // few things in X do not call setlocale :( + set_environ (envv); // a few things in X do not call setlocale :( init_vars (); @@ -553,6 +555,16 @@ keyboard->register_done (); #endif + if (const char *path = rs[Rs_chdir]) + if (*path) // ignored if empty + { + if (*path != '/') + rxvt_fatal ("specified shell working directory must start with a slash, aborting.\n"); + + if (chdir (path)) + rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); + } + if (option (Opt_scrollBar)) scrollBar.state = STATE_IDLE; /* set existence for size calculations */ @@ -562,7 +574,7 @@ init_xlocale (); - scr_reset (); // initialize screen + scr_poweron (); // initialize screen #if 0 XSynchronize (dpy, True); @@ -1119,8 +1131,8 @@ old_width = szHint.width; old_height = szHint.height; - process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); - process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); + set_title (rs [Rs_title]); + set_icon_name (rs [Rs_iconName]); classHint.res_name = (char *)rs[Rs_name]; classHint.res_class = (char *)RESCLASS; @@ -1132,6 +1144,56 @@ XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, &szHint, &wmHint, &classHint); +#if ENABLE_EWMH +# ifdef HAVE_AFTERIMAGE + /* + * set up icon hint + * rs [Rs_iconfile] is path to icon, asv has been created in init_resources + */ + + if (rs [Rs_iconfile]) + { + init_asv (); + + ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); + if (asv && im) + { + int w = im->width; + int h = im->height; + long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)); + ASImage *result = scale_asimage (asv, im, + w, h, ASA_ARGB32, + 100, ASIMAGE_QUALITY_DEFAULT); + destroy_asimage (&im); + + if (buffer && result) + { + 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]; + + destroy_asimage (&result); + XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, + PropModeReplace, (const unsigned char *) buffer, 2 + w * h); + free (buffer); + } + else + { + if (!buffer) + rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); + + if (!result) + rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); + } + } + else + rxvt_warn ("Loading image icon failed, continuing without.\n"); + } +# endif +#endif #if ENABLE_FRILLS if (mwmhints.flags) @@ -1546,7 +1608,7 @@ if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') shell = "/bin/sh"; - argv0 = (const char *)rxvt_basename (shell); + argv0 = rxvt_basename (shell); if (option (Opt_loginShell)) {