switch to new callbakc mechanism. ugly syntax, very small watchers, smaller code...
authorroot <root>
Tue, 4 Dec 2007 16:23:59 +0000 (16:23 +0000)
committerroot <root>
Tue, 4 Dec 2007 16:23:59 +0000 (16:23 +0000)
src/iom_perl.h
src/main.C
src/rxvtd.C
src/rxvttoolkit.C

index 3065206..cfeda0c 100644 (file)
@@ -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<timer, &timer::execute> (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<iow, &iow::execute> (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<iw, &iw::execute> (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<pw, &pw::execute> (this);
   }
 
   void execute (ev::child &w, int revents)
index 0d4c6a7..f4d55d7 100644 (file)
@@ -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<rxvt_term, &rxvt_term::update_background_cb> (this);
 #endif
 #ifdef CURSOR_BLINK
-    cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
+  cursor_blink_ev.set     <rxvt_term, &rxvt_term::cursor_blink_cb> (this);
 #endif
 #ifdef TEXT_BLINK
-    text_blink_ev (this, &rxvt_term::text_blink_cb),
+  text_blink_ev.set       <rxvt_term, &rxvt_term::text_blink_cb>   (this);
 #endif
 #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
-    cont_scroll_ev (this, &rxvt_term::cont_scroll_cb),
+  cont_scroll_ev.set      <rxvt_term, &rxvt_term::cont_scroll_cb>  (this);
 #endif
 #ifdef SELECTION_SCROLLING
-    sel_scroll_ev (this, &rxvt_term::sel_scroll_cb),
+  sel_scroll_ev.set       <rxvt_term, &rxvt_term::sel_scroll_cb>   (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       <rxvt_term, &rxvt_term::slip_wheel_cb>   (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          <rxvt_term, &rxvt_term::x_cb>       (this),
 #endif
 #ifdef HAVE_SCROLLBARS
-  callback_set (scrollbar_ev, this, rxvt_term, x_cb);
+  scrollbar_ev.set        <rxvt_term, &rxvt_term::x_cb>       (this),
 #endif
 #ifdef USE_XIM
-  callback_set (im_ev       , this, rxvt_term, im_cb);
+  im_ev.set               <rxvt_term, &rxvt_term::im_cb>      (this),
+#endif
+#ifdef POINTER_BLANK
+  pointer_ev.set          <rxvt_term, &rxvt_term::pointer_cb> (this);
+#endif
+#ifndef NO_BELL
+  bell_ev.set             <rxvt_term, &rxvt_term::bell_cb>    (this);
 #endif
-  callback_set (termwin_ev  , this, rxvt_term, x_cb);
-  callback_set (vt_ev       , this, rxvt_term, x_cb);
+  child_ev.set            <rxvt_term, &rxvt_term::child_cb>   (this);
+  prepare_ev.set          <rxvt_term, &rxvt_term::prepare_cb> (this);
+  flush_ev.set            <rxvt_term, &rxvt_term::flush_cb>   (this);
+  destroy_ev.set          <rxvt_term, &rxvt_term::destroy_cb> (this);
+  pty_ev.set              <rxvt_term, &rxvt_term::pty_cb>     (this);
+  incr_ev.set             <rxvt_term, &rxvt_term::incr_cb>    (this);
+  termwin_ev.set          <rxvt_term, &rxvt_term::x_cb>       (this);
+  vt_ev.set               <rxvt_term, &rxvt_term::x_cb>       (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<sig_handlers, &sig_handlers::sig_term> (this);
+    sw_int .set<sig_handlers, &sig_handlers::sig_term> (this);
   }
 } sig_handlers;
 
index 09c5d38..d3d70f6 100644 (file)
@@ -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 <server, &server::read_cb> (this);
+    log_cb.set  <server, &server::log_msg> (this);
+    getfd_cb.set<server, &server::getfd>   (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<unix_listener, &unix_listener::accept_cb> (this);
+
   sockaddr_un sa;
 
   if (strlen (sockname) >= sizeof(sa.sun_path))
index 5779905..fcdfe6c 100644 (file)
@@ -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<rxvt_display, &rxvt_display::x_cb> (this);
 }
 
 XrmDatabase