*** empty log message ***
authorroot <root>
Thu, 19 Jan 2006 11:56:00 +0000 (11:56 +0000)
committerroot <root>
Thu, 19 Jan 2006 11:56:00 +0000 (11:56 +0000)
Changes
src/iom.C
src/iom.h
src/iom_conf.h
src/rxvtperl.xs

diff --git a/Changes b/Changes
index 2596d87a61ab51e56f49bd82b00cd14c91ea38cb..989d065c1eed59c0493d96b176eb50b97a270358 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 rxvt-unicode changelog <= google-friendly title
 
 TODO: split perl documnetation and urxvt.pm into separate files
+TODO: nuke rxvt_privaction and related garbage
 TODO: harmonize --disable-options into position-dependent options.
 TODO: after requesting the selection and getting a timeout, no further requests will be sent.
 TODO: "slow" rendering mode for bidi and scripts
index e42dee86880f2d10da04d8fc2d67b3514fc7f4e7..fd35d2e7b2d622a92196dfd08e912be38ff54552 100644 (file)
--- a/src/iom.C
+++ b/src/iom.C
@@ -1,6 +1,6 @@
 /*
     iom.C -- generic I/O multiplexer
-    Copyright (C) 2003, 2004 Marc Lehmann <gvpe@schmorp.de>
+    Copyright (C) 2003-2006 Marc Lehmann <gvpe@schmorp.de>
  
     This file is part of GVPE.
 
index 42c76318bac9765d879d685326b9c50e28a5e4e4..4108145e92b51e1ec0eb8d3bd42ff37311a051dc 100644 (file)
--- a/src/iom.h
+++ b/src/iom.h
@@ -1,6 +1,6 @@
 /*
     iom.h -- generic I/O multiplexer
-    Copyright (C) 2003, 2004 Marc Lehmann <gvpe@schmorp.de>
+    Copyright (C) 2003-2006 Marc Lehmann <gvpe@schmorp.de>
  
     This file is part of GVPE.
 
index be08fc627dcd9a2ee9861c36341142f17ca03bfe..3729950ce3e64568e9a3462f5b5c89a251d3bff6 100644 (file)
@@ -1,6 +1,6 @@
 /*
     iom_conf.h -- generic I/O multiplexer config
-    Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
+    Copyright (C) 2003-2006 Marc Lehmann <pcg@goof.com>
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
index 9266a9d3f307cd76592a8ebb85a4511e24bb2fc8..1cb860dc3b98bda1abd248377912a8f79fe689bc 100644 (file)
@@ -213,6 +213,7 @@ struct iow : io_watcher, perl_watcher
 
 struct overlay {
   HV *self;
+  bool visible;
   rxvt_term *THIS;
   int x, y, w, h;
   int border;
@@ -231,7 +232,7 @@ struct overlay {
 };
 
 overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border)
-: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2)
+: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), visible(false)
 {
   if (border == 2)
     {
@@ -302,24 +303,38 @@ overlay::~overlay ()
 void
 overlay::show ()
 {
-  char key[33]; sprintf (key, "%32lx", (long)this);
+  if (visible)
+    return;
+
+  visible = true;
 
-  HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
-  hv_store (hv, key, 32, newSViv ((long)this), 0);
+  AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
+  av_push (av, newSViv ((long)this));
 }
 
 void
 overlay::hide ()
 {
-  SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0);
+  if (!visible)
+    return;
 
-  if (ovs)
-    {
-      char key[33]; sprintf (key, "%32lx", (long)this);
+  visible = false;
 
-      HV *hv = (HV *)SvRV (*ovs);
-      hv_delete (hv, key, 32, G_DISCARD);
-    }
+  AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
+
+  int i;
+
+  for (i = AvFILL (av); i >= 0; i--)
+    if (SvIV (*av_fetch (av, i, 1)) == (long)this)
+      {
+        av_delete (av, i, G_DISCARD);
+        break;
+      }
+
+  for (; i < AvFILL (av); i++)
+    av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0)));
+
+  av_pop (av);
 }
 
 void overlay::swap ()
@@ -369,7 +384,7 @@ void overlay::set (int x, int y, SV *text, SV *rend)
 
       AV *av = (AV *)SvRV (rend);
 
-      for (int col = min (av_len (av) + 1, w - x - border); col--; )
+      for (int col = min (AvFILL (av) + 1, w - x - border); col--; )
         this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1));
     }
 
@@ -435,7 +450,7 @@ rxvt_perl_interp::init (rxvt_term *term)
     {
       // runs outside of perls ENV
       term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
-      hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0);
+      hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newAV ()), 0);
     }
 }
 
@@ -450,20 +465,6 @@ ungrab (rxvt_term *THIS)
     }
 }
 
-static void
-swap_overlays (rxvt_term *term)
-{
-  HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
-
-  if (HvKEYS (hv))
-    {
-      hv_iterinit (hv);
-
-      while (HE *he = hv_iternext (hv))
-        ((overlay *)SvIV (hv_iterval (hv, he)))->swap ();
-    }
-}
-
 bool
 rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
 {
@@ -472,7 +473,12 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
 
   // pre-handling of some events
   if (htype == HOOK_REFRESH_END)
-    swap_overlays (term);
+    {
+      AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
+      
+      for (int i = 0; i <= AvFILL (av); i++)
+        ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
+    }
 
   swap (perl_environ, environ);
 
@@ -649,7 +655,12 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
 
   // post-handling of some events
   if (htype == HOOK_REFRESH_BEGIN)
-    swap_overlays (term);
+    {
+      AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
+      
+      for (int i = AvFILL (av); i >= 0; i--)
+        ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
+    }
   else if (htype == HOOK_DESTROY)
     {
       clearSVptr ((SV *)term->perl.self);
@@ -873,7 +884,7 @@ _new (...)
           term->argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
 
         AV *envv = (AV *)SvRV (ST (0));
-        for (int i = av_len (envv) + 1; i--; )
+        for (int i = AvFILL (envv) + 1; i--; )
           term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1))));
 
         term->envv->push_back (0);
@@ -1306,7 +1317,7 @@ rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start
               croak ("new_rend must be arrayref");
 
             AV *av = (AV *)SvRV (new_rend);
-            int len = min (av_len (av) + 1 - start_ofs, max_len);
+            int len = min (AvFILL (av) + 1 - start_ofs, max_len);
 
             if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len))
               croak ("new_rend array extends beyond horizontal margins");