-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: rxvt-unicode-sixel
action: commit
revision:
path_from:
revision_from: d0db58d5db781b7236de7713c057fb2a703b8d64:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit d0db58d5db781b7236de7713c057fb2a703b8d64
Author: Marc Lehmann <schmorp@schmorp.de>
Date:   Fri Dec 19 06:17:03 2003 +0000

    *** empty log message ***

diff --git a/src/command.C b/src/command.C

index 295000bfce329bd9c2d9732390ddc18bd4fff62b..

index ..af52396916ee5ef4dffc90eac49017f098d8bc7a 100644

--- a/src/command.C
+++ b/src/command.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:	command.c
  *----------------------------------------------------------------------*
- * $Id: command.C,v 1.23 2003/12/18 14:11:47 pcg Exp $
+ * $Id: command.C,v 1.24 2003/12/19 06:17:03 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -697,10 +697,6 @@ rxvt_term::flush ()
     }

   XFlush (Xdisplay);
-#if 0
-  if (XPending (Xdisplay)) process_x_events ();
-  if (XPending (Xdisplay)) process_x_events ();
-#endif
 }

 void
diff --git a/src/iom.C b/src/iom.C

index 2c9b4a3ce2fddcce885cc1f2775b7a72eb772a77..

index ..fd2b248ccf90e25aa882cd8b47daa4a1283ccc29 100644

--- a/src/iom.C
+++ b/src/iom.C
@@ -107,6 +107,24 @@ void io_manager::unreg (check_watcher *w)
 }
 #endif

+#if IOM_IDLE
+idle_watcher::~idle_watcher ()
+{
+  if (iom_valid)
+    iom.unreg (this);
+}
+
+void io_manager::reg (idle_watcher *w)
+{
+  reg (w, iw);
+}
+
+void io_manager::unreg (idle_watcher *w)
+{
+  unreg (w, iw);
+}
+#endif
+
 #if IOM_TIME
 inline void set_now (void)
 {
@@ -127,33 +145,44 @@ void io_manager::loop ()
   for (;;)
     {
       struct timeval *to = 0;
-
-#if IOM_TIME
       struct timeval tval;
-      time_watcher *w;

-      for (;tw.size ();)
+#if IOM_IDLE
+      if (iw.size ())
         {
-          w = tw[0];
-
-          for (time_watcher **i = tw.begin (); i < tw.end (); ++i)
-            if ((*i)->at < w->at)
-              w = *i;
+          tval.tv_sec  = 0;
+          tval.tv_usec = 0;
+          to = &tval;
+        }
+      else
+#endif
+        {
+#if IOM_TIME
+          time_watcher *w;

-          if (w->at > NOW)
+          for (;tw.size ();)
             {
-              double diff = w->at - NOW;
-              tval.tv_sec  = (int)diff;
-              tval.tv_usec = (int)((diff - tval.tv_sec) * 1000000);
-              to = &tval;
-              break;
+              w = tw[0];
+
+              for (time_watcher **i = tw.begin (); i < tw.end (); ++i)
+                if ((*i)->at < w->at)
+                  w = *i;
+
+              if (w->at > NOW)
+                {
+                  double diff = w->at - NOW;
+                  tval.tv_sec  = (int)diff;
+                  tval.tv_usec = (int)((diff - tval.tv_sec) * 1000000);
+                  to = &tval;
+                  break;
+                }
+              else if (w->at >= 0)
+                w->call (*w);
+              else
+                unreg (w);
             }
-          else if (w->at >= 0)
-            w->call (*w);
-          else
-            unreg (w);
-        }
 #endif
+        }

 #if IOM_CHECK
       for (int i = 0; i < cw.size (); ++i)
@@ -197,6 +226,12 @@ void io_manager::loop ()
             if (revents)
               w->call (*w, revents);
           }
+#if IOM_IDLE
+      else if (iw.size ())
+        for (int i = 0; i < iw.size (); ++i)
+          iw[i]->call (*iw[i]);
+#endif
+
 #elif IOM_TIME
       if (!to)
         break;
diff --git a/src/iom.h b/src/iom.h

index 5b0960da59a4b737fe63d1442ecddbac6e0a2349..

index ..6912a6a3b29857d0c3644a5b25855cab826e0ab5 100644

--- a/src/iom.h
+++ b/src/iom.h
@@ -28,6 +28,7 @@
 #define IOM_IO 1
 #define IOM_TIME 1
 #define IOM_CHECK 1
+#define IOM_IDLE 0

 #if IOM_IO
   typedef double tstamp;
@@ -41,6 +42,9 @@
 #if IOM_CHECK
   struct check_watcher;
 #endif
+#if IOM_IDLE
+  struct idle_watcher;
+#endif

 class io_manager {
 #if IOM_IO
@@ -52,6 +56,9 @@ class io_manager {
 #if IOM_TIME
   simplevec<time_watcher *>  tw;
 #endif
+#if IOM_IDLE
+  simplevec<idle_watcher *>  iw;
+#endif

   template<class watcher>
   void reg (watcher *w, simplevec<watcher *> &queue);
@@ -62,14 +69,17 @@ class io_manager {
 public:
   // register a watcher
 #if IOM_IO
-  void reg (io_watcher   *w);  void unreg (io_watcher   *w);
+  void reg (io_watcher    *w); void unreg (io_watcher    *w);
 #endif
 #if IOM_TIME
-  void reg (time_watcher *w);  void unreg (time_watcher *w);
+  void reg (time_watcher  *w); void unreg (time_watcher  *w);
 #endif
 #if IOM_CHECK
   void reg (check_watcher *w); void unreg (check_watcher *w);
 #endif
+#if IOM_IDLE
+  void reg (idle_watcher  *w); void unreg (idle_watcher  *w);
+#endif

   void loop ();

@@ -93,9 +103,10 @@ struct io_watcher : callback2<void, io_watcher &, short> {

   ~io_watcher ();

-  void set(int fd_, short events_) { fd = fd_; events = events_; }
+  void set (int fd_, short events_) { fd = fd_; events = events_; }

-  void set(short events_) { set (fd, events_); }
+  void set (short events_) { set (fd, events_); }
+  void start () { iom.reg (this); }
   void start (int fd_, short events_) { set (fd_, events_); iom.reg (this); }
   void stop () { iom.unreg (this); }
 };
@@ -145,5 +156,20 @@ struct check_watcher : callback1<void, check_watcher &> {
 };
 #endif

+#if IOM_IDLE
+// run after checking for any i/o, but before waiting
+struct idle_watcher : callback1<void, idle_watcher &> {
+  template<class O1, class O2>
+  idle_watcher (O1 *object, void (O2::*method)(idle_watcher &))
+    : callback1<void, idle_watcher &>(object,method)
+    { }
+
+  ~idle_watcher ();
+
+  void start () { iom.reg (this); }
+  void stop () { iom.unreg (this); }
+};
+#endif
+
 #endif

diff --git a/src/main.C b/src/main.C

index cd7dae99a9cea6ea2a9815cc2a2376ac73142f4c..

index ..44c6b82e5cbfc71fe324998bca4bd335db8bcc5b 100644

--- a/src/main.C
+++ b/src/main.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:        main.c
  *----------------------------------------------------------------------*
- * $Id: main.C,v 1.17 2003/12/18 13:33:02 pcg Exp $
+ * $Id: main.C,v 1.18 2003/12/19 06:17:03 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -74,7 +74,7 @@ rxvt_term::operator delete (void *p, size_t s)
 }

 rxvt_term::rxvt_term ()
-: pty_ev     (this, &rxvt_term::pty_cb),
+: destroy_ev (this, &rxvt_term::destroy_cb),
 #ifdef CURSOR_BLINK
   blink_ev   (this, &rxvt_term::blink_cb),
 #endif
@@ -82,9 +82,9 @@ rxvt_term::rxvt_term ()
   pointer_ev (this, &rxvt_term::pointer_cb),
 #endif
   x_ev       (this, &rxvt_term::x_cb),
-  destroy_ev (this, &rxvt_term::destroy_cb),
   check_ev   (this, &rxvt_term::check_cb),
-  incr_ev    (this, &rxvt_term::incr_cb)
+  incr_ev    (this, &rxvt_term::incr_cb),
+  pty_ev     (this, &rxvt_term::pty_cb)
 {
   cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
 }

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 12:54:26 2024