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

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.4 by pcg, Tue Nov 25 15:25:17 2003 UTC vs.
Revision 1.8 by pcg, Thu Nov 27 10:12:10 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: init.c 2 * File: init.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: init.C,v 1.4 2003/11/25 15:25:17 pcg Exp $ 4 * $Id: init.C,v 1.8 2003/11/27 10:12:10 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>
384 Options = DEFAULT_OPTIONS; 384 Options = DEFAULT_OPTIONS;
385 want_refresh = 1; 385 want_refresh = 1;
386 cmd_pid = -1; 386 cmd_pid = -1;
387 cmd_fd = tty_fd = Xfd = -1; 387 cmd_fd = tty_fd = Xfd = -1;
388 PrivateModes = SavedModes = PrivMode_Default; 388 PrivateModes = SavedModes = PrivMode_Default;
389 TermWin.focus = 1; 389 TermWin.focus = 0;
390 TermWin.ncol = 80; 390 TermWin.ncol = 80;
391 TermWin.nrow = 24; 391 TermWin.nrow = 24;
392 TermWin.int_bwidth = INTERNALBORDERWIDTH; 392 TermWin.int_bwidth = INTERNALBORDERWIDTH;
393 TermWin.ext_bwidth = EXTERNALBORDERWIDTH; 393 TermWin.ext_bwidth = EXTERNALBORDERWIDTH;
394 TermWin.lineSpace = LINESPACE; 394 TermWin.lineSpace = LINESPACE;
473 } else if (i > STDIN_FILENO) { 473 } else if (i > STDIN_FILENO) {
474 dup2(i, STDIN_FILENO); 474 dup2(i, STDIN_FILENO);
475 close(i); 475 close(i);
476 } 476 }
477 dup2(STDERR_FILENO, STDOUT_FILENO); 477 dup2(STDERR_FILENO, STDOUT_FILENO);
478#if 0 // schmorp sayz closing filies is murder
478 for (i = STDERR_FILENO + 1; i < R->num_fds; i++) { 479 for (i = STDERR_FILENO + 1; i < R->num_fds; i++) {
479#ifdef __sgi /* Alex Coventry says we need 4 & 7 too */ 480#ifdef __sgi /* Alex Coventry says we need 4 & 7 too */
480 if (i == 4 || i == 7) 481 if (i == 4 || i == 7)
481 continue; 482 continue;
482#endif 483#endif
483 close(i); 484 close(i);
484 } 485 }
486#endif
485} 487}
486 488
487/*----------------------------------------------------------------------*/ 489/*----------------------------------------------------------------------*/
488/* EXTPROTO */ 490/* EXTPROTO */
489const char ** 491const char **
1077 XWindowAttributes gattr; 1079 XWindowAttributes gattr;
1078 1080
1079 XCMAP = DefaultColormap(R->Xdisplay, Xscreen); 1081 XCMAP = DefaultColormap(R->Xdisplay, Xscreen);
1080 XVISUAL = DefaultVisual(R->Xdisplay, Xscreen); 1082 XVISUAL = DefaultVisual(R->Xdisplay, Xscreen);
1081 1083
1082#ifdef POINTER_BLANK
1083 static rxvt_color blackcolour;
1084 blackcolour.set (r, 0, 0, 0);
1085#endif
1086 if (R->Options & Opt_transparent) { 1084 if (R->Options & Opt_transparent) {
1087 XGetWindowAttributes(R->Xdisplay, RootWindow(R->Xdisplay, Xscreen), 1085 XGetWindowAttributes(R->Xdisplay, RootWindow(R->Xdisplay, Xscreen),
1088 &gattr); 1086 &gattr);
1089 XDEPTH = gattr.depth; 1087 XDEPTH = gattr.depth;
1090 } else { 1088 } else {
1164/* vt cursor: Black-on-White is standard, but this is more popular */ 1162/* vt cursor: Black-on-White is standard, but this is more popular */
1165 R->TermWin_cursor = XCreateFontCursor(R->Xdisplay, XC_xterm); 1163 R->TermWin_cursor = XCreateFontCursor(R->Xdisplay, XC_xterm);
1166 1164
1167#if defined(HAVE_SCROLLBARS) || defined(MENUBAR) 1165#if defined(HAVE_SCROLLBARS) || defined(MENUBAR)
1168/* cursor (menuBar/scrollBar): Black-on-White */ 1166/* cursor (menuBar/scrollBar): Black-on-White */
1169 R->pointer_leftptr = XCreateFontCursor(R->Xdisplay, XC_left_ptr); 1167 R->leftptr_cursor = XCreateFontCursor(R->Xdisplay, XC_left_ptr);
1170#endif 1168#endif
1171 1169
1172#ifdef POINTER_BLANK 1170#ifdef POINTER_BLANK
1173 R->pointer_blank = XCreateGlyphCursor(R->Xdisplay, R->TermWin.font->fid, 1171 {
1174 R->TermWin.font->fid, ' ', ' ', 1172 XColor blackcolour;
1173 blackcolour.red = 0;
1174 blackcolour.green = 0;
1175 blackcolour.blue = 0;
1176 Font f = XLoadFont (R->Xdisplay, "fixed");
1177 R->blank_cursor = XCreateGlyphCursor (R->Xdisplay, f, f, ' ', ' ',
1175 &blackcolour, &blackcolour); 1178 &blackcolour, &blackcolour);
1179 XUnloadFont (R->Xdisplay, f);
1180 }
1176#endif 1181#endif
1177 1182
1178/* the vt window */ 1183/* the vt window */
1179 R->TermWin.vt = XCreateSimpleWindow(R->Xdisplay, R->TermWin.parent[0], 1184 R->TermWin.vt = XCreateSimpleWindow(R->Xdisplay, R->TermWin.parent[0],
1180 R->window_vt_x, R->window_vt_y, 1185 R->window_vt_x, R->window_vt_y,
1184 R->PixColors[Color_fg], 1189 R->PixColors[Color_fg],
1185 R->PixColors[Color_bg]); 1190 R->PixColors[Color_bg]);
1186#ifdef DEBUG_X 1191#ifdef DEBUG_X
1187 XStoreName(R->Xdisplay, R->TermWin.vt, "vt window"); 1192 XStoreName(R->Xdisplay, R->TermWin.vt, "vt window");
1188#endif 1193#endif
1194
1189 rxvt_pointer_unblank(aR); 1195 R->pointer_unblank ();
1196
1190 vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask 1197 vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask
1191 | PropertyChangeMask); 1198 | PropertyChangeMask);
1192#ifdef POINTER_BLANK 1199#ifdef POINTER_BLANK
1193 if ((R->Options & Opt_pointerBlank)) 1200 if ((R->Options & Opt_pointerBlank))
1194 vt_emask |= PointerMotionMask; 1201 vt_emask |= PointerMotionMask;
1294 else if (STRCMP(R->key_backspace, "DEC") == 0) 1301 else if (STRCMP(R->key_backspace, "DEC") == 0)
1295 er = '\177'; /* the initial state anyway */ 1302 er = '\177'; /* the initial state anyway */
1296 else 1303 else
1297#endif 1304#endif
1298 er = -1; 1305 er = -1;
1306
1299 rxvt_get_ttymode(&(R->tio), er); 1307 rxvt_get_ttymode(&(R->tio), er);
1300
1301/* install exit handler for cleanup */
1302#ifdef HAVE_ATEXIT
1303 atexit(rxvt_clean_exit);
1304#else
1305# ifdef HAVE_ON_EXIT
1306 on_exit(rxvt_clean_exit, NULL); /* non-ANSI exit handler */
1307# endif
1308#endif
1309
1310 signal(SIGHUP, rxvt_Exit_signal);
1311#ifndef __svr4__
1312 signal(SIGINT, rxvt_Exit_signal);
1313#endif
1314 signal(SIGQUIT, rxvt_Exit_signal);
1315 signal(SIGTERM, rxvt_Exit_signal);
1316 signal(SIGCHLD, rxvt_Child_signal);
1317
1318/* need to trap SIGURG for SVR4 (Unixware) rlogin */
1319/* signal (SIGURG, SIG_DFL); */
1320 1308
1321#ifndef __QNX__ 1309#ifndef __QNX__
1322/* spin off the command interpreter */ 1310/* spin off the command interpreter */
1323 switch (R->cmd_pid = fork()) { 1311 switch (R->cmd_pid = fork()) {
1324 case -1: 1312 case -1:
1408 } 1396 }
1409#endif /* SRIOCSREDIR */ 1397#endif /* SRIOCSREDIR */
1410 } 1398 }
1411 1399
1412/* reset signals and spin off the command interpreter */ 1400/* reset signals and spin off the command interpreter */
1413 signal(SIGINT, SIG_DFL); 1401 signal (SIGINT, SIG_DFL);
1414 signal(SIGQUIT, SIG_DFL); 1402 signal (SIGQUIT, SIG_DFL);
1415 signal(SIGCHLD, SIG_DFL); 1403 signal (SIGCHLD, SIG_DFL);
1416/* 1404/*
1417 * mimick login's behavior by disabling the job control signals 1405 * mimick login's behavior by disabling the job control signals
1418 * a shell that wants them can turn them back on 1406 * a shell that wants them can turn them back on
1419 */ 1407 */
1420#ifdef SIGTSTP 1408#ifdef SIGTSTP
1421 signal(SIGTSTP, SIG_IGN); 1409 signal (SIGTSTP, SIG_IGN);
1422 signal(SIGTTIN, SIG_IGN); 1410 signal (SIGTTIN, SIG_IGN);
1423 signal(SIGTTOU, SIG_IGN); 1411 signal (SIGTTOU, SIG_IGN);
1424#endif /* SIGTSTP */ 1412#endif /* SIGTSTP */
1425 1413
1426 /* set window size */ 1414 /* set window size */
1427 rxvt_tt_winsize(STDIN_FILENO, R->TermWin.ncol, R->TermWin.nrow, 0); 1415 rxvt_tt_winsize(STDIN_FILENO, R->TermWin.ncol, R->TermWin.nrow, 0);
1428 1416

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines