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.244 by ayin, Sat Jan 26 14:24:43 2008 UTC vs.
Revision 1.257 by root, Sun Apr 26 01:51:20 2009 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",
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
485# else 482# else
486 rs[Rs_delete_key] = "\033[3~"; 483 rs[Rs_delete_key] = "\033[3~";
487# endif 484# endif
488#endif 485#endif
489 486
490#ifdef HAVE_SCROLLBARS 487 scrollBar.setup (this);
491 setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]);
492#endif
493 488
494#ifdef XTERM_REVERSE_VIDEO 489#ifdef XTERM_REVERSE_VIDEO
495 /* this is how xterm implements reverseVideo */ 490 /* this is how xterm implements reverseVideo */
496 if (option (Opt_reverseVideo)) 491 if (option (Opt_reverseVideo))
497 { 492 {
541{ 536{
542 this->envv = envv; 537 this->envv = envv;
543 538
544 SET_R (this); 539 SET_R (this);
545 set_locale (""); 540 set_locale ("");
546 set_environ (envv); // few things in X do not call setlocale :( 541 set_environ (envv); // a few things in X do not call setlocale :(
547 542
548 init_vars (); 543 init_vars ();
549 544
550 init_secondary (); 545 init_secondary ();
551 546
553 548
554#ifdef KEYSYM_RESOURCE 549#ifdef KEYSYM_RESOURCE
555 keyboard->register_done (); 550 keyboard->register_done ();
556#endif 551#endif
557 552
558#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
559 if (option (Opt_scrollBar)) 563 if (option (Opt_scrollBar))
560 scrollBar.setIdle (); /* set existence for size calculations */ 564 scrollBar.state = STATE_IDLE; /* set existence for size calculations */
561#endif
562 565
563 pty = ptytty::create (); 566 pty = ptytty::create ();
564 567
565 create_windows (argc, argv); 568 create_windows (argc, argv);
566 569
567 init_xlocale (); 570 init_xlocale ();
568 571
569 scr_reset (); // initialize screen 572 scr_poweron (); // initialize screen
570 573
571#if 0 574#if 0
572 XSynchronize (dpy, True); 575 XSynchronize (dpy, True);
573#endif 576#endif
574 577
575#ifdef HAVE_SCROLLBARS
576 if (option (Opt_scrollBar)) 578 if (option (Opt_scrollBar))
577 resize_scrollbar (); /* create and map scrollbar */ 579 scrollBar.resize (); /* create and map scrollbar */
578#endif
579#ifdef HAVE_BG_PIXMAP 580#ifdef HAVE_BG_PIXMAP
580 { 581 {
581 bgPixmap.set_target (this); 582 bgPixmap.set_target (this);
582 bgPixmap.invalidate (); 583 bgPixmap.invalidate ();
583 584
838 run_command (argv); 839 run_command (argv);
839} 840}
840 841
841/*----------------------------------------------------------------------*/ 842/*----------------------------------------------------------------------*/
842void 843void
843rxvt_term::Get_Colours () 844rxvt_term::get_colours ()
844{ 845{
845 int i; 846 int i;
846 847
847#ifdef OFF_FOCUS_FADING 848#ifdef OFF_FOCUS_FADING
848 pix_colors = pix_colors_focused; 849 pix_colors = pix_colors_focused;
908 * get scrollBar shadow colors 909 * get scrollBar shadow colors
909 * 910 *
910 * The calculations of topShadow/bottomShadow values are adapted 911 * The calculations of topShadow/bottomShadow values are adapted
911 * from the fvwm window manager. 912 * from the fvwm window manager.
912 */ 913 */
913#ifdef KEEP_SCROLLCOLOR 914#ifdef RXVT_SCROLLBAR
914 if (depth <= 2) 915 if (depth <= 2)
915 { 916 {
916 /* Monochrome */ 917 /* Monochrome */
917 alias_color (Color_scroll, Color_fg); 918 alias_color (Color_scroll, Color_fg);
918 alias_color (Color_topShadow, Color_bg); 919 alias_color (Color_topShadow, Color_bg);
933 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),
934 cscroll.a) 935 cscroll.a)
935 )) 936 ))
936 alias_color (Color_topShadow, Color_White); 937 alias_color (Color_topShadow, Color_White);
937 } 938 }
938#endif /* KEEP_SCROLLCOLOR */ 939#endif
939 940
940#ifdef OFF_FOCUS_FADING 941#ifdef OFF_FOCUS_FADING
941 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 942 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
942 update_fade_color (i); 943 update_fade_color (i);
943#endif 944#endif
1065 Window top, parent; 1066 Window top, parent;
1066 1067
1067 dLocal (Display *, dpy); 1068 dLocal (Display *, dpy);
1068 1069
1069 /* grab colors before netscape does */ 1070 /* grab colors before netscape does */
1070 Get_Colours (); 1071 get_colours ();
1071 1072
1072 if (!set_fonts ()) 1073 if (!set_fonts ())
1073 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");
1074 1075
1075 parent = display->root; 1076 parent = display->root;
1123 this->parent[0] = top; 1124 this->parent[0] = top;
1124 1125
1125 old_width = szHint.width; 1126 old_width = szHint.width;
1126 old_height = szHint.height; 1127 old_height = szHint.height;
1127 1128
1128 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); 1129 set_title (rs [Rs_title]);
1129 process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); 1130 set_icon_name (rs [Rs_iconName]);
1130 1131
1131 classHint.res_name = (char *)rs[Rs_name]; 1132 classHint.res_name = (char *)rs[Rs_name];
1132 classHint.res_class = (char *)RESCLASS; 1133 classHint.res_class = (char *)RESCLASS;
1133 1134
1134 wmHint.flags = InputHint | StateHint | WindowGroupHint; 1135 wmHint.flags = InputHint | StateHint | WindowGroupHint;
1136 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; 1137 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState;
1137 wmHint.window_group = top; 1138 wmHint.window_group = top;
1138 1139
1139 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, 1140 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
1140 &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
1141 1192
1142#if ENABLE_FRILLS 1193#if ENABLE_FRILLS
1143 if (mwmhints.flags) 1194 if (mwmhints.flags)
1144 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,
1145 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); 1196 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS);
1530 signal (SIGTSTP, SIG_IGN); 1581 signal (SIGTSTP, SIG_IGN);
1531 signal (SIGTTIN, SIG_IGN); 1582 signal (SIGTTIN, SIG_IGN);
1532 signal (SIGTTOU, SIG_IGN); 1583 signal (SIGTTOU, SIG_IGN);
1533#endif /* SIGTSTP */ 1584#endif /* SIGTSTP */
1534 1585
1535 // unblock signals (signals are blocked by iom.C
1536 sigset_t ss;
1537 sigemptyset (&ss);
1538 sigprocmask (SIG_SETMASK, &ss, 0);
1539
1540 /* command interpreter path */ 1586 /* command interpreter path */
1541 if (argv) 1587 if (argv)
1542 { 1588 {
1543# ifdef DEBUG_CMD 1589# ifdef DEBUG_CMD
1544 int i; 1590 int i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines