… | |
… | |
203 | #endif |
203 | #endif |
204 | #ifdef TRANSPARENT |
204 | #ifdef TRANSPARENT |
205 | "_XROOTPMAP_ID", |
205 | "_XROOTPMAP_ID", |
206 | "ESETROOT_PMAP_ID", |
206 | "ESETROOT_PMAP_ID", |
207 | #endif |
207 | #endif |
208 | #ifdef OFFIX_DND |
|
|
209 | "DndProtocol", |
|
|
210 | "DndSelection", |
|
|
211 | #endif |
|
|
212 | #if ENABLE_XEMBED |
208 | #if ENABLE_XEMBED |
213 | "_XEMBED", |
209 | "_XEMBED", |
214 | "_XEMBED_INFO", |
210 | "_XEMBED_INFO", |
215 | #endif |
211 | #endif |
216 | }; |
212 | }; |
… | |
… | |
928 | { |
924 | { |
929 | XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); |
925 | XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); |
930 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
926 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
931 | } |
927 | } |
932 | |
928 | |
|
|
929 | /* grab colors before netscape does */ |
|
|
930 | Get_Colours (); |
|
|
931 | |
|
|
932 | if (!set_fonts ()) |
|
|
933 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
|
|
934 | |
|
|
935 | parent = DefaultRootWindow (disp); |
|
|
936 | |
|
|
937 | attributes.override_redirect = !!OPTION (Opt_override_redirect); |
|
|
938 | |
933 | #if ENABLE_FRILLS |
939 | #if ENABLE_FRILLS |
934 | if (OPTION (Opt_borderLess)) |
940 | if (OPTION (Opt_borderLess)) |
935 | { |
941 | { |
936 | prop = XInternAtom(disp, "_MOTIF_WM_INFO", True); |
942 | prop = XInternAtom (disp, "_MOTIF_WM_INFO", True); |
937 | |
943 | |
938 | if (prop == None) |
944 | if (prop == None) |
939 | { |
945 | { |
940 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
946 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
941 | #ifdef PREFER_24BIT |
|
|
942 | attributes.override_redirect = TRUE; |
947 | attributes.override_redirect = TRUE; |
943 | #endif |
|
|
944 | mwmhints.flags = 0; |
948 | mwmhints.flags = 0; |
945 | } |
949 | } |
946 | else |
950 | else |
947 | { |
951 | { |
948 | mwmhints.flags = MWM_HINTS_DECORATIONS; |
952 | mwmhints.flags = MWM_HINTS_DECORATIONS; |
… | |
… | |
951 | } |
955 | } |
952 | else |
956 | else |
953 | mwmhints.flags = 0; |
957 | mwmhints.flags = 0; |
954 | #endif |
958 | #endif |
955 | |
959 | |
956 | /* grab colors before netscape does */ |
|
|
957 | Get_Colours (); |
|
|
958 | |
|
|
959 | if (!set_fonts ()) |
|
|
960 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
|
|
961 | |
|
|
962 | parent = DefaultRootWindow (disp); |
|
|
963 | |
|
|
964 | #if ENABLE_XEMBED |
960 | #if ENABLE_XEMBED |
965 | if (rs[Rs_embed]) |
961 | if (rs[Rs_embed]) |
966 | { |
962 | { |
967 | XWindowAttributes wattr; |
963 | XWindowAttributes wattr; |
968 | |
964 | |
… | |
… | |
976 | #endif |
972 | #endif |
977 | |
973 | |
978 | window_calc (0, 0); |
974 | window_calc (0, 0); |
979 | |
975 | |
980 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
976 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
981 | #ifdef PREFER_24BIT |
|
|
982 | attributes.background_pixel = pix_colors_focused[Color_border]; |
977 | attributes.background_pixel = pix_colors_focused[Color_border]; |
983 | attributes.border_pixel = pix_colors_focused[Color_border]; |
978 | attributes.border_pixel = pix_colors_focused[Color_border]; |
984 | attributes.colormap = display->cmap; |
979 | attributes.colormap = display->cmap; |
985 | top = XCreateWindow (disp, parent, |
980 | top = XCreateWindow (disp, parent, |
986 | szHint.x, szHint.y, |
981 | szHint.x, szHint.y, |
987 | szHint.width, szHint.height, |
982 | szHint.width, szHint.height, |
988 | ext_bwidth, |
983 | ext_bwidth, |
989 | display->depth, InputOutput, |
984 | display->depth, InputOutput, |
990 | display->visual, |
985 | display->visual, |
991 | CWColormap | CWBackPixel | CWBorderPixel, &attributes); |
986 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
992 | #else |
987 | &attributes); |
993 | top = XCreateSimpleWindow (disp, parent, |
|
|
994 | szHint.x, szHint.y, |
|
|
995 | szHint.width, szHint.height, |
|
|
996 | ext_bwidth, |
|
|
997 | pix_colors_focused[Color_border], |
|
|
998 | pix_colors_focused[Color_border]); |
|
|
999 | #endif |
|
|
1000 | |
988 | |
1001 | this->parent[0] = top; |
989 | this->parent[0] = top; |
1002 | |
990 | |
1003 | old_width = szHint.width; |
991 | old_width = szHint.width; |
1004 | old_height = szHint.height; |
992 | old_height = szHint.height; |
… | |
… | |
1370 | rxvt_term::run_command (const char *const *argv) |
1358 | rxvt_term::run_command (const char *const *argv) |
1371 | { |
1359 | { |
1372 | #if ENABLE_FRILLS |
1360 | #if ENABLE_FRILLS |
1373 | if (rs[Rs_pty_fd]) |
1361 | if (rs[Rs_pty_fd]) |
1374 | { |
1362 | { |
1375 | pty.pty = atoi (rs[Rs_pty_fd]); |
1363 | pty->pty = atoi (rs[Rs_pty_fd]); |
1376 | |
1364 | |
1377 | if (pty.pty >= 0) |
1365 | if (pty->pty >= 0) |
1378 | { |
1366 | { |
1379 | if (getfd_hook) |
1367 | if (getfd_hook) |
1380 | pty.pty = (*getfd_hook) (pty.pty); |
1368 | pty->pty = (*getfd_hook) (pty->pty); |
1381 | |
1369 | |
1382 | if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK)) |
1370 | if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) |
1383 | rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); |
1371 | rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); |
1384 | } |
1372 | } |
1385 | } |
1373 | } |
1386 | else |
1374 | else |
1387 | #endif |
1375 | #endif |
1388 | if (!pty.get ()) |
1376 | if (!pty->get ()) |
1389 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1377 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1390 | |
1378 | |
1391 | pty.set_utf8_mode (enc_utf8); |
1379 | pty->set_utf8_mode (enc_utf8); |
1392 | |
1380 | |
1393 | /* set initial window size */ |
1381 | /* set initial window size */ |
1394 | tt_winch (); |
1382 | tt_winch (); |
1395 | |
1383 | |
1396 | int er; |
1384 | int er; |
… | |
… | |
1420 | rxvt_fatal ("can't fork, aborting.\n"); |
1408 | rxvt_fatal ("can't fork, aborting.\n"); |
1421 | } |
1409 | } |
1422 | case 0: |
1410 | case 0: |
1423 | init_env (); |
1411 | init_env (); |
1424 | |
1412 | |
1425 | if (!pty.make_controlling_tty ()) |
1413 | if (!pty->make_controlling_tty ()) |
1426 | fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); |
1414 | fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); |
1427 | else |
1415 | else |
1428 | { |
1416 | { |
1429 | /* Reopen stdin, stdout and stderr over the tty file descriptor */ |
1417 | /* Reopen stdin, stdout and stderr over the tty file descriptor */ |
1430 | dup2 (pty.tty, STDIN_FILENO); |
1418 | dup2 (pty->tty, STDIN_FILENO); |
1431 | dup2 (pty.tty, STDOUT_FILENO); |
1419 | dup2 (pty->tty, STDOUT_FILENO); |
1432 | dup2 (pty.tty, STDERR_FILENO); |
1420 | dup2 (pty->tty, STDERR_FILENO); |
1433 | |
1421 | |
1434 | // close all our file handles that we do no longer need |
1422 | // close all our file handles that we do no longer need |
1435 | for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) |
1423 | for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) |
1436 | { |
1424 | { |
1437 | if ((*t)->pty.pty > 2) close ((*t)->pty.pty); |
1425 | if ((*t)->pty->pty > 2) close ((*t)->pty->pty); |
1438 | if ((*t)->pty.tty > 2) close ((*t)->pty.tty); |
1426 | if ((*t)->pty->tty > 2) close ((*t)->pty->tty); |
1439 | } |
1427 | } |
1440 | |
1428 | |
1441 | run_child (argv); |
1429 | run_child (argv); |
1442 | fprintf (stderr, "%s: unable to exec child.", RESNAME); |
1430 | fprintf (stderr, "%s: unable to exec child.", RESNAME); |
1443 | } |
1431 | } |
1444 | |
1432 | |
1445 | _exit (EXIT_FAILURE); |
1433 | _exit (EXIT_FAILURE); |
1446 | |
1434 | |
1447 | default: |
1435 | default: |
1448 | { |
|
|
1449 | #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) |
|
|
1450 | int fdstdin; |
|
|
1451 | |
|
|
1452 | fdstdin = dup (STDIN_FILENO); |
|
|
1453 | dup2 (pty.tty, STDIN_FILENO); |
|
|
1454 | #endif |
|
|
1455 | |
|
|
1456 | #ifdef UTMP_SUPPORT |
1436 | #if UTMP_SUPPORT |
1457 | privileged_utmp (SAVE); |
1437 | if (!OPTION (Opt_utmpInhibit)) |
|
|
1438 | pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); |
1458 | #endif |
1439 | #endif |
1459 | |
1440 | |
1460 | #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) |
1441 | pty->close_tty (); |
1461 | |
1442 | |
1462 | dup2 (fdstdin, STDIN_FILENO); |
1443 | child_ev.start (cmd_pid); |
1463 | close (fdstdin); |
|
|
1464 | #endif |
|
|
1465 | } |
|
|
1466 | |
1444 | |
1467 | pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */ |
1445 | HOOK_INVOKE ((this, HOOK_CHILD_START, DT_INT, cmd_pid, DT_END)); |
1468 | break; |
1446 | break; |
1469 | } |
1447 | } |
1470 | } |
1448 | } |
1471 | |
1449 | |
1472 | /* ------------------------------------------------------------------------- * |
1450 | /* ------------------------------------------------------------------------- * |