ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/init.C
(Generate patch)

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.243 by root, Fri Jan 25 16:04:57 2008 UTC vs.
Revision 1.255 by root, Tue Nov 4 13:20:40 2008 UTC

267 NULL, // Color_underline 267 NULL, // Color_underline
268#endif 268#endif
269#ifdef OPTION_HC 269#ifdef OPTION_HC
270 NULL, 270 NULL,
271#endif 271#endif
272#ifdef KEEP_SCROLLCOLOR
273 COLOR_SCROLLBAR, 272 COLOR_SCROLLBAR,
273#ifdef RXVT_SCROLLBAR
274 COLOR_SCROLLTROUGH, 274 COLOR_SCROLLTROUGH,
275#endif /* KEEP_SCROLLCOLOR */ 275#endif
276#if ENABLE_TRANSPARENCY 276#if ENABLE_TRANSPARENCY
277 NULL, 277 NULL,
278#endif 278#endif
279#if OFF_FOCUS_FADING 279#if OFF_FOCUS_FADING
280 "rgb:00/00/00", 280 "rgb:00/00/00",
308 set_option (Opt_secondaryScreen); 308 set_option (Opt_secondaryScreen);
309 set_option (Opt_secondaryScroll); 309 set_option (Opt_secondaryScroll);
310 set_option (Opt_pastableTabs); 310 set_option (Opt_pastableTabs);
311 set_option (Opt_intensityStyles); 311 set_option (Opt_intensityStyles);
312 set_option (Opt_iso14755_52); 312 set_option (Opt_iso14755_52);
313 set_option (Opt_buffered);
313} 314}
314 315
315static void 316static void
316init_secondary () 317init_secondary ()
317{ 318{
391#if XFT 392#if XFT
392 if (rs[Rs_depth]) 393 if (rs[Rs_depth])
393 select_visual (strtol (rs[Rs_depth], 0, 0)); 394 select_visual (strtol (rs[Rs_depth], 0, 0));
394#endif 395#endif
395 396
396#ifdef HAVE_AFTERIMAGE
397 set_application_name ((char*)rs[Rs_name]);
398 set_output_threshold (OUTPUT_LEVEL_WARNING);
399 asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL);
400#endif
401 free (r_argv); 397 free (r_argv);
402 398
403 for (int i = NUM_RESOURCES; i--; ) 399 for (int i = NUM_RESOURCES; i--; )
404 if (rs [i] == resval_undef) 400 if (rs [i] == resval_undef)
405 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
406 407
407#if ENABLE_PERL 408#if ENABLE_PERL
408 if (!rs[Rs_perl_ext_1]) 409 if (!rs[Rs_perl_ext_1])
409 rs[Rs_perl_ext_1] = "default"; 410 rs[Rs_perl_ext_1] = "default";
410 411
422 */ 423 */
423 if (cmd_argv && cmd_argv[0]) 424 if (cmd_argv && cmd_argv[0])
424 { 425 {
425 if (!rs[Rs_title]) 426 if (!rs[Rs_title])
426 rs[Rs_title] = rxvt_basename (cmd_argv[0]); 427 rs[Rs_title] = rxvt_basename (cmd_argv[0]);
428
427 if (!rs[Rs_iconName]) 429 if (!rs[Rs_iconName])
428 rs[Rs_iconName] = rs[Rs_title]; 430 rs[Rs_iconName] = rs[Rs_title];
429 } 431 }
430 else 432 else
431 { 433 {
432 if (!rs[Rs_title]) 434 if (!rs[Rs_title])
433 rs[Rs_title] = rs[Rs_name]; 435 rs[Rs_title] = rs[Rs_name];
436
434 if (!rs[Rs_iconName]) 437 if (!rs[Rs_iconName])
435 rs[Rs_iconName] = rs[Rs_name]; 438 rs[Rs_iconName] = rs[Rs_name];
436 } 439 }
437 440
438 if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) 441 if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0)
457#endif 460#endif
458 461
459 /* no point having a scrollbar without having any scrollback! */ 462 /* no point having a scrollbar without having any scrollback! */
460 if (!saveLines) 463 if (!saveLines)
461 set_option (Opt_scrollBar, 0); 464 set_option (Opt_scrollBar, 0);
462
463#ifdef PRINTPIPE
464 if (!rs[Rs_print_pipe])
465 rs[Rs_print_pipe] = PRINTPIPE;
466#endif
467 465
468 if (!rs[Rs_cutchars]) 466 if (!rs[Rs_cutchars])
469 rs[Rs_cutchars] = CUTCHARS; 467 rs[Rs_cutchars] = CUTCHARS;
470 468
471#ifndef NO_BACKSPACE_KEY 469#ifndef NO_BACKSPACE_KEY
484# else 482# else
485 rs[Rs_delete_key] = "\033[3~"; 483 rs[Rs_delete_key] = "\033[3~";
486# endif 484# endif
487#endif 485#endif
488 486
489#ifdef HAVE_SCROLLBARS 487 scrollBar.setup (this);
490 setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]);
491#endif
492 488
493#ifdef XTERM_REVERSE_VIDEO 489#ifdef XTERM_REVERSE_VIDEO
494 /* this is how xterm implements reverseVideo */ 490 /* this is how xterm implements reverseVideo */
495 if (option (Opt_reverseVideo)) 491 if (option (Opt_reverseVideo))
496 { 492 {
540{ 536{
541 this->envv = envv; 537 this->envv = envv;
542 538
543 SET_R (this); 539 SET_R (this);
544 set_locale (""); 540 set_locale ("");
545 set_environ (envv); // few things in X do not call setlocale :( 541 set_environ (envv); // a few things in X do not call setlocale :(
546 542
547 init_vars (); 543 init_vars ();
548 544
549 init_secondary (); 545 init_secondary ();
550 546
552 548
553#ifdef KEYSYM_RESOURCE 549#ifdef KEYSYM_RESOURCE
554 keyboard->register_done (); 550 keyboard->register_done ();
555#endif 551#endif
556 552
557#ifdef HAVE_SCROLLBARS 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
558 if (option (Opt_scrollBar)) 563 if (option (Opt_scrollBar))
559 scrollBar.setIdle (); /* set existence for size calculations */ 564 scrollBar.state = STATE_IDLE; /* set existence for size calculations */
560#endif
561 565
562 pty = ptytty::create (); 566 pty = ptytty::create ();
563 567
564 create_windows (argc, argv); 568 create_windows (argc, argv);
565 569
569 573
570#if 0 574#if 0
571 XSynchronize (dpy, True); 575 XSynchronize (dpy, True);
572#endif 576#endif
573 577
574#ifdef HAVE_SCROLLBARS
575 if (option (Opt_scrollBar)) 578 if (option (Opt_scrollBar))
576 resize_scrollbar (); /* create and map scrollbar */ 579 scrollBar.resize (); /* create and map scrollbar */
577#endif
578#ifdef HAVE_BG_PIXMAP 580#ifdef HAVE_BG_PIXMAP
579 { 581 {
580 bgPixmap.set_target (this); 582 bgPixmap.set_target (this);
581 bgPixmap.invalidate (); 583 bgPixmap.invalidate ();
582 584
837 run_command (argv); 839 run_command (argv);
838} 840}
839 841
840/*----------------------------------------------------------------------*/ 842/*----------------------------------------------------------------------*/
841void 843void
842rxvt_term::Get_Colours () 844rxvt_term::get_colours ()
843{ 845{
844 int i; 846 int i;
845 847
846#ifdef OFF_FOCUS_FADING 848#ifdef OFF_FOCUS_FADING
847 pix_colors = pix_colors_focused; 849 pix_colors = pix_colors_focused;
907 * get scrollBar shadow colors 909 * get scrollBar shadow colors
908 * 910 *
909 * The calculations of topShadow/bottomShadow values are adapted 911 * The calculations of topShadow/bottomShadow values are adapted
910 * from the fvwm window manager. 912 * from the fvwm window manager.
911 */ 913 */
912#ifdef KEEP_SCROLLCOLOR 914#ifdef RXVT_SCROLLBAR
913 if (depth <= 2) 915 if (depth <= 2)
914 { 916 {
915 /* Monochrome */ 917 /* Monochrome */
916 alias_color (Color_scroll, Color_fg); 918 alias_color (Color_scroll, Color_fg);
917 alias_color (Color_topShadow, Color_bg); 919 alias_color (Color_topShadow, Color_bg);
932 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), 934 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
933 cscroll.a) 935 cscroll.a)
934 )) 936 ))
935 alias_color (Color_topShadow, Color_White); 937 alias_color (Color_topShadow, Color_White);
936 } 938 }
937#endif /* KEEP_SCROLLCOLOR */ 939#endif
938 940
939#ifdef OFF_FOCUS_FADING 941#ifdef OFF_FOCUS_FADING
940 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 942 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
941 update_fade_color (i); 943 update_fade_color (i);
942#endif 944#endif
1064 Window top, parent; 1066 Window top, parent;
1065 1067
1066 dLocal (Display *, dpy); 1068 dLocal (Display *, dpy);
1067 1069
1068 /* grab colors before netscape does */ 1070 /* grab colors before netscape does */
1069 Get_Colours (); 1071 get_colours ();
1070 1072
1071 if (!set_fonts ()) 1073 if (!set_fonts ())
1072 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); 1074 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
1073 1075
1074 parent = display->root; 1076 parent = display->root;
1135 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; 1137 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState;
1136 wmHint.window_group = top; 1138 wmHint.window_group = top;
1137 1139
1138 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, 1140 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
1139 &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
1140 1192
1141#if ENABLE_FRILLS 1193#if ENABLE_FRILLS
1142 if (mwmhints.flags) 1194 if (mwmhints.flags)
1143 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,
1144 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); 1196 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS);
1529 signal (SIGTSTP, SIG_IGN); 1581 signal (SIGTSTP, SIG_IGN);
1530 signal (SIGTTIN, SIG_IGN); 1582 signal (SIGTTIN, SIG_IGN);
1531 signal (SIGTTOU, SIG_IGN); 1583 signal (SIGTTOU, SIG_IGN);
1532#endif /* SIGTSTP */ 1584#endif /* SIGTSTP */
1533 1585
1534 // unblock signals (signals are blocked by iom.C
1535 sigset_t ss;
1536 sigemptyset (&ss);
1537 sigprocmask (SIG_SETMASK, &ss, 0);
1538
1539 /* command interpreter path */ 1586 /* command interpreter path */
1540 if (argv) 1587 if (argv)
1541 { 1588 {
1542# ifdef DEBUG_CMD 1589# ifdef DEBUG_CMD
1543 int i; 1590 int i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines