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.151 by root, Wed Dec 21 19:50:16 2005 UTC vs.
Revision 1.155 by root, Mon Jan 2 15:35:43 2006 UTC

30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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#include "keyboard.h"
36#include "rxvtperl.h"
35 37
36#include <limits> 38#include <limits>
37 39
38#include <csignal> 40#include <csignal>
39#include <cstring> 41#include <cstring>
42# include <grp.h> 44# include <grp.h>
43#endif 45#endif
44 46
45#ifdef HAVE_TERMIOS_H 47#ifdef HAVE_TERMIOS_H
46# include <termios.h> 48# include <termios.h>
47#endif
48
49#ifdef KEYSYM_RESOURCE
50# include "keyboard.h"
51#endif 49#endif
52 50
53vector<rxvt_term *> rxvt_term::termlist; 51vector<rxvt_term *> rxvt_term::termlist;
54 52
55static char curlocale[128]; 53static char curlocale[128];
195 pty.put (); 193 pty.put ();
196} 194}
197 195
198rxvt_term::~rxvt_term () 196rxvt_term::~rxvt_term ()
199{ 197{
198 PERL_INVOKE ((this, HOOK_DESTROY, DT_END));
199
200 termlist.erase (find (termlist.begin (), termlist.end(), this)); 200 termlist.erase (find (termlist.begin (), termlist.end(), this));
201 201
202 emergency_cleanup (); 202 emergency_cleanup ();
203 203
204#if ENABLE_STYLES 204#if ENABLE_STYLES
286 delete argv; 286 delete argv;
287 287
288#ifdef KEYSYM_RESOURCE 288#ifdef KEYSYM_RESOURCE
289 delete keyboard; 289 delete keyboard;
290#endif 290#endif
291}
292
293void
294rxvt_term::child_exit ()
295{
296 cmd_pid = 0;
297
298 if (!OPTION (Opt_hold))
299 destroy ();
291} 300}
292 301
293void 302void
294rxvt_term::destroy () 303rxvt_term::destroy ()
295{ 304{
460 469
461#if MENUBAR_MAX 470#if MENUBAR_MAX
462 menubar_read (rs[Rs_menu]); 471 menubar_read (rs[Rs_menu]);
463#endif 472#endif
464#ifdef HAVE_SCROLLBARS 473#ifdef HAVE_SCROLLBARS
465 if (options & Opt_scrollBar) 474 if (OPTION (Opt_scrollBar))
466 scrollBar.setIdle (); /* set existence for size calculations */ 475 scrollBar.setIdle (); /* set existence for size calculations */
467#endif 476#endif
477
478#if ENABLE_PERL
479 rxvt_perl.init ();
480#endif
481
482 PERL_INVOKE ((this, HOOK_INIT, DT_END));
468 483
469 create_windows (argc, argv); 484 create_windows (argc, argv);
470 485
471 dDisp; 486 dDisp;
472 487
477#if 0 492#if 0
478 XSynchronize (disp, True); 493 XSynchronize (disp, True);
479#endif 494#endif
480 495
481#ifdef HAVE_SCROLLBARS 496#ifdef HAVE_SCROLLBARS
482 if (options & Opt_scrollBar) 497 if (OPTION (Opt_scrollBar))
483 resize_scrollbar (); /* create and map scrollbar */ 498 resize_scrollbar (); /* create and map scrollbar */
484#endif 499#endif
485#if (MENUBAR_MAX) 500#if (MENUBAR_MAX)
486 if (menubar_visible ()) 501 if (menubar_visible ())
487 XMapWindow (disp, menuBar.win); 502 XMapWindow (disp, menuBar.win);
488#endif 503#endif
489#ifdef TRANSPARENT 504#ifdef TRANSPARENT
490 if (options & Opt_transparent) 505 if (OPTION (Opt_transparent))
491 { 506 {
492 XSelectInput (disp, display->root, PropertyChangeMask); 507 XSelectInput (disp, display->root, PropertyChangeMask);
493 check_our_parents (); 508 check_our_parents ();
494 rootwin_ev.start (display, display->root); 509 rootwin_ev.start (display, display->root);
495 } 510 }
505 free (cmd_argv); 520 free (cmd_argv);
506 521
507 pty_ev.start (pty.pty, EVENT_READ); 522 pty_ev.start (pty.pty, EVENT_READ);
508 523
509 check_ev.start (); 524 check_ev.start ();
525
526 PERL_INVOKE ((this, HOOK_START, DT_END));
510 527
511 return true; 528 return true;
512} 529}
513 530
514static struct sig_handlers 531static struct sig_handlers
522 539
523 while ((pid = waitpid (-1, NULL, WNOHANG)) > 0) 540 while ((pid = waitpid (-1, NULL, WNOHANG)) > 0)
524 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) 541 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
525 if (pid == (*t)->cmd_pid) 542 if (pid == (*t)->cmd_pid)
526 { 543 {
527 (*t)->destroy (); 544 (*t)->child_exit ();
528 break; 545 break;
529 } 546 }
530 } 547 }
531 548
532 /* 549 /*
672 689
673#ifdef UTMP_SUPPORT 690#ifdef UTMP_SUPPORT
674void 691void
675rxvt_term::privileged_utmp (rxvt_privaction action) 692rxvt_term::privileged_utmp (rxvt_privaction action)
676{ 693{
677 if ((options & Opt_utmpInhibit) 694 if (OPTION (Opt_utmpInhibit)
678 || !pty.name || !*pty.name) 695 || !pty.name || !*pty.name)
679 return; 696 return;
680 697
681 rxvt_privileges (RESTORE); 698 rxvt_privileges (RESTORE);
682 699
774 791
775 if (scrollbar_visible ()) 792 if (scrollbar_visible ())
776 { 793 {
777 sb_w = scrollbar_TotalWidth (); 794 sb_w = scrollbar_TotalWidth ();
778 szHint.base_width += sb_w; 795 szHint.base_width += sb_w;
779 if (!(options & Opt_scrollBar_right)) 796 if (!OPTION (Opt_scrollBar_right))
780 window_vt_x += sb_w; 797 window_vt_x += sb_w;
781 } 798 }
782 799
783 if (menubar_visible ()) 800 if (menubar_visible ())
784 { 801 {
812 { 829 {
813 min_it (height, max_height); 830 min_it (height, max_height);
814 szHint.height = szHint.base_height + height; 831 szHint.height = szHint.base_height + height;
815 } 832 }
816 833
817 if (scrollbar_visible () && (options & Opt_scrollBar_right)) 834 if (scrollbar_visible () && OPTION (Opt_scrollBar_right))
818 window_sb_x = szHint.width - sb_w; 835 window_sb_x = szHint.width - sb_w;
819 836
820 if (recalc_x) 837 if (recalc_x)
821 szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; 838 szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth;
822 if (recalc_y) 839 if (recalc_y)
935 return true; 952 return true;
936} 953}
937 954
938void rxvt_term::set_string_property (Atom prop, const char *str, int len) 955void rxvt_term::set_string_property (Atom prop, const char *str, int len)
939{ 956{
940 // TODO: SMART_WINDOW_TITLE
941 XChangeProperty (display->display, parent[0], 957 XChangeProperty (display->display, parent[0],
942 prop, XA_STRING, 8, PropModeReplace, 958 prop, XA_STRING, 8, PropModeReplace,
943 (const unsigned char *)str, len >= 0 ? len : strlen (str)); 959 (const unsigned char *)str, len >= 0 ? len : strlen (str));
944} 960}
945 961
946void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) 962void rxvt_term::set_utf8_property (Atom prop, const char *str, int len)
947{ 963{
948 // TODO: SMART_WINDOW_TITLE
949 wchar_t *ws = rxvt_mbstowcs (str, len); 964 wchar_t *ws = rxvt_mbstowcs (str, len);
950 char *s = rxvt_wcstoutf8 (ws); 965 char *s = rxvt_wcstoutf8 (ws);
951 966
952 XChangeProperty (display->display, parent[0], 967 XChangeProperty (display->display, parent[0],
953 prop, xa[XA_UTF8_STRING], 8, PropModeReplace, 968 prop, xa[XA_UTF8_STRING], 8, PropModeReplace,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines