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

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.149 by root, Sun Dec 18 00:59:42 2005 UTC vs.
Revision 1.154 by root, Sat Dec 31 17:16:17 2005 UTC

31 *---------------------------------------------------------------------*/ 31 *---------------------------------------------------------------------*/
32 32
33#include "../config.h" /* NECESSARY */ 33#include "../config.h" /* NECESSARY */
34#include "rxvt.h" /* NECESSARY */ 34#include "rxvt.h" /* NECESSARY */
35 35
36#include <limits>
37
36#include <csignal> 38#include <csignal>
37#include <cstring> 39#include <cstring>
38 40
39#ifdef TTY_GID_SUPPORT 41#ifdef TTY_GID_SUPPORT
40# include <grp.h> 42# include <grp.h>
284 delete argv; 286 delete argv;
285 287
286#ifdef KEYSYM_RESOURCE 288#ifdef KEYSYM_RESOURCE
287 delete keyboard; 289 delete keyboard;
288#endif 290#endif
291}
292
293void
294rxvt_term::child_exit ()
295{
296 cmd_pid = 0;
297
298 if (!OPTION (Opt_hold))
299 destroy ();
289} 300}
290 301
291void 302void
292rxvt_term::destroy () 303rxvt_term::destroy ()
293{ 304{
458 469
459#if MENUBAR_MAX 470#if MENUBAR_MAX
460 menubar_read (rs[Rs_menu]); 471 menubar_read (rs[Rs_menu]);
461#endif 472#endif
462#ifdef HAVE_SCROLLBARS 473#ifdef HAVE_SCROLLBARS
463 if (options & Opt_scrollBar) 474 if (OPTION (Opt_scrollBar))
464 scrollBar.setIdle (); /* set existence for size calculations */ 475 scrollBar.setIdle (); /* set existence for size calculations */
465#endif 476#endif
466 477
467 create_windows (argc, argv); 478 create_windows (argc, argv);
468 479
475#if 0 486#if 0
476 XSynchronize (disp, True); 487 XSynchronize (disp, True);
477#endif 488#endif
478 489
479#ifdef HAVE_SCROLLBARS 490#ifdef HAVE_SCROLLBARS
480 if (options & Opt_scrollBar) 491 if (OPTION (Opt_scrollBar))
481 resize_scrollbar (); /* create and map scrollbar */ 492 resize_scrollbar (); /* create and map scrollbar */
482#endif 493#endif
483#if (MENUBAR_MAX) 494#if (MENUBAR_MAX)
484 if (menubar_visible ()) 495 if (menubar_visible ())
485 XMapWindow (disp, menuBar.win); 496 XMapWindow (disp, menuBar.win);
486#endif 497#endif
487#ifdef TRANSPARENT 498#ifdef TRANSPARENT
488 if (options & Opt_transparent) 499 if (OPTION (Opt_transparent))
489 { 500 {
490 XSelectInput (disp, display->root, PropertyChangeMask); 501 XSelectInput (disp, display->root, PropertyChangeMask);
491 check_our_parents (); 502 check_our_parents ();
492 rootwin_ev.start (display, display->root); 503 rootwin_ev.start (display, display->root);
493 } 504 }
520 531
521 while ((pid = waitpid (-1, NULL, WNOHANG)) > 0) 532 while ((pid = waitpid (-1, NULL, WNOHANG)) > 0)
522 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) 533 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
523 if (pid == (*t)->cmd_pid) 534 if (pid == (*t)->cmd_pid)
524 { 535 {
525 (*t)->destroy (); 536 (*t)->child_exit ();
526 break; 537 break;
527 } 538 }
528 } 539 }
529 540
530 /* 541 /*
670 681
671#ifdef UTMP_SUPPORT 682#ifdef UTMP_SUPPORT
672void 683void
673rxvt_term::privileged_utmp (rxvt_privaction action) 684rxvt_term::privileged_utmp (rxvt_privaction action)
674{ 685{
675 if ((options & Opt_utmpInhibit) 686 if (OPTION (Opt_utmpInhibit)
676 || !pty.name || !*pty.name) 687 || !pty.name || !*pty.name)
677 return; 688 return;
678 689
679 rxvt_privileges (RESTORE); 690 rxvt_privileges (RESTORE);
680 691
718 if (rs[Rs_geometry]) 729 if (rs[Rs_geometry])
719 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); 730 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h);
720 731
721 if (flags & WidthValue) 732 if (flags & WidthValue)
722 { 733 {
723 ncol = BOUND_POSITIVE_INT16 (w); 734 ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ());
724 szHint.flags |= USSize; 735 szHint.flags |= USSize;
725 } 736 }
726 737
727 if (flags & HeightValue) 738 if (flags & HeightValue)
728 { 739 {
729 nrow = BOUND_POSITIVE_INT16 (h); 740 nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ());
730 szHint.flags |= USSize; 741 szHint.flags |= USSize;
731 } 742 }
732 743
733 if (flags & XValue) 744 if (flags & XValue)
734 { 745 {
772 783
773 if (scrollbar_visible ()) 784 if (scrollbar_visible ())
774 { 785 {
775 sb_w = scrollbar_TotalWidth (); 786 sb_w = scrollbar_TotalWidth ();
776 szHint.base_width += sb_w; 787 szHint.base_width += sb_w;
777 if (!(options & Opt_scrollBar_right)) 788 if (!OPTION (Opt_scrollBar_right))
778 window_vt_x += sb_w; 789 window_vt_x += sb_w;
779 } 790 }
780 791
781 if (menubar_visible ()) 792 if (menubar_visible ())
782 { 793 {
795 szHint.width = newwidth; 806 szHint.width = newwidth;
796 width = newwidth - szHint.base_width; 807 width = newwidth - szHint.base_width;
797 } 808 }
798 else 809 else
799 { 810 {
800 MIN_IT (width, max_width); 811 min_it (width, max_width);
801 szHint.width = szHint.base_width + width; 812 szHint.width = szHint.base_width + width;
802 } 813 }
803 814
804 if (newheight && newheight - szHint.base_height < max_height) 815 if (newheight && newheight - szHint.base_height < max_height)
805 { 816 {
806 szHint.height = newheight; 817 szHint.height = newheight;
807 height = newheight - szHint.base_height; 818 height = newheight - szHint.base_height;
808 } 819 }
809 else 820 else
810 { 821 {
811 MIN_IT (height, max_height); 822 min_it (height, max_height);
812 szHint.height = szHint.base_height + height; 823 szHint.height = szHint.base_height + height;
813 } 824 }
814 825
815 if (scrollbar_visible () && (options & Opt_scrollBar_right)) 826 if (scrollbar_visible () && OPTION (Opt_scrollBar_right))
816 window_sb_x = szHint.width - sb_w; 827 window_sb_x = szHint.width - sb_w;
817 828
818 if (recalc_x) 829 if (recalc_x)
819 szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; 830 szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth;
820 if (recalc_y) 831 if (recalc_y)
889 prop.height += lineSpace; 900 prop.height += lineSpace;
890 fs->set_prop (prop); 901 fs->set_prop (prop);
891 902
892 fwidth = prop.width; 903 fwidth = prop.width;
893 fheight = prop.height; 904 fheight = prop.height;
894 fweight = prop.weight;
895 fslant = prop.slant;
896 fbase = (*fs)[1]->ascent; 905 fbase = (*fs)[1]->ascent;
897 906
898 for (int style = 1; style < 4; style++) 907 for (int style = 1; style < 4; style++)
899 { 908 {
900#if ENABLE_STYLES 909#if ENABLE_STYLES
935 return true; 944 return true;
936} 945}
937 946
938void rxvt_term::set_string_property (Atom prop, const char *str, int len) 947void rxvt_term::set_string_property (Atom prop, const char *str, int len)
939{ 948{
940 // TODO: SMART_WINDOW_TITLE
941 XChangeProperty (display->display, parent[0], 949 XChangeProperty (display->display, parent[0],
942 prop, XA_STRING, 8, PropModeReplace, 950 prop, XA_STRING, 8, PropModeReplace,
943 (const unsigned char *)str, len >= 0 ? len : strlen (str)); 951 (const unsigned char *)str, len >= 0 ? len : strlen (str));
944} 952}
945 953
946void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) 954void rxvt_term::set_utf8_property (Atom prop, const char *str, int len)
947{ 955{
948 // TODO: SMART_WINDOW_TITLE
949 wchar_t *ws = rxvt_mbstowcs (str, len); 956 wchar_t *ws = rxvt_mbstowcs (str, len);
950 char *s = rxvt_wcstoutf8 (ws); 957 char *s = rxvt_wcstoutf8 (ws);
951 958
952 XChangeProperty (display->display, parent[0], 959 XChangeProperty (display->display, parent[0],
953 prop, xa[XA_UTF8_STRING], 8, PropModeReplace, 960 prop, xa[XA_UTF8_STRING], 8, PropModeReplace,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines