From c1e51b6f74d82ba89510cc7abae76b87190bcfc8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Dec 2007 16:23:59 +0000 Subject: [PATCH] switch to new callbakc mechanism. ugly syntax, very small watchers, smaller code on g++-4.3 at least --- src/iom_perl.h | 8 +++---- src/main.C | 53 +++++++++++++++++++++++------------------------ src/rxvtd.C | 10 +++++---- src/rxvttoolkit.C | 2 +- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/iom_perl.h b/src/iom_perl.h index 30652065..cfeda0cb 100644 --- a/src/iom_perl.h +++ b/src/iom_perl.h @@ -67,8 +67,8 @@ perl_watcher::invoke (const char *type, SV *self, int arg) struct timer : perl_watcher, ev::timer { timer () - : ev::timer (this, &timer::execute) { + set (this); } void execute (ev::timer &w, int revents) @@ -83,8 +83,8 @@ struct timer : perl_watcher, ev::timer struct iow : perl_watcher, ev::io { iow () - : ev::io (this, &iow::execute) { + set (this); } void execute (ev::io &w, int revents) @@ -99,8 +99,8 @@ struct iow : perl_watcher, ev::io struct iw : perl_watcher, ev::idle { iw () - : ev::idle (this, &iw::execute) { + set (this); } void execute (ev::idle &w, int revents) @@ -115,8 +115,8 @@ struct iw : perl_watcher, ev::idle struct pw : perl_watcher, ev::child { pw () - : ev::child (this, &pw::execute) { + set (this); } void execute (ev::child &w, int revents) diff --git a/src/main.C b/src/main.C index 0d4c6a7f..f4d55d7f 100644 --- a/src/main.C +++ b/src/main.C @@ -154,49 +154,48 @@ int rxvt_composite_vec::expand (unicode_t c, wchar_t *r) #endif rxvt_term::rxvt_term () - : +{ #if HAVE_BG_PIXMAP - update_background_ev(this, &rxvt_term::update_background_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), -#endif -#ifdef POINTER_BLANK - pointer_ev (this, &rxvt_term::pointer_cb), + slip_wheel_ev.set (this); #endif -#ifndef NO_BELL - bell_ev (this, &rxvt_term::bell_cb), -#endif - 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) -{ #if ENABLE_TRANSPARENCY || ENABLE_PERL - callback_set (rootwin_ev , this, rxvt_term, rootwin_cb); + rootwin_ev.set (this), #endif #ifdef HAVE_SCROLLBARS - callback_set (scrollbar_ev, this, rxvt_term, x_cb); + scrollbar_ev.set (this), #endif #ifdef USE_XIM - callback_set (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.set (this); #endif - callback_set (termwin_ev , this, rxvt_term, x_cb); - callback_set (vt_ev , this, rxvt_term, x_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; @@ -612,9 +611,9 @@ static struct sig_handlers } 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; diff --git a/src/rxvtd.C b/src/rxvtd.C index 09c5d389..d3d70f6f 100644 --- a/src/rxvtd.C +++ b/src/rxvtd.C @@ -48,10 +48,11 @@ struct server : rxvt_connection { int getfd (int remote_fd); server (int fd) - : read_ev (this, &server::read_cb) { - callback_set (log_cb , this, server, log_msg); - callback_set (getfd_cb, this, server, getfd); + read_ev.set (this); + log_cb.set (this); + getfd_cb.set (this); + this->fd = fd; fcntl (fd, F_SETFD, FD_CLOEXEC); fcntl (fd, F_SETFL, 0); @@ -70,8 +71,9 @@ struct unix_listener { }; unix_listener::unix_listener (const char *sockname) -: accept_ev (this, &unix_listener::accept_cb) { + accept_ev.set (this); + sockaddr_un sa; if (strlen (sockname) >= sizeof(sa.sun_path)) diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C index 5779905f..fcdfe6ca 100644 --- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -297,9 +297,9 @@ rxvt_screen::clear () rxvt_display::rxvt_display (const char *id) : refcounted (id) -, x_ev (this, &rxvt_display::x_cb) , selection_owner (0) { + x_ev.set (this); } XrmDatabase -- 2.34.1