1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: init.c |
2 | * File: init.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: init.C,v 1.5 2003/11/25 15:44:38 pcg Exp $ |
4 | * $Id: init.C,v 1.7 2003/11/26 10:42:34 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> |
… | |
… | |
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 */ |
489 | const char ** |
491 | const 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; |