1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: init.c |
2 | * File: init.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: init.C,v 1.16 2003/12/18 13:33:02 pcg Exp $ |
4 | * $Id: init.C,v 1.18 2004/01/20 01:35:39 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> |
… | |
… | |
1042 | |
1042 | |
1043 | if (i >= 8 && i <= 15) |
1043 | if (i >= 8 && i <= 15) |
1044 | { /* bright colors */ |
1044 | { /* bright colors */ |
1045 | i -= 8; |
1045 | i -= 8; |
1046 | #ifndef NO_BRIGHTCOLOR |
1046 | #ifndef NO_BRIGHTCOLOR |
1047 | |
|
|
1048 | rs[Rs_color + idx] = rs[Rs_color + minBrightCOLOR + i]; |
1047 | rs[Rs_color + idx] = rs[Rs_color + minBrightCOLOR + i]; |
1049 | return; |
1048 | return; |
1050 | #endif |
1049 | #endif |
1051 | |
|
|
1052 | } |
1050 | } |
|
|
1051 | |
1053 | if (i >= 0 && i <= 7) /* normal colors */ |
1052 | if (i >= 0 && i <= 7) /* normal colors */ |
1054 | rs[Rs_color + idx] = rs[Rs_color + minCOLOR + i]; |
1053 | rs[Rs_color + idx] = rs[Rs_color + minCOLOR + i]; |
1055 | } |
1054 | } |
1056 | } |
1055 | } |
1057 | |
1056 | |
… | |
… | |
1135 | XClassHint classHint; |
1134 | XClassHint classHint; |
1136 | XWMHints wmHint; |
1135 | XWMHints wmHint; |
1137 | XGCValues gcvalue; |
1136 | XGCValues gcvalue; |
1138 | long vt_emask; |
1137 | long vt_emask; |
1139 | |
1138 | |
1140 | #ifdef PREFER_24BIT |
|
|
1141 | XSetWindowAttributes attributes; |
1139 | XSetWindowAttributes attributes; |
1142 | XWindowAttributes gattr; |
1140 | XWindowAttributes gattr; |
1143 | |
1141 | |
1144 | XCMAP = DefaultColormap(Xdisplay, Xscreen); |
1142 | Xcmap = DefaultColormap (Xdisplay, Xscreen); |
1145 | XVISUAL = DefaultVisual(Xdisplay, Xscreen); |
1143 | Xvisual = DefaultVisual (Xdisplay, Xscreen); |
|
|
1144 | Xscreen = DefaultScreen (Xdisplay); |
1146 | |
1145 | |
1147 | if (Options & Opt_transparent) |
1146 | if (Options & Opt_transparent) |
1148 | { |
1147 | { |
1149 | XGetWindowAttributes(Xdisplay, RootWindow(Xdisplay, Xscreen), |
1148 | XGetWindowAttributes (Xdisplay, RootWindow(Xdisplay, Xscreen), &gattr); |
1150 | &gattr); |
|
|
1151 | XDEPTH = gattr.depth; |
1149 | Xdepth = gattr.depth; |
1152 | } |
1150 | } |
1153 | else |
1151 | else |
1154 | { |
1152 | { |
1155 | XDEPTH = DefaultDepth(Xdisplay, Xscreen); |
1153 | Xdepth = DefaultDepth(Xdisplay, Xscreen); |
|
|
1154 | #ifdef PREFER_24BIT |
1156 | /* |
1155 | /* |
1157 | * If depth is not 24, look for a 24bit visual. |
1156 | * If depth is not 24, look for a 24bit visual. |
1158 | */ |
1157 | */ |
1159 | if (XDEPTH != 24) |
1158 | if (Xdepth != 24) |
1160 | { |
1159 | { |
1161 | XVisualInfo vinfo; |
1160 | XVisualInfo vinfo; |
1162 | |
1161 | |
1163 | if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo)) |
1162 | if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo)) |
1164 | { |
1163 | { |
1165 | XDEPTH = 24; |
1164 | Xdepth = 24; |
1166 | XVISUAL = vinfo.visual; |
1165 | Xvisual = vinfo.visual; |
1167 | XCMAP = XCreateColormap(Xdisplay, |
1166 | Xcmap = XCreateColormap(Xdisplay, |
1168 | RootWindow(Xdisplay, Xscreen), |
1167 | RootWindow(Xdisplay, Xscreen), |
1169 | XVISUAL, AllocNone); |
1168 | Xvisual, AllocNone); |
1170 | } |
1169 | } |
1171 | } |
1170 | } |
1172 | } |
|
|
1173 | #endif |
1171 | #endif |
|
|
1172 | } |
1174 | |
1173 | |
1175 | /* grab colors before netscape does */ |
1174 | /* grab colors before netscape does */ |
1176 | rxvt_Get_Colours (this); |
1175 | rxvt_Get_Colours (this); |
1177 | |
1176 | |
1178 | rxvt_change_font (this, 1, NULL); |
1177 | rxvt_change_font (this, 1, NULL); |
… | |
… | |
1185 | */ |
1184 | */ |
1186 | |
1185 | |
1187 | #ifdef PREFER_24BIT |
1186 | #ifdef PREFER_24BIT |
1188 | attributes.background_pixel = PixColors[Color_fg]; |
1187 | attributes.background_pixel = PixColors[Color_fg]; |
1189 | attributes.border_pixel = PixColors[Color_border]; |
1188 | attributes.border_pixel = PixColors[Color_border]; |
1190 | attributes.colormap = XCMAP; |
1189 | attributes.colormap = Xcmap; |
1191 | TermWin.parent[0] = XCreateWindow (Xdisplay, DefaultRootWindow (Xdisplay), |
1190 | TermWin.parent[0] = XCreateWindow (Xdisplay, DefaultRootWindow (Xdisplay), |
1192 | szHint.x, szHint.y, |
1191 | szHint.x, szHint.y, |
1193 | szHint.width, szHint.height, |
1192 | szHint.width, szHint.height, |
1194 | TermWin.ext_bwidth, |
1193 | TermWin.ext_bwidth, |
1195 | XDEPTH, InputOutput, |
1194 | Xdepth, InputOutput, |
1196 | XVISUAL, |
1195 | Xvisual, |
1197 | CWBackPixel | CWBorderPixel |
1196 | CWBackPixel | CWBorderPixel |
1198 | | CWColormap, &attributes); |
1197 | | CWColormap, &attributes); |
1199 | #else |
1198 | #else |
1200 | TermWin.parent[0] = XCreateSimpleWindow (Xdisplay, DefaultRootWindow (Xdisplay), |
1199 | TermWin.parent[0] = XCreateSimpleWindow (Xdisplay, DefaultRootWindow (Xdisplay), |
1201 | szHint.x, szHint.y, |
1200 | szHint.x, szHint.y, |
… | |
… | |
1257 | TermWin_TotalHeight(), |
1256 | TermWin_TotalHeight(), |
1258 | 0, |
1257 | 0, |
1259 | PixColors[Color_fg], |
1258 | PixColors[Color_fg], |
1260 | PixColors[Color_bg]); |
1259 | PixColors[Color_bg]); |
1261 | #ifdef DEBUG_X |
1260 | #ifdef DEBUG_X |
1262 | |
|
|
1263 | XStoreName(Xdisplay, TermWin.vt, "vt window"); |
1261 | XStoreName(Xdisplay, TermWin.vt, "vt window"); |
1264 | #endif |
1262 | #endif |
1265 | |
|
|
1266 | pointer_unblank (); |
|
|
1267 | |
1263 | |
1268 | vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1264 | vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1269 | | PropertyChangeMask); |
1265 | | PropertyChangeMask); |
|
|
1266 | |
1270 | #ifdef POINTER_BLANK |
1267 | #ifdef POINTER_BLANK |
|
|
1268 | pointer_unblank (); |
1271 | |
1269 | |
1272 | if ((Options & Opt_pointerBlank)) |
1270 | if ((Options & Opt_pointerBlank)) |
1273 | vt_emask |= PointerMotionMask; |
1271 | vt_emask |= PointerMotionMask; |
1274 | else |
1272 | else |
1275 | #endif |
1273 | #endif |
1276 | |
|
|
1277 | vt_emask |= (Button1MotionMask | Button3MotionMask); |
1274 | vt_emask |= (Button1MotionMask | Button3MotionMask); |
|
|
1275 | |
1278 | XSelectInput(Xdisplay, TermWin.vt, vt_emask); |
1276 | XSelectInput(Xdisplay, TermWin.vt, vt_emask); |
1279 | |
1277 | |
1280 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1278 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1281 | |
1279 | |
1282 | if (menuBar_height()) |
1280 | if (menuBar_height()) |
… | |
… | |
1426 | |
1424 | |
1427 | fdstdin = dup (STDIN_FILENO); |
1425 | fdstdin = dup (STDIN_FILENO); |
1428 | dup2 (tty_fd, STDIN_FILENO); |
1426 | dup2 (tty_fd, STDIN_FILENO); |
1429 | #endif |
1427 | #endif |
1430 | |
1428 | |
|
|
1429 | #ifdef UTMP_SUPPORT |
1431 | rxvt_privileged_utmp (this, SAVE); |
1430 | rxvt_privileged_utmp (this, SAVE); |
|
|
1431 | #endif |
|
|
1432 | |
1432 | #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) |
1433 | #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) |
1433 | |
1434 | |
1434 | dup2 (fdstdin, STDIN_FILENO); |
1435 | dup2 (fdstdin, STDIN_FILENO); |
1435 | close (fdstdin); |
1436 | close (fdstdin); |
1436 | #endif |
1437 | #endif |