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.8 by pcg, Thu Nov 27 10:12:10 2003 UTC vs.
Revision 1.9 by pcg, Tue Dec 2 21:49:46 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: main.c 2 * File: main.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: main.C,v 1.8 2003/11/27 10:12:10 pcg Exp $ 4 * $Id: main.C,v 1.9 2003/12/02 21:49:46 pcg Exp $
5 * 5 *
6 * All portions of code are copyright by their respective author/s. 6 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
8 * - original version 8 * - original version
9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
66#endif 66#endif
67#ifdef POINTER_BLANK 67#ifdef POINTER_BLANK
68 pointer_ev (this, &rxvt_term::pointer_cb), 68 pointer_ev (this, &rxvt_term::pointer_cb),
69#endif 69#endif
70 x_ev (this, &rxvt_term::x_cb), 70 x_ev (this, &rxvt_term::x_cb),
71 destroy_ev (this, &rxvt_term::destroy_cb) 71 destroy_ev (this, &rxvt_term::destroy_cb),
72 check_ev (this, &rxvt_term::check_cb)
72{ 73{
73 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 74 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
74} 75}
75 76
76rxvt_term::~rxvt_term () 77rxvt_term::~rxvt_term ()
101} 102}
102 103
103void 104void
104rxvt_term::destroy () 105rxvt_term::destroy ()
105{ 106{
107 check_ev.stop ();
106 pty_ev.stop (); 108 pty_ev.stop ();
107 x_ev.stop (); 109 x_ev.stop ();
108#ifdef CURSOR_BLINK 110#ifdef CURSOR_BLINK
109 blink_ev.stop (); 111 blink_ev.stop ();
110#endif 112#endif
125 127
126/*----------------------------------------------------------------------*/ 128/*----------------------------------------------------------------------*/
127/* rxvt_init() */ 129/* rxvt_init() */
128/* LIBPROTO */ 130/* LIBPROTO */
129rxvt_t 131rxvt_t
130rxvt_init(int argc, const char *const *argv) 132rxvt_init (int argc, const char *const *argv)
131{ 133{
132 SET_R(new rxvt_term); 134 SET_R (new rxvt_term);
133 dR; 135 dR;
134 136
135 if (!R->init_vars () || !R->init (argc, argv)) 137 if (!R->init_vars () || !R->init (argc, argv))
136 { 138 {
137 delete R; 139 delete R;
148/* install exit handler for cleanup */ 150/* install exit handler for cleanup */
149#if 0 151#if 0
150#ifdef HAVE_ATEXIT 152#ifdef HAVE_ATEXIT
151 atexit(rxvt_clean_exit); 153 atexit(rxvt_clean_exit);
152#else 154#else
153# ifdef HAVE_ON_EXIT
154 on_exit(rxvt_clean_exit, NULL); /* non-ANSI exit handler */
155# endif
156#endif 155#endif
157#endif 156#endif
158 157
159 struct sigaction sa; 158 struct sigaction sa;
160 159
161 sigfillset (&sa.sa_mask); 160 sigfillset (&sa.sa_mask);
162 sa.sa_flags = SA_NOCLDSTOP | SA_RESTART; 161 sa.sa_flags = SA_NOCLDSTOP | SA_RESTART;
163 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGHUP , &sa, 0); //TODO, also: SIGPIPE 162 sa.sa_handler = SIG_IGN; sigaction (SIGHUP , &sa, 0);
163 sa.sa_handler = SIG_IGN; sigaction (SIGPIPE, &sa, 0);
164 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGINT , &sa, 0); 164 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGINT , &sa, 0);
165 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGQUIT, &sa, 0); 165 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGQUIT, &sa, 0);
166 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGTERM, &sa, 0); 166 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGTERM, &sa, 0);
167 sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0); 167 sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0);
168 168
237 rxvt_init_command (this, cmd_argv); 237 rxvt_init_command (this, cmd_argv);
238 238
239 x_ev.start (Xfd, EVENT_READ); 239 x_ev.start (Xfd, EVENT_READ);
240 pty_ev.start (cmd_fd, EVENT_READ); 240 pty_ev.start (cmd_fd, EVENT_READ);
241 241
242 flush (); 242 check_ev.start ();
243 243
244 return true; 244 return true;
245} 245}
246 246
247/* ------------------------------------------------------------------------- * 247/* ------------------------------------------------------------------------- *
614/*----------------------------------------------------------------------*/ 614/*----------------------------------------------------------------------*/
615/* 615/*
616 * Tell the teletype handler what size the window is. 616 * Tell the teletype handler what size the window is.
617 * Called after a window size change. 617 * Called after a window size change.
618 */ 618 */
619/* EXTPROTO */
620void 619void
621rxvt_tt_winsize(int fd, unsigned short col, unsigned short row, int pid) 620rxvt_term::tt_winch ()
622{ 621{
623 struct winsize ws; 622 struct winsize ws;
624 623
625 if (fd < 0) 624 if (cmd_fd < 0)
626 return; 625 return;
626
627 ws.ws_col = col; 627 ws.ws_col = TermWin.ncol;
628 ws.ws_row = row; 628 ws.ws_row = TermWin.nrow;
629 ws.ws_xpixel = ws.ws_ypixel = 0; 629 ws.ws_xpixel = ws.ws_ypixel = 0;
630#ifndef DEBUG_SIZE 630#ifndef DEBUG_SIZE
631 (void)ioctl(fd, TIOCSWINSZ, &ws); 631 (void)ioctl (cmd_fd, TIOCSWINSZ, &ws);
632#else 632#else
633 if (ioctl(fd, TIOCSWINSZ, &ws) < 0) { 633 if (ioctl (cmd_fd, TIOCSWINSZ, &ws) < 0)
634 D_SIZE((stderr, "Failed to send TIOCSWINSZ to fd %d", fd)); 634 D_SIZE((stderr, "Failed to send TIOCSWINSZ to fd %d", fd));
635 }
636# ifdef SIGWINCH 635# ifdef SIGWINCH
637 else if (pid) /* force through to the command */ 636 else if (cmd_pid) /* force through to the command */
638 kill(pid, SIGWINCH); 637 kill (cmd_pid, SIGWINCH);
639# endif 638# endif
640#endif 639#endif
641} 640}
642 641
643/*----------------------------------------------------------------------*/ 642/*----------------------------------------------------------------------*/
1062 return; 1061 return;
1063} 1062}
1064 1063
1065/* INTPROTO */ 1064/* INTPROTO */
1066void 1065void
1067rxvt_setPreeditArea(pR_ XRectangle * preedit_rect, XRectangle * status_rect, 1066rxvt_setPreeditArea (pR_ XRectangle * preedit_rect, XRectangle * status_rect,
1068 XRectangle * needed_rect) 1067 XRectangle * needed_rect)
1069{ 1068{
1070 int mbh, vtx = 0; 1069 int mbh, vtx = 0;
1071 1070
1072 if (scrollbar_visible(R) && !(R->Options & Opt_scrollBar_right)) 1071 if (scrollbar_visible(R) && !(R->Options & Opt_scrollBar_right))
1073 vtx = scrollbar_TotalWidth(); 1072 vtx = scrollbar_TotalWidth();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines