… | |
… | |
459 | |
459 | |
460 | /* no point having a scrollbar without having any scrollback! */ |
460 | /* no point having a scrollbar without having any scrollback! */ |
461 | if (!saveLines) |
461 | if (!saveLines) |
462 | set_option (Opt_scrollBar, 0); |
462 | set_option (Opt_scrollBar, 0); |
463 | |
463 | |
464 | #ifdef PRINTPIPE |
|
|
465 | if (!rs[Rs_print_pipe]) |
|
|
466 | rs[Rs_print_pipe] = PRINTPIPE; |
|
|
467 | #endif |
|
|
468 | |
|
|
469 | if (!rs[Rs_cutchars]) |
464 | if (!rs[Rs_cutchars]) |
470 | rs[Rs_cutchars] = CUTCHARS; |
465 | rs[Rs_cutchars] = CUTCHARS; |
471 | |
466 | |
472 | #ifndef NO_BACKSPACE_KEY |
467 | #ifndef NO_BACKSPACE_KEY |
473 | if (!rs[Rs_backspace_key]) |
468 | if (!rs[Rs_backspace_key]) |
… | |
… | |
539 | { |
534 | { |
540 | this->envv = envv; |
535 | this->envv = envv; |
541 | |
536 | |
542 | SET_R (this); |
537 | SET_R (this); |
543 | set_locale (""); |
538 | set_locale (""); |
544 | set_environ (envv); // few things in X do not call setlocale :( |
539 | set_environ (envv); // a few things in X do not call setlocale :( |
545 | |
540 | |
546 | init_vars (); |
541 | init_vars (); |
547 | |
542 | |
548 | init_secondary (); |
543 | init_secondary (); |
549 | |
544 | |
550 | const char **cmd_argv = init_resources (argc, argv); |
545 | const char **cmd_argv = init_resources (argc, argv); |
551 | |
546 | |
552 | #ifdef KEYSYM_RESOURCE |
547 | #ifdef KEYSYM_RESOURCE |
553 | keyboard->register_done (); |
548 | keyboard->register_done (); |
554 | #endif |
549 | #endif |
|
|
550 | |
|
|
551 | if (const char *path = rs[Rs_chdir]) |
|
|
552 | if (*path) // ignored if empty |
|
|
553 | { |
|
|
554 | if (*path != '/') |
|
|
555 | rxvt_fatal ("specified shell working directory must start with a slash, aborting.\n"); |
|
|
556 | |
|
|
557 | if (chdir (path)) |
|
|
558 | rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); |
|
|
559 | } |
555 | |
560 | |
556 | if (option (Opt_scrollBar)) |
561 | if (option (Opt_scrollBar)) |
557 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
562 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
558 | |
563 | |
559 | pty = ptytty::create (); |
564 | pty = ptytty::create (); |
… | |
… | |
832 | run_command (argv); |
837 | run_command (argv); |
833 | } |
838 | } |
834 | |
839 | |
835 | /*----------------------------------------------------------------------*/ |
840 | /*----------------------------------------------------------------------*/ |
836 | void |
841 | void |
837 | rxvt_term::Get_Colours () |
842 | rxvt_term::get_colours () |
838 | { |
843 | { |
839 | int i; |
844 | int i; |
840 | |
845 | |
841 | #ifdef OFF_FOCUS_FADING |
846 | #ifdef OFF_FOCUS_FADING |
842 | pix_colors = pix_colors_focused; |
847 | pix_colors = pix_colors_focused; |
… | |
… | |
1059 | Window top, parent; |
1064 | Window top, parent; |
1060 | |
1065 | |
1061 | dLocal (Display *, dpy); |
1066 | dLocal (Display *, dpy); |
1062 | |
1067 | |
1063 | /* grab colors before netscape does */ |
1068 | /* grab colors before netscape does */ |
1064 | Get_Colours (); |
1069 | get_colours (); |
1065 | |
1070 | |
1066 | if (!set_fonts ()) |
1071 | if (!set_fonts ()) |
1067 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1072 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1068 | |
1073 | |
1069 | parent = display->root; |
1074 | parent = display->root; |
… | |
… | |
1130 | wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; |
1135 | wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; |
1131 | wmHint.window_group = top; |
1136 | wmHint.window_group = top; |
1132 | |
1137 | |
1133 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1138 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1134 | &szHint, &wmHint, &classHint); |
1139 | &szHint, &wmHint, &classHint); |
|
|
1140 | #if ENABLE_EWMH |
|
|
1141 | # ifdef HAVE_AFTERIMAGE |
|
|
1142 | /* |
|
|
1143 | * set up icon hint |
|
|
1144 | * rs [Rs_iconfile] is path to icon, asv has been created in init_resources |
|
|
1145 | */ |
|
|
1146 | if (rs [Rs_iconfile] && asv) |
|
|
1147 | { |
|
|
1148 | ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
|
|
1149 | if (im) |
|
|
1150 | { |
|
|
1151 | int w = im->width; |
|
|
1152 | int h = im->height; |
|
|
1153 | long* buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1154 | ASImage *result = scale_asimage (asv, im, |
|
|
1155 | w, h, ASA_ARGB32, |
|
|
1156 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
1157 | destroy_asimage (&im); |
|
|
1158 | |
|
|
1159 | if (buffer && result) |
|
|
1160 | { |
|
|
1161 | ARGB32 *asbuf = result->alt.argb32; |
|
|
1162 | buffer [0] = w; |
|
|
1163 | buffer [1] = h; |
|
|
1164 | |
|
|
1165 | for (unsigned int i = 0; i < w * h; ++i) |
|
|
1166 | buffer [i + 2] = asbuf [i]; |
|
|
1167 | |
|
|
1168 | destroy_asimage (&result); |
|
|
1169 | XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
|
|
1170 | PropModeReplace, (const unsigned char*) buffer, 2 + w * h); |
|
|
1171 | free (buffer); |
|
|
1172 | } |
|
|
1173 | else |
|
|
1174 | { |
|
|
1175 | if (!buffer) |
|
|
1176 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
|
|
1177 | |
|
|
1178 | if (!result) |
|
|
1179 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
|
|
1180 | } |
|
|
1181 | } |
|
|
1182 | else |
|
|
1183 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
|
|
1184 | } |
|
|
1185 | # endif |
|
|
1186 | #endif |
1135 | |
1187 | |
1136 | #if ENABLE_FRILLS |
1188 | #if ENABLE_FRILLS |
1137 | if (mwmhints.flags) |
1189 | if (mwmhints.flags) |
1138 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1190 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1139 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
1191 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |