--- rxvt-unicode/src/main.C 2007/10/31 09:55:23 1.255 +++ rxvt-unicode/src/main.C 2007/11/18 02:45:26 1.260 @@ -191,7 +191,7 @@ termwin_ev (this, &rxvt_term::x_cb), vt_ev (this, &rxvt_term::x_cb), child_ev (this, &rxvt_term::child_cb), - check_ev (this, &rxvt_term::check_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), @@ -312,7 +312,7 @@ // child has exited, usually destroys void -rxvt_term::child_cb (child_watcher &w, int status) +rxvt_term::child_cb (ev::child &w, int status) { HOOK_INVOKE ((this, HOOK_CHILD_EXIT, DT_INT, status, DT_END)); @@ -350,7 +350,7 @@ vt_ev.stop (display); } - check_ev.stop (); + prepare_ev.stop (); pty_ev.stop (); #ifdef CURSOR_BLINK cursor_blink_ev.stop (); @@ -368,11 +368,11 @@ pointer_ev.stop (); #endif - destroy_ev.start (0); + destroy_ev.start (); } void -rxvt_term::destroy_cb (time_watcher &w) +rxvt_term::destroy_cb (ev::idle &w, int revents) { make_current (); @@ -567,9 +567,9 @@ free (cmd_argv); if (pty->pty >= 0) - pty_ev.start (pty->pty, EVENT_READ); + pty_ev.start (pty->pty, ev::READ); - check_ev.start (); + prepare_ev.start (); HOOK_INVOKE ((this, HOOK_START, DT_END)); @@ -591,16 +591,16 @@ static struct sig_handlers { - sig_watcher sw_term, sw_int; + ev::sig sw_term, sw_int; /* * Catch a fatal signal and tidy up before quitting */ void - sig_term (sig_watcher &w) + sig_term (ev::sig &w, int revents) { rxvt_emergency_cleanup (); - signal (w.signum, SIG_DFL); + w.stop (); kill (getpid (), w.signum); } @@ -618,13 +618,16 @@ { ptytty::init (); + if (!ev::ev_default_loop (0)) + rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); + rxvt_environ = environ; signal (SIGHUP, SIG_IGN); signal (SIGPIPE, SIG_IGN); - sig_handlers.sw_term.start (SIGTERM); - sig_handlers.sw_int.start (SIGINT); + sig_handlers.sw_term.start (SIGTERM); ev::ev_unref (); + sig_handlers.sw_int.start (SIGINT); ev::ev_unref (); /* need to trap SIGURG for SVR4 (Unixware) rlogin */ /* signal (SIGURG, SIG_DFL); */ @@ -1002,7 +1005,7 @@ update_fade_color (idx); recolour_cursor (); scr_recolour (); -#endif /* XTERM_COLOR_CHANGE */ +#endif /* XTERM_COLOR_CHANGE */ } void @@ -1705,7 +1708,7 @@ XFree (preedit_attr); } -#endif /* USE_XIM */ +#endif /* USE_XIM */ void rxvt_term::get_window_origin (int &x, int &y) @@ -1737,29 +1740,39 @@ } #ifdef HAVE_BG_PIXMAP +# if TRACE_PIXMAPS +# undef update_background +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 () { bgPixmap.invalidate (); - /* no chance of real time refresh if we are blurring ! */ - if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) + /* no chance of real time refresh if we are blurring! */ + if (bgPixmap.invalid_since + 0.5 < ev::now () && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) bgPixmap.render (); else { update_background_ev.stop (); + if (!bgPixmap.need_client_side_rendering()) - update_background_ev.start (NOW + .05); + update_background_ev.start (.05); else if (bgPixmap.flags & bgPixmap_t::blurNeeded) - update_background_ev.start (NOW + .2); /* very slow !!! */ + update_background_ev.start (.20); /* very slow !!! */ else - update_background_ev.start (NOW + .07); + update_background_ev.start (.07); } + return 0; } void -rxvt_term::update_background_cb (time_watcher &w) +rxvt_term::update_background_cb (ev::timer &w, int revents) { bgPixmap.render (); }