--- rxvt-unicode/src/main.C 2007/11/18 02:45:26 1.260 +++ rxvt-unicode/src/main.C 2007/12/04 16:33:42 1.271 @@ -154,49 +154,49 @@ #endif rxvt_term::rxvt_term () - : -#if ENABLE_TRANSPARENCY || ENABLE_PERL - rootwin_ev (this, &rxvt_term::rootwin_cb), -#endif +{ #if HAVE_BG_PIXMAP - update_background_ev(this, &rxvt_term::update_background_cb), -#endif -#ifdef HAVE_SCROLLBARS - scrollbar_ev (this, &rxvt_term::x_cb), + update_background_ev.set (this); #endif #ifdef CURSOR_BLINK - cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), + cursor_blink_ev.set (this); #endif #ifdef TEXT_BLINK - text_blink_ev (this, &rxvt_term::text_blink_cb), + text_blink_ev.set (this); #endif #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - cont_scroll_ev (this, &rxvt_term::cont_scroll_cb), + cont_scroll_ev.set (this); #endif #ifdef SELECTION_SCROLLING - sel_scroll_ev (this, &rxvt_term::sel_scroll_cb), + sel_scroll_ev.set (this); #endif #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) - slip_wheel_ev (this, &rxvt_term::slip_wheel_cb), + slip_wheel_ev.set (this); #endif -#ifdef POINTER_BLANK - pointer_ev (this, &rxvt_term::pointer_cb), +#if ENABLE_TRANSPARENCY || ENABLE_PERL + rootwin_ev.set (this), +#endif +#ifdef HAVE_SCROLLBARS + scrollbar_ev.set (this), #endif #ifdef USE_XIM - im_ev (this, &rxvt_term::im_cb), + im_ev.set (this), +#endif +#ifdef POINTER_BLANK + pointer_ev.set (this); #endif #ifndef NO_BELL - bell_ev (this, &rxvt_term::bell_cb), + bell_ev.set (this); #endif - termwin_ev (this, &rxvt_term::x_cb), - vt_ev (this, &rxvt_term::x_cb), - child_ev (this, &rxvt_term::child_cb), - prepare_ev (this, &rxvt_term::prepare_cb), - flush_ev (this, &rxvt_term::flush_cb), - destroy_ev (this, &rxvt_term::destroy_cb), - pty_ev (this, &rxvt_term::pty_cb), - incr_ev (this, &rxvt_term::incr_cb) -{ + child_ev.set (this); + prepare_ev.set (this); + flush_ev.set (this); + destroy_ev.set (this); + pty_ev.set (this); + incr_ev.set (this); + termwin_ev.set (this); + vt_ev.set (this); + cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; termlist.push_back (this); @@ -286,6 +286,9 @@ delete [] pix_colors_unfocused; #endif +#ifdef HAVE_BG_PIXMAP + bgPixmap.destroy (); +#endif displays.put (display); scr_release (); @@ -308,6 +311,9 @@ #ifdef KEYSYM_RESOURCE delete keyboard; #endif +#ifndef NO_RESOURCES + XrmDestroyDatabase (option_db); +#endif } // child has exited, usually destroys @@ -596,21 +602,23 @@ /* * Catch a fatal signal and tidy up before quitting */ - void - sig_term (ev::sig &w, int revents) - { - rxvt_emergency_cleanup (); - w.stop (); - kill (getpid (), w.signum); - } + void sig_term (ev::sig &w, int revents); sig_handlers () - : sw_term (this, &sig_handlers::sig_term), - sw_int (this, &sig_handlers::sig_term) { + sw_term.set (this); + sw_int .set (this); } } sig_handlers; +void +sig_handlers::sig_term (ev::sig &w, int revents) +{ + rxvt_emergency_cleanup (); + w.stop (); + kill (getpid (), w.signum); +} + char **rxvt_environ; // startup environment void @@ -618,7 +626,7 @@ { ptytty::init (); - if (!ev::ev_default_loop (0)) + if (!ev_default_loop (0)) rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); rxvt_environ = environ; @@ -626,8 +634,8 @@ signal (SIGHUP, SIG_IGN); signal (SIGPIPE, SIG_IGN); - sig_handlers.sw_term.start (SIGTERM); ev::ev_unref (); - sig_handlers.sw_int.start (SIGINT); ev::ev_unref (); + sig_handlers.sw_term.start (SIGTERM); ev_unref (); + sig_handlers.sw_int.start (SIGINT); ev_unref (); /* need to trap SIGURG for SVR4 (Unixware) rlogin */ /* signal (SIGURG, SIG_DFL); */ @@ -975,14 +983,15 @@ i = atoi (color); if (i >= 8 && i <= 15) - { /* bright colors */ - i -= 8; - pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; + { + /* bright colors */ + pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; goto done; } if (i >= 0 && i <= 7) - { /* normal colors */ + { + /* normal colors */ pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; goto done; } @@ -997,8 +1006,6 @@ pix_colors_focused[idx] = xcol; - /* XSetWindowAttributes attr; */ - /* Cursor cursor; */ done: /*TODO: handle Color_BD, scrollbar background, etc. */ @@ -1032,7 +1039,7 @@ rxvt_term::set_colorfgbg () { unsigned int i; - const char *xpmb = "\0"; + const char *xpmb = ""; char fstr[sizeof ("default") + 1], bstr[sizeof ("default") + 1]; strcpy (fstr, "default"); @@ -1742,12 +1749,13 @@ #ifdef HAVE_BG_PIXMAP # if TRACE_PIXMAPS # undef update_background -int rxvt_term::trace_update_background (const char* file, int line) +int rxvt_term::trace_update_background (const char *file, int line) { fprintf (stderr, "%s:%d:update_background()\n", file, line); update_background (); } # endif + int rxvt_term::update_background () {