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.144 by root, Tue Jan 17 11:02:10 2006 UTC vs.
Revision 1.151 by root, Fri Jan 20 12:16:28 2006 UTC

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 };
344 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); 340 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
345 341
346 extract_resources (); 342 extract_resources ();
347 343
348 free (r_argv); 344 free (r_argv);
345
346#if ENABLE_PERL
347 if (!rs[Rs_perl_ext_1])
348 rs[Rs_perl_ext_1] = "default";
349
350 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1])
351 || (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2])
352 || (rs[Rs_perl_eval] && *rs[Rs_perl_eval]))
353 {
354 rxvt_perl.init (this);
355 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
356 }
357#endif
349 358
350 /* 359 /*
351 * set any defaults not already set 360 * set any defaults not already set
352 */ 361 */
353 if (cmd_argv && cmd_argv[0]) 362 if (cmd_argv && cmd_argv[0])
928 { 937 {
929 XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); 938 XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr);
930 display->depth = gattr.depth; // doh //TODO, per-term not per-display? 939 display->depth = gattr.depth; // doh //TODO, per-term not per-display?
931 } 940 }
932 941
942 /* grab colors before netscape does */
943 Get_Colours ();
944
945 if (!set_fonts ())
946 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
947
948 parent = DefaultRootWindow (disp);
949
950 attributes.override_redirect = !!OPTION (Opt_override_redirect);
951
933#if ENABLE_FRILLS 952#if ENABLE_FRILLS
934 if (OPTION (Opt_borderLess)) 953 if (OPTION (Opt_borderLess))
935 { 954 {
936 prop = XInternAtom(disp, "_MOTIF_WM_INFO", True); 955 prop = XInternAtom (disp, "_MOTIF_WM_INFO", True);
937 956
938 if (prop == None) 957 if (prop == None)
939 { 958 {
940 /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ 959 /* 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; 960 attributes.override_redirect = TRUE;
943#endif
944 mwmhints.flags = 0; 961 mwmhints.flags = 0;
945 } 962 }
946 else 963 else
947 { 964 {
948 mwmhints.flags = MWM_HINTS_DECORATIONS; 965 mwmhints.flags = MWM_HINTS_DECORATIONS;
951 } 968 }
952 else 969 else
953 mwmhints.flags = 0; 970 mwmhints.flags = 0;
954#endif 971#endif
955 972
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 973#if ENABLE_XEMBED
965 if (rs[Rs_embed]) 974 if (rs[Rs_embed])
966 { 975 {
967 XWindowAttributes wattr; 976 XWindowAttributes wattr;
968 977
976#endif 985#endif
977 986
978 window_calc (0, 0); 987 window_calc (0, 0);
979 988
980 /* sub-window placement & size in rxvt_resize_subwindows () */ 989 /* sub-window placement & size in rxvt_resize_subwindows () */
981#ifdef PREFER_24BIT
982 attributes.background_pixel = pix_colors_focused[Color_border]; 990 attributes.background_pixel = pix_colors_focused[Color_border];
983 attributes.border_pixel = pix_colors_focused[Color_border]; 991 attributes.border_pixel = pix_colors_focused[Color_border];
984 attributes.colormap = display->cmap; 992 attributes.colormap = display->cmap;
985 top = XCreateWindow (disp, parent, 993 top = XCreateWindow (disp, parent,
986 szHint.x, szHint.y, 994 szHint.x, szHint.y,
987 szHint.width, szHint.height, 995 szHint.width, szHint.height,
988 ext_bwidth, 996 ext_bwidth,
989 display->depth, InputOutput, 997 display->depth, InputOutput,
990 display->visual, 998 display->visual,
991 CWColormap | CWBackPixel | CWBorderPixel, &attributes); 999 CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect,
992#else 1000 &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 1001
1001 this->parent[0] = top; 1002 this->parent[0] = top;
1002 1003
1003 old_width = szHint.width; 1004 old_width = szHint.width;
1004 old_height = szHint.height; 1005 old_height = szHint.height;
1370rxvt_term::run_command (const char *const *argv) 1371rxvt_term::run_command (const char *const *argv)
1371{ 1372{
1372#if ENABLE_FRILLS 1373#if ENABLE_FRILLS
1373 if (rs[Rs_pty_fd]) 1374 if (rs[Rs_pty_fd])
1374 { 1375 {
1375 pty.pty = atoi (rs[Rs_pty_fd]); 1376 pty->pty = atoi (rs[Rs_pty_fd]);
1376 1377
1377 if (pty.pty >= 0) 1378 if (pty->pty >= 0)
1378 { 1379 {
1379 if (getfd_hook) 1380 if (getfd_hook)
1380 pty.pty = (*getfd_hook) (pty.pty); 1381 pty->pty = (*getfd_hook) (pty->pty);
1381 1382
1382 if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK)) 1383 if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK))
1383 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); 1384 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
1384 } 1385 }
1385 } 1386 }
1386 else 1387 else
1387#endif 1388#endif
1388 if (!pty.get ()) 1389 if (!pty->get ())
1389 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1390 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1390 1391
1391 pty.set_utf8_mode (enc_utf8); 1392 pty->set_utf8_mode (enc_utf8);
1392 1393
1393 /* set initial window size */ 1394 /* set initial window size */
1394 tt_winch (); 1395 tt_winch ();
1395 1396
1396 int er; 1397 int er;
1420 rxvt_fatal ("can't fork, aborting.\n"); 1421 rxvt_fatal ("can't fork, aborting.\n");
1421 } 1422 }
1422 case 0: 1423 case 0:
1423 init_env (); 1424 init_env ();
1424 1425
1425 if (!pty.make_controlling_tty ()) 1426 if (!pty->make_controlling_tty ())
1426 fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); 1427 fprintf (stderr, "%s: could not obtain control of tty.", RESNAME);
1427 else 1428 else
1428 { 1429 {
1429 /* Reopen stdin, stdout and stderr over the tty file descriptor */ 1430 /* Reopen stdin, stdout and stderr over the tty file descriptor */
1430 dup2 (pty.tty, STDIN_FILENO); 1431 dup2 (pty->tty, STDIN_FILENO);
1431 dup2 (pty.tty, STDOUT_FILENO); 1432 dup2 (pty->tty, STDOUT_FILENO);
1432 dup2 (pty.tty, STDERR_FILENO); 1433 dup2 (pty->tty, STDERR_FILENO);
1433 1434
1434 // close all our file handles that we do no longer need 1435 // close all our file handles that we do no longer need
1435 for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) 1436 for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++)
1436 { 1437 {
1437 if ((*t)->pty.pty > 2) close ((*t)->pty.pty); 1438 if ((*t)->pty->pty > 2) close ((*t)->pty->pty);
1438 if ((*t)->pty.tty > 2) close ((*t)->pty.tty); 1439 if ((*t)->pty->tty > 2) close ((*t)->pty->tty);
1439 } 1440 }
1440 1441
1441 run_child (argv); 1442 run_child (argv);
1442 fprintf (stderr, "%s: unable to exec child.", RESNAME); 1443 fprintf (stderr, "%s: unable to exec child.", RESNAME);
1443 } 1444 }
1444 1445
1445 _exit (EXIT_FAILURE); 1446 _exit (EXIT_FAILURE);
1446 1447
1447 default: 1448 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 1449#if UTMP_SUPPORT
1457 privileged_utmp (SAVE); 1450 if (!OPTION (Opt_utmpInhibit))
1451 pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]);
1458#endif 1452#endif
1459 1453
1460#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) 1454 pty->close_tty ();
1461 1455
1462 dup2 (fdstdin, STDIN_FILENO); 1456 child_ev.start (cmd_pid);
1463 close (fdstdin);
1464#endif
1465 }
1466 1457
1467 pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */ 1458 HOOK_INVOKE ((this, HOOK_CHILD_START, DT_INT, cmd_pid, DT_END));
1468 break; 1459 break;
1469 } 1460 }
1470} 1461}
1471 1462
1472/* ------------------------------------------------------------------------- * 1463/* ------------------------------------------------------------------------- *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines