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