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.153 by root, Tue Dec 27 12:23:37 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 (!(options & Opt_hold))
299 destroy ();
289} 300}
290 301
291void 302void
292rxvt_term::destroy () 303rxvt_term::destroy ()
293{ 304{
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 /*
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 {
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 () && (options & Opt_scrollBar_right))
816 window_sb_x = szHint.width - sb_w; 827 window_sb_x = szHint.width - sb_w;
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