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.254 by root, Tue Nov 4 11:03:29 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",
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])
485# else 480# else
486 rs[Rs_delete_key] = "\033[3~"; 481 rs[Rs_delete_key] = "\033[3~";
487# endif 482# endif
488#endif 483#endif
489 484
490#ifdef HAVE_SCROLLBARS 485 scrollBar.setup (this);
491 setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]);
492#endif
493 486
494#ifdef XTERM_REVERSE_VIDEO 487#ifdef XTERM_REVERSE_VIDEO
495 /* this is how xterm implements reverseVideo */ 488 /* this is how xterm implements reverseVideo */
496 if (option (Opt_reverseVideo)) 489 if (option (Opt_reverseVideo))
497 { 490 {
541{ 534{
542 this->envv = envv; 535 this->envv = envv;
543 536
544 SET_R (this); 537 SET_R (this);
545 set_locale (""); 538 set_locale ("");
546 set_environ (envv); // few things in X do not call setlocale :( 539 set_environ (envv); // a few things in X do not call setlocale :(
547 540
548 init_vars (); 541 init_vars ();
549 542
550 init_secondary (); 543 init_secondary ();
551 544
553 546
554#ifdef KEYSYM_RESOURCE 547#ifdef KEYSYM_RESOURCE
555 keyboard->register_done (); 548 keyboard->register_done ();
556#endif 549#endif
557 550
558#ifdef HAVE_SCROLLBARS 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 }
560
559 if (option (Opt_scrollBar)) 561 if (option (Opt_scrollBar))
560 scrollBar.setIdle (); /* set existence for size calculations */ 562 scrollBar.state = STATE_IDLE; /* set existence for size calculations */
561#endif
562 563
563 pty = ptytty::create (); 564 pty = ptytty::create ();
564 565
565 create_windows (argc, argv); 566 create_windows (argc, argv);
566 567
570 571
571#if 0 572#if 0
572 XSynchronize (dpy, True); 573 XSynchronize (dpy, True);
573#endif 574#endif
574 575
575#ifdef HAVE_SCROLLBARS
576 if (option (Opt_scrollBar)) 576 if (option (Opt_scrollBar))
577 resize_scrollbar (); /* create and map scrollbar */ 577 scrollBar.resize (); /* create and map scrollbar */
578#endif
579#ifdef HAVE_BG_PIXMAP 578#ifdef HAVE_BG_PIXMAP
580 { 579 {
581 bgPixmap.set_target (this); 580 bgPixmap.set_target (this);
582 bgPixmap.invalidate (); 581 bgPixmap.invalidate ();
583 582
838 run_command (argv); 837 run_command (argv);
839} 838}
840 839
841/*----------------------------------------------------------------------*/ 840/*----------------------------------------------------------------------*/
842void 841void
843rxvt_term::Get_Colours () 842rxvt_term::get_colours ()
844{ 843{
845 int i; 844 int i;
846 845
847#ifdef OFF_FOCUS_FADING 846#ifdef OFF_FOCUS_FADING
848 pix_colors = pix_colors_focused; 847 pix_colors = pix_colors_focused;
908 * get scrollBar shadow colors 907 * get scrollBar shadow colors
909 * 908 *
910 * The calculations of topShadow/bottomShadow values are adapted 909 * The calculations of topShadow/bottomShadow values are adapted
911 * from the fvwm window manager. 910 * from the fvwm window manager.
912 */ 911 */
913#ifdef KEEP_SCROLLCOLOR 912#ifdef RXVT_SCROLLBAR
914 if (depth <= 2) 913 if (depth <= 2)
915 { 914 {
916 /* Monochrome */ 915 /* Monochrome */
917 alias_color (Color_scroll, Color_fg); 916 alias_color (Color_scroll, Color_fg);
918 alias_color (Color_topShadow, Color_bg); 917 alias_color (Color_topShadow, Color_bg);
933 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), 932 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
934 cscroll.a) 933 cscroll.a)
935 )) 934 ))
936 alias_color (Color_topShadow, Color_White); 935 alias_color (Color_topShadow, Color_White);
937 } 936 }
938#endif /* KEEP_SCROLLCOLOR */ 937#endif
939 938
940#ifdef OFF_FOCUS_FADING 939#ifdef OFF_FOCUS_FADING
941 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 940 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
942 update_fade_color (i); 941 update_fade_color (i);
943#endif 942#endif
1065 Window top, parent; 1064 Window top, parent;
1066 1065
1067 dLocal (Display *, dpy); 1066 dLocal (Display *, dpy);
1068 1067
1069 /* grab colors before netscape does */ 1068 /* grab colors before netscape does */
1070 Get_Colours (); 1069 get_colours ();
1071 1070
1072 if (!set_fonts ()) 1071 if (!set_fonts ())
1073 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");
1074 1073
1075 parent = display->root; 1074 parent = display->root;
1136 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; 1135 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState;
1137 wmHint.window_group = top; 1136 wmHint.window_group = top;
1138 1137
1139 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, 1138 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
1140 &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
1141 1187
1142#if ENABLE_FRILLS 1188#if ENABLE_FRILLS
1143 if (mwmhints.flags) 1189 if (mwmhints.flags)
1144 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,
1145 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); 1191 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS);
1530 signal (SIGTSTP, SIG_IGN); 1576 signal (SIGTSTP, SIG_IGN);
1531 signal (SIGTTIN, SIG_IGN); 1577 signal (SIGTTIN, SIG_IGN);
1532 signal (SIGTTOU, SIG_IGN); 1578 signal (SIGTTOU, SIG_IGN);
1533#endif /* SIGTSTP */ 1579#endif /* SIGTSTP */
1534 1580
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 */ 1581 /* command interpreter path */
1541 if (argv) 1582 if (argv)
1542 { 1583 {
1543# ifdef DEBUG_CMD 1584# ifdef DEBUG_CMD
1544 int i; 1585 int i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines