--- rxvt-unicode/src/main.C 2004/02/13 12:16:21 1.32 +++ rxvt-unicode/src/main.C 2004/02/21 20:33:40 1.36 @@ -1,4 +1,4 @@ -/*--------------------------------*-C-*---------------------------------* +/*--------------------------------*-C-*---------------------------------*; * File: main.c *----------------------------------------------------------------------* * @@ -92,13 +92,13 @@ #ifdef POINTER_BLANK pointer_ev (this, &rxvt_term::pointer_cb), #endif +#ifdef USE_XIM + im_ev (this, &rxvt_term::im_cb), +#endif check_ev (this, &rxvt_term::check_cb), destroy_ev (this, &rxvt_term::destroy_cb), pty_ev (this, &rxvt_term::pty_cb), - incr_ev (this, &rxvt_term::incr_cb), -#ifdef USE_XIM - im_ev (this, &rxvt_term::im_cb) -#endif + incr_ev (this, &rxvt_term::incr_cb) { cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; } @@ -108,11 +108,6 @@ if (cmd_fd >= 0) close (cmd_fd); - scr_release (); - - free (locale); - free (codeset); - #ifndef NO_SETOWNER_TTYDEV privileged_ttydev (RESTORE); #endif @@ -120,12 +115,29 @@ privileged_utmp (RESTORE); #endif + delete TermWin.fontset; + + if (display) + if (TermWin.parent[0]) + XDestroyWindow (display->display, TermWin.parent[0]); + // TODO: free pixcolours, colours should become part of rxvt_display delete PixColors; - delete TermWin.fontset; displays.put (display); + + scr_release (); + + free (env_windowid); + free (env_display); + free (env_term); + free (env_colorfgbg); + free (locale); + free (codeset); + + delete envv; + delete argv; } void @@ -133,13 +145,9 @@ { if (display) { - if (TermWin.parent[0]) - XDestroyWindow (display->display, TermWin.parent[0]); - rootwin_ev.stop (display); termwin_ev.stop (display); vt_ev.stop (display); - #ifdef USE_XIM im_destroy (); im_ev.stop (display); @@ -259,11 +267,9 @@ Gr_reset (); /* reset graphics */ #endif -#if 0 -#ifdef DEBUG_X +#if 1 XSynchronize (display->display, True); #endif -#endif #ifdef HAVE_SCROLLBARS if (Options & Opt_scrollBar) @@ -286,7 +292,6 @@ XMapWindow (display->display, TermWin.vt); XMapWindow (display->display, TermWin.parent[0]); - init_env (); init_command (cmd_argv); pty_ev.start (cmd_fd, EVENT_READ); @@ -875,8 +880,8 @@ #endif break; } + sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); - putenv (env_colorfgbg); #ifndef NO_BRIGHTCOLOR colorfgbg = DEFAULT_RSTYLE; @@ -1311,7 +1316,7 @@ #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) if (rs[Rs_imLocale]) - setlocale (LC_CTYPE, rs[Rs_imLocale]); + rxvt_set_locale (rs[Rs_imLocale]); #endif p = rs[Rs_inputMethod]; @@ -1352,7 +1357,7 @@ done: #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) if (rs[Rs_imLocale]) - setlocale (LC_CTYPE, locale); + rxvt_set_locale (locale); #endif }