… | |
… | |
392 | #if XFT |
392 | #if XFT |
393 | if (rs[Rs_depth]) |
393 | if (rs[Rs_depth]) |
394 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
394 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
395 | #endif |
395 | #endif |
396 | |
396 | |
397 | #ifdef HAVE_AFTERIMAGE |
|
|
398 | set_application_name ((char*)rs[Rs_name]); |
|
|
399 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
400 | asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); |
|
|
401 | #endif |
|
|
402 | free (r_argv); |
397 | free (r_argv); |
403 | |
398 | |
404 | for (int i = NUM_RESOURCES; i--; ) |
399 | for (int i = NUM_RESOURCES; i--; ) |
405 | if (rs [i] == resval_undef) |
400 | if (rs [i] == resval_undef) |
406 | rs [i] = 0; |
401 | rs [i] = 0; |
|
|
402 | |
|
|
403 | #ifdef HAVE_AFTERIMAGE |
|
|
404 | set_application_name ((char *)rs[Rs_name]); |
|
|
405 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
406 | #endif |
407 | |
407 | |
408 | #if ENABLE_PERL |
408 | #if ENABLE_PERL |
409 | if (!rs[Rs_perl_ext_1]) |
409 | if (!rs[Rs_perl_ext_1]) |
410 | rs[Rs_perl_ext_1] = "default"; |
410 | rs[Rs_perl_ext_1] = "default"; |
411 | |
411 | |
… | |
… | |
423 | */ |
423 | */ |
424 | if (cmd_argv && cmd_argv[0]) |
424 | if (cmd_argv && cmd_argv[0]) |
425 | { |
425 | { |
426 | if (!rs[Rs_title]) |
426 | if (!rs[Rs_title]) |
427 | rs[Rs_title] = rxvt_basename (cmd_argv[0]); |
427 | rs[Rs_title] = rxvt_basename (cmd_argv[0]); |
|
|
428 | |
428 | if (!rs[Rs_iconName]) |
429 | if (!rs[Rs_iconName]) |
429 | rs[Rs_iconName] = rs[Rs_title]; |
430 | rs[Rs_iconName] = rs[Rs_title]; |
430 | } |
431 | } |
431 | else |
432 | else |
432 | { |
433 | { |
433 | if (!rs[Rs_title]) |
434 | if (!rs[Rs_title]) |
434 | rs[Rs_title] = rs[Rs_name]; |
435 | rs[Rs_title] = rs[Rs_name]; |
|
|
436 | |
435 | if (!rs[Rs_iconName]) |
437 | if (!rs[Rs_iconName]) |
436 | rs[Rs_iconName] = rs[Rs_name]; |
438 | rs[Rs_iconName] = rs[Rs_name]; |
437 | } |
439 | } |
438 | |
440 | |
439 | if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) |
441 | if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) |
… | |
… | |
458 | #endif |
460 | #endif |
459 | |
461 | |
460 | /* no point having a scrollbar without having any scrollback! */ |
462 | /* no point having a scrollbar without having any scrollback! */ |
461 | if (!saveLines) |
463 | if (!saveLines) |
462 | set_option (Opt_scrollBar, 0); |
464 | set_option (Opt_scrollBar, 0); |
463 | |
|
|
464 | #ifdef PRINTPIPE |
|
|
465 | if (!rs[Rs_print_pipe]) |
|
|
466 | rs[Rs_print_pipe] = PRINTPIPE; |
|
|
467 | #endif |
|
|
468 | |
465 | |
469 | if (!rs[Rs_cutchars]) |
466 | if (!rs[Rs_cutchars]) |
470 | rs[Rs_cutchars] = CUTCHARS; |
467 | rs[Rs_cutchars] = CUTCHARS; |
471 | |
468 | |
472 | #ifndef NO_BACKSPACE_KEY |
469 | #ifndef NO_BACKSPACE_KEY |
… | |
… | |
539 | { |
536 | { |
540 | this->envv = envv; |
537 | this->envv = envv; |
541 | |
538 | |
542 | SET_R (this); |
539 | SET_R (this); |
543 | set_locale (""); |
540 | set_locale (""); |
544 | set_environ (envv); // few things in X do not call setlocale :( |
541 | set_environ (envv); // a few things in X do not call setlocale :( |
545 | |
542 | |
546 | init_vars (); |
543 | init_vars (); |
547 | |
544 | |
548 | init_secondary (); |
545 | init_secondary (); |
549 | |
546 | |
… | |
… | |
551 | |
548 | |
552 | #ifdef KEYSYM_RESOURCE |
549 | #ifdef KEYSYM_RESOURCE |
553 | keyboard->register_done (); |
550 | keyboard->register_done (); |
554 | #endif |
551 | #endif |
555 | |
552 | |
|
|
553 | if (const char *path = rs[Rs_chdir]) |
|
|
554 | if (*path) // ignored if empty |
|
|
555 | { |
|
|
556 | if (*path != '/') |
|
|
557 | rxvt_fatal ("specified shell working directory must start with a slash, aborting.\n"); |
|
|
558 | |
|
|
559 | if (chdir (path)) |
|
|
560 | rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); |
|
|
561 | } |
|
|
562 | |
556 | if (option (Opt_scrollBar)) |
563 | if (option (Opt_scrollBar)) |
557 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
564 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
558 | |
565 | |
559 | pty = ptytty::create (); |
566 | pty = ptytty::create (); |
560 | |
567 | |
561 | create_windows (argc, argv); |
568 | create_windows (argc, argv); |
562 | |
569 | |
563 | init_xlocale (); |
570 | init_xlocale (); |
564 | |
571 | |
565 | scr_reset (); // initialize screen |
572 | scr_poweron (); // initialize screen |
566 | |
573 | |
567 | #if 0 |
574 | #if 0 |
568 | XSynchronize (dpy, True); |
575 | XSynchronize (dpy, True); |
569 | #endif |
576 | #endif |
570 | |
577 | |
… | |
… | |
1130 | wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; |
1137 | wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; |
1131 | wmHint.window_group = top; |
1138 | wmHint.window_group = top; |
1132 | |
1139 | |
1133 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1140 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1134 | &szHint, &wmHint, &classHint); |
1141 | &szHint, &wmHint, &classHint); |
|
|
1142 | #if ENABLE_EWMH |
|
|
1143 | # ifdef HAVE_AFTERIMAGE |
|
|
1144 | /* |
|
|
1145 | * set up icon hint |
|
|
1146 | * rs [Rs_iconfile] is path to icon, asv has been created in init_resources |
|
|
1147 | */ |
|
|
1148 | |
|
|
1149 | if (rs [Rs_iconfile]) |
|
|
1150 | { |
|
|
1151 | init_asv (); |
|
|
1152 | |
|
|
1153 | ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
|
|
1154 | if (asv && im) |
|
|
1155 | { |
|
|
1156 | int w = im->width; |
|
|
1157 | int h = im->height; |
|
|
1158 | long* buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1159 | ASImage *result = scale_asimage (asv, im, |
|
|
1160 | w, h, ASA_ARGB32, |
|
|
1161 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
1162 | destroy_asimage (&im); |
|
|
1163 | |
|
|
1164 | if (buffer && result) |
|
|
1165 | { |
|
|
1166 | ARGB32 *asbuf = result->alt.argb32; |
|
|
1167 | buffer [0] = w; |
|
|
1168 | buffer [1] = h; |
|
|
1169 | |
|
|
1170 | for (unsigned int i = 0; i < w * h; ++i) |
|
|
1171 | buffer [i + 2] = asbuf [i]; |
|
|
1172 | |
|
|
1173 | destroy_asimage (&result); |
|
|
1174 | XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
|
|
1175 | PropModeReplace, (const unsigned char*) buffer, 2 + w * h); |
|
|
1176 | free (buffer); |
|
|
1177 | } |
|
|
1178 | else |
|
|
1179 | { |
|
|
1180 | if (!buffer) |
|
|
1181 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
|
|
1182 | |
|
|
1183 | if (!result) |
|
|
1184 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
|
|
1185 | } |
|
|
1186 | } |
|
|
1187 | else |
|
|
1188 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
|
|
1189 | } |
|
|
1190 | # endif |
|
|
1191 | #endif |
1135 | |
1192 | |
1136 | #if ENABLE_FRILLS |
1193 | #if ENABLE_FRILLS |
1137 | if (mwmhints.flags) |
1194 | if (mwmhints.flags) |
1138 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1195 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1139 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
1196 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |