--- rxvt-unicode/src/main.C 2007/10/15 07:33:48 1.253 +++ rxvt-unicode/src/main.C 2007/11/11 04:08:00 1.256 @@ -40,14 +40,19 @@ #include #include -#ifdef TTY_GID_SUPPORT -# include -#endif - #ifdef HAVE_TERMIOS_H # include #endif +#ifdef HAVE_XSETLOCALE +# define X_LOCALE +# include +#else +# ifdef HAVE_SETLOCALE +# include +# endif +#endif + vector rxvt_term::termlist; // used to tell global functions which terminal instance is "active" @@ -90,7 +95,7 @@ text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2) { compose_char *cc; - + // break compose chains, as stupid readline really likes to duplicate // composing characters for some reason near the end of a line. cc = (*this)[c1]; @@ -180,13 +185,13 @@ #ifdef USE_XIM im_ev (this, &rxvt_term::im_cb), #endif -#ifndef NO_BELL +#ifndef NO_BELL bell_ev (this, &rxvt_term::bell_cb), #endif 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), @@ -307,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)); @@ -345,7 +350,7 @@ vt_ev.stop (display); } - check_ev.stop (); + prepare_ev.stop (); pty_ev.stop (); #ifdef CURSOR_BLINK cursor_blink_ev.stop (); @@ -363,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::check &w, int revents) { make_current (); @@ -431,7 +436,7 @@ mesg, BUFSIZ); rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); } - XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", + XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ); rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); } @@ -515,10 +520,10 @@ if (option (Opt_transparent)) { bgPixmap.set_transparent (); -#ifdef HAVE_AFTERIMAGE +#ifdef HAVE_AFTERIMAGE if (rs [Rs_blurradius]) bgPixmap.set_blur_radius (rs [Rs_blurradius]); -#endif +#endif if (ISSET_PIXCOLOR (Color_tint)) bgPixmap.set_tint (pix_colors_focused [Color_tint]); if (rs [Rs_shade]) @@ -562,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)); @@ -586,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); } @@ -612,14 +617,15 @@ rxvt_init () { ptytty::init (); + ev::ev_default_loop (0); 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); */ @@ -899,7 +905,7 @@ resize_all_windows (0, 0, 0); scr_remap_chars (); scr_touch (true); - } + } return true; } @@ -953,7 +959,7 @@ #ifdef XTERM_COLOR_CHANGE rxvt_color xcol; int i; - + if (color == NULL || *color == '\0') return; @@ -1344,7 +1350,7 @@ } else str = (void *)text->string.wide_char; - + HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, DT_INT, call_data->caret, DT_INT, call_data->chg_first, @@ -1673,7 +1679,7 @@ { im_set_size (preedit_rect); preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); - + XSetICValues (Input_Context, XNPreeditAttributes, preedit_attr, NULL); } @@ -1737,24 +1743,26 @@ { 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 (); }