--- rxvt-unicode/src/init.C 2006/01/18 19:43:51 1.148 +++ rxvt-unicode/src/init.C 2006/01/25 02:45:36 1.154 @@ -176,56 +176,14 @@ #endif }; -const char *const xa_names[] = - { - "TEXT", - "COMPOUND_TEXT", - "UTF8_STRING", - "MULTIPLE", - "TARGETS", - "TIMESTAMP", - "VT_SELECTION", - "INCR", - "WM_PROTOCOLS", - "WM_DELETE_WINDOW", - "CLIPBOARD", -#if ENABLE_FRILLS - "_MOTIF_WM_HINTS", -#endif -#if ENABLE_EWMH - "_NET_WM_PID", - "_NET_WM_NAME", - "_NET_WM_ICON_NAME", - "_NET_WM_PING", -#endif -#if USE_XIM - "WM_LOCALE_NAME", -#endif -#ifdef TRANSPARENT - "_XROOTPMAP_ID", - "ESETROOT_PMAP_ID", -#endif -#ifdef OFFIX_DND - "DndProtocol", - "DndSelection", -#endif -#if ENABLE_XEMBED - "_XEMBED", - "_XEMBED_INFO", -#endif - }; - bool rxvt_term::init_vars () { - pix_colors_focused = new rxvt_color [TOTAL_COLORS]; + pix_colors = // + pix_colors_focused = new rxvt_color [TOTAL_COLORS]; #ifdef OFF_FOCUS_FADING pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; #endif - pix_colors = pix_colors_focused; - - if (pix_colors == NULL) - return false; #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) pixmap = None; @@ -347,6 +305,19 @@ free (r_argv); +#if ENABLE_PERL + if (!rs[Rs_perl_ext_1]) + rs[Rs_perl_ext_1] = "default"; + + if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) + || (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2]) + || (rs[Rs_perl_eval] && *rs[Rs_perl_eval])) + { + rxvt_perl.init (this); + HOOK_INVOKE ((this, HOOK_INIT, DT_END)); + } +#endif + /* * set any defaults not already set */ @@ -907,28 +878,14 @@ XClassHint classHint; XWMHints wmHint; #if ENABLE_FRILLS - Atom prop = None; MWMHints mwmhints; #endif XGCValues gcvalue; XSetWindowAttributes attributes; - XWindowAttributes gattr; Window top, parent; dDisp; -#ifdef USING_W11LIB - /* enable W11 callbacks */ - W11AddEventHandler (disp, rxvt_W11_process_x_event); -#endif - - assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); - XInternAtoms (disp, (char **)xa_names, NUM_XA, False, xa); - - if (OPTION (Opt_transparent)) - { - XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); - display->depth = gattr.depth; // doh //TODO, per-term not per-display? - } + xa = display->xa; /* grab colors before netscape does */ Get_Colours (); @@ -936,16 +893,14 @@ if (!set_fonts ()) rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); - parent = DefaultRootWindow (disp); + parent = display->root; attributes.override_redirect = !!OPTION (Opt_override_redirect); #if ENABLE_FRILLS if (OPTION (Opt_borderLess)) { - prop = XInternAtom (disp, "_MOTIF_WM_INFO", True); - - if (prop == None) + if (XInternAtom (disp, "_MOTIF_WM_INFO", True) == None) { /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ attributes.override_redirect = TRUE; @@ -979,8 +934,9 @@ /* sub-window placement & size in rxvt_resize_subwindows () */ attributes.background_pixel = pix_colors_focused[Color_border]; - attributes.border_pixel = pix_colors_focused[Color_border]; - attributes.colormap = display->cmap; + attributes.border_pixel = pix_colors_focused[Color_border]; + attributes.colormap = display->cmap; + top = XCreateWindow (disp, parent, szHint.x, szHint.y, szHint.width, szHint.height, @@ -995,20 +951,26 @@ old_width = szHint.width; old_height = szHint.height; - process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); + process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); - classHint.res_name = (char *)rs[Rs_name]; + classHint.res_name = (char *)rs[Rs_name]; classHint.res_class = (char *)RESCLASS; - wmHint.flags = InputHint | StateHint | WindowGroupHint; - wmHint.input = True; + wmHint.flags = InputHint | StateHint | WindowGroupHint; + wmHint.input = True; wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; - wmHint.window_group = top; + wmHint.window_group = top; XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, &szHint, &wmHint, &classHint); +#if ENABLE_FRILLS + if (mwmhints.flags) + XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, + PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); +#endif + Atom protocols[] = { xa[XA_WM_DELETE_WINDOW], #if ENABLE_EWMH @@ -1043,12 +1005,6 @@ termwin_ev.start (display, top); -#if ENABLE_FRILLS - if (mwmhints.flags) - XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, - PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); -#endif - /* vt cursor: Black-on-White is standard, but this is more popular */ TermWin_cursor = XCreateFontCursor (disp, XC_xterm); @@ -1059,16 +1015,11 @@ /* the vt window */ vt = XCreateSimpleWindow (disp, top, - window_vt_x, - window_vt_y, - width, - height, - 0, - pix_colors_focused[Color_fg], - pix_colors_focused[Color_bg]); -#ifdef DEBUG_X - XStoreName (disp, vt, "vt window"); -#endif + window_vt_x, window_vt_y, + width, height, + 0, + pix_colors_focused[Color_fg], + pix_colors_focused[Color_bg]); attributes.bit_gravity = NorthWestGravity; XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); @@ -1086,7 +1037,7 @@ #ifdef XPM_BACKGROUND if (rs[Rs_backgroundPixmap] != NULL - && ! OPTION (Opt_transparent)) + && !OPTION (Opt_transparent)) { const char *p = rs[Rs_backgroundPixmap]; @@ -1102,12 +1053,13 @@ #endif /* graphics context for the vt window */ - gcvalue.foreground = pix_colors[Color_fg]; - gcvalue.background = pix_colors[Color_bg]; + gcvalue.foreground = pix_colors[Color_fg]; + gcvalue.background = pix_colors[Color_bg]; gcvalue.graphics_exposures = 1; + gc = XCreateGC (disp, vt, - GCForeground | GCBackground | GCGraphicsExposures, - &gcvalue); + GCForeground | GCBackground | GCGraphicsExposures, + &gcvalue); drawable = new rxvt_drawable (display, vt); @@ -1128,16 +1080,6 @@ pointer_unblank (); scr_recolour (); - -#if ENABLE_XEMBED - if (rs[Rs_embed]) - { - long info[2] = { 0, XEMBED_MAPPED }; - - XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], - 32, PropModeReplace, (unsigned char *)&info, 2); - } -#endif } /* ------------------------------------------------------------------------- * @@ -1437,12 +1379,14 @@ _exit (EXIT_FAILURE); default: -#if UTMP_SUPPORT if (!OPTION (Opt_utmpInhibit)) pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); -#endif pty->close_tty (); + + child_ev.start (cmd_pid); + + HOOK_INVOKE ((this, HOOK_CHILD_START, DT_INT, cmd_pid, DT_END)); break; } }