… | |
… | |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
14 | * - extensive modifications |
14 | * - extensive modifications |
15 | * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> |
15 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
16 | * |
16 | * |
17 | * This program is free software; you can redistribute it and/or modify |
17 | * This program is free software; you can redistribute it and/or modify |
18 | * it under the terms of the GNU General Public License as published by |
18 | * it under the terms of the GNU General Public License as published by |
19 | * the Free Software Foundation; either version 2 of the License, or |
19 | * the Free Software Foundation; either version 2 of the License, or |
20 | * (at your option) any later version. |
20 | * (at your option) any later version. |
… | |
… | |
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 | |
315 | void |
316 | static void |
316 | rxvt_term::init_secondary () |
317 | init_secondary () |
317 | { |
318 | { |
318 | int i; |
319 | int i; |
319 | |
320 | |
320 | /* |
|
|
321 | * Close all unused file descriptors |
|
|
322 | * We don't want them, we don't need them. |
|
|
323 | */ |
|
|
324 | if ((i = open ("/dev/null", O_RDONLY)) < 0) |
321 | if ((i = open ("/dev/null", O_RDONLY)) < 0) |
325 | { |
322 | { |
326 | /* TODO: BOO HISS */ |
|
|
327 | dup2 (STDERR_FILENO, STDIN_FILENO); |
323 | dup2 (STDERR_FILENO, STDIN_FILENO); |
328 | } |
324 | } |
329 | else if (i != STDIN_FILENO) |
325 | else if (i != STDIN_FILENO) |
330 | { |
326 | { |
331 | dup2 (i, STDIN_FILENO); |
327 | dup2 (i, STDIN_FILENO); |
332 | close (i); |
328 | close (i); |
333 | } |
329 | } |
334 | |
330 | |
335 | dup2 (STDERR_FILENO, STDOUT_FILENO); |
331 | dup2 (STDERR_FILENO, STDOUT_FILENO); |
336 | |
|
|
337 | #if 0 // schmorp sayz closing filies is murder |
|
|
338 | for (i = STDERR_FILENO + 1; i < num_fds; i++) |
|
|
339 | { |
|
|
340 | #ifdef __sgi /* Alex Coventry says we need 4 & 7 too */ |
|
|
341 | if (i == 4 || i == 7) |
|
|
342 | continue; |
|
|
343 | #endif |
|
|
344 | close (i); |
|
|
345 | } |
|
|
346 | #endif |
|
|
347 | } |
332 | } |
348 | |
333 | |
349 | /*----------------------------------------------------------------------*/ |
334 | /*----------------------------------------------------------------------*/ |
350 | const char ** |
335 | const char ** |
351 | rxvt_term::init_resources (int argc, const char *const *argv) |
336 | rxvt_term::init_resources (int argc, const char *const *argv) |
… | |
… | |
500 | # else |
485 | # else |
501 | rs[Rs_delete_key] = "\033[3~"; |
486 | rs[Rs_delete_key] = "\033[3~"; |
502 | # endif |
487 | # endif |
503 | #endif |
488 | #endif |
504 | |
489 | |
505 | #ifdef HAVE_SCROLLBARS |
490 | scrollBar.setup (this); |
506 | setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]); |
|
|
507 | #endif |
|
|
508 | |
491 | |
509 | #ifdef XTERM_REVERSE_VIDEO |
492 | #ifdef XTERM_REVERSE_VIDEO |
510 | /* this is how xterm implements reverseVideo */ |
493 | /* this is how xterm implements reverseVideo */ |
511 | if (option (Opt_reverseVideo)) |
494 | if (option (Opt_reverseVideo)) |
512 | { |
495 | { |
… | |
… | |
568 | |
551 | |
569 | #ifdef KEYSYM_RESOURCE |
552 | #ifdef KEYSYM_RESOURCE |
570 | keyboard->register_done (); |
553 | keyboard->register_done (); |
571 | #endif |
554 | #endif |
572 | |
555 | |
573 | #ifdef HAVE_SCROLLBARS |
|
|
574 | if (option (Opt_scrollBar)) |
556 | if (option (Opt_scrollBar)) |
575 | scrollBar.setIdle (); /* set existence for size calculations */ |
557 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
576 | #endif |
|
|
577 | |
558 | |
578 | pty = ptytty::create (); |
559 | pty = ptytty::create (); |
579 | |
560 | |
580 | create_windows (argc, argv); |
561 | create_windows (argc, argv); |
581 | |
562 | |
… | |
… | |
585 | |
566 | |
586 | #if 0 |
567 | #if 0 |
587 | XSynchronize (dpy, True); |
568 | XSynchronize (dpy, True); |
588 | #endif |
569 | #endif |
589 | |
570 | |
590 | #ifdef HAVE_SCROLLBARS |
|
|
591 | if (option (Opt_scrollBar)) |
571 | if (option (Opt_scrollBar)) |
592 | resize_scrollbar (); /* create and map scrollbar */ |
572 | scrollBar.resize (); /* create and map scrollbar */ |
593 | #endif |
|
|
594 | #ifdef HAVE_BG_PIXMAP |
573 | #ifdef HAVE_BG_PIXMAP |
595 | { |
574 | { |
596 | bgPixmap.set_target (this); |
575 | bgPixmap.set_target (this); |
597 | bgPixmap.invalidate (); |
576 | bgPixmap.invalidate (); |
598 | |
577 | |
… | |
… | |
853 | run_command (argv); |
832 | run_command (argv); |
854 | } |
833 | } |
855 | |
834 | |
856 | /*----------------------------------------------------------------------*/ |
835 | /*----------------------------------------------------------------------*/ |
857 | void |
836 | void |
858 | rxvt_term::Get_Colours () |
837 | rxvt_term::get_colours () |
859 | { |
838 | { |
860 | int i; |
839 | int i; |
861 | |
840 | |
862 | #ifdef OFF_FOCUS_FADING |
841 | #ifdef OFF_FOCUS_FADING |
863 | pix_colors = pix_colors_focused; |
842 | pix_colors = pix_colors_focused; |
… | |
… | |
923 | * get scrollBar shadow colors |
902 | * get scrollBar shadow colors |
924 | * |
903 | * |
925 | * The calculations of topShadow/bottomShadow values are adapted |
904 | * The calculations of topShadow/bottomShadow values are adapted |
926 | * from the fvwm window manager. |
905 | * from the fvwm window manager. |
927 | */ |
906 | */ |
928 | #ifdef KEEP_SCROLLCOLOR |
907 | #ifdef RXVT_SCROLLBAR |
929 | if (depth <= 2) |
908 | if (depth <= 2) |
930 | { |
909 | { |
931 | /* Monochrome */ |
910 | /* Monochrome */ |
932 | alias_color (Color_scroll, Color_fg); |
911 | alias_color (Color_scroll, Color_fg); |
933 | alias_color (Color_topShadow, Color_bg); |
912 | alias_color (Color_topShadow, Color_bg); |
… | |
… | |
948 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
927 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
949 | cscroll.a) |
928 | cscroll.a) |
950 | )) |
929 | )) |
951 | alias_color (Color_topShadow, Color_White); |
930 | alias_color (Color_topShadow, Color_White); |
952 | } |
931 | } |
953 | #endif /* KEEP_SCROLLCOLOR */ |
932 | #endif |
954 | |
933 | |
955 | #ifdef OFF_FOCUS_FADING |
934 | #ifdef OFF_FOCUS_FADING |
956 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
935 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
957 | update_fade_color (i); |
936 | update_fade_color (i); |
958 | #endif |
937 | #endif |
… | |
… | |
1080 | Window top, parent; |
1059 | Window top, parent; |
1081 | |
1060 | |
1082 | dLocal (Display *, dpy); |
1061 | dLocal (Display *, dpy); |
1083 | |
1062 | |
1084 | /* grab colors before netscape does */ |
1063 | /* grab colors before netscape does */ |
1085 | Get_Colours (); |
1064 | get_colours (); |
1086 | |
1065 | |
1087 | if (!set_fonts ()) |
1066 | if (!set_fonts ()) |
1088 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1067 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1089 | |
1068 | |
1090 | parent = display->root; |
1069 | parent = display->root; |
… | |
… | |
1545 | signal (SIGTSTP, SIG_IGN); |
1524 | signal (SIGTSTP, SIG_IGN); |
1546 | signal (SIGTTIN, SIG_IGN); |
1525 | signal (SIGTTIN, SIG_IGN); |
1547 | signal (SIGTTOU, SIG_IGN); |
1526 | signal (SIGTTOU, SIG_IGN); |
1548 | #endif /* SIGTSTP */ |
1527 | #endif /* SIGTSTP */ |
1549 | |
1528 | |
1550 | // unblock signals (signals are blocked by iom.C |
|
|
1551 | sigset_t ss; |
|
|
1552 | sigemptyset (&ss); |
|
|
1553 | sigprocmask (SIG_SETMASK, &ss, 0); |
|
|
1554 | |
|
|
1555 | /* command interpreter path */ |
1529 | /* command interpreter path */ |
1556 | if (argv) |
1530 | if (argv) |
1557 | { |
1531 | { |
1558 | # ifdef DEBUG_CMD |
1532 | # ifdef DEBUG_CMD |
1559 | int i; |
1533 | int i; |