*** empty log message ***
authorroot <root>
Wed, 25 Jan 2006 15:02:47 +0000 (15:02 +0000)
committerroot <root>
Wed, 25 Jan 2006 15:02:47 +0000 (15:02 +0000)
src/perl/remote-selection
src/rxvtperl.xs

index 39684a1970d99dc5883633ae9b94075de2f2e388..3e006709ee05ee64ed2fda3eeb0201d2389e2ce0 100644 (file)
@@ -18,7 +18,7 @@ sub msg {
 sub wait_pipe {
    my ($self, $fh, $pid, $msg) = @_;
 
-   $self->msg ("waiting for process to finish...");
+   $self->msg ("waiting for selection process to finish...");
 
    my $wait_pipe; $wait_pipe = urxvt::pw->new->start ($pid)->cb (sub {
       my ($undef, $status) = @_;
@@ -74,7 +74,7 @@ sub fetch {
             delete $self->{iow};
             $self->selection_clear;
             $self->selection ($txt);
-            $self->selection_make (urxvt::CurrentTime);
+            $self->selection_grab (urxvt::CurrentTime);
             $self->wait_pipe ($fh, $pid, "selection fetched");
          }
       });
index 918946dab4f2fb311f4492ba882ebac894ee0f63..af43e2d3721a39cfd4d2834c8ae9ec410cf8c8b9 100644 (file)
@@ -246,15 +246,17 @@ struct pw : perl_watcher, child_watcher
 
 #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay")
 
-struct overlay {
-  HV *self;
-  bool visible;
+class overlay {
   rxvt_term *THIS;
+  AV *overlay_av;
   int x, y, w, h;
   int border;
   text_t **text;
   rend_t **rend;
 
+public:
+  HV *self;
+
   overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border);
   ~overlay ();
 
@@ -267,7 +269,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), visible(false)
+: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0)
 {
   if (border == 2)
     {
@@ -316,7 +318,6 @@ overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle
     }
 
   show ();
-  THIS->want_refresh = 1;
 }
 
 overlay::~overlay ()
@@ -331,45 +332,46 @@ overlay::~overlay ()
 
   delete [] text;
   delete [] rend;
-
-  THIS->want_refresh = 1;
 }
 
 void
 overlay::show ()
 {
-  if (visible)
+  if (overlay_av)
     return;
 
-  visible = true;
+  overlay_av = (AV *)SvREFCNT_inc (SvRV (
+        *hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)
+     ));
+  av_push (overlay_av, newSViv ((long)this));
 
-  AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
-  av_push (av, newSViv ((long)this));
+  THIS->want_refresh = 1;
 }
 
 void
 overlay::hide ()
 {
-  if (!visible)
+  if (!overlay_av)
     return;
 
-  visible = false;
-
-  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)
+  for (i = AvFILL (overlay_av); i >= 0; i--)
+    if (SvIV (*av_fetch (overlay_av, i, 1)) == (long)this)
       {
-        av_delete (av, i, G_DISCARD);
+        av_delete (overlay_av, i, G_DISCARD);
         break;
       }
 
-  for (; i < AvFILL (av); i++)
-    av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0)));
+  for (; i < AvFILL (overlay_av); i++)
+    av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0)));
+
+  av_pop (overlay_av);
 
-  av_pop (av);
+  SvREFCNT_dec (overlay_av);
+  overlay_av = 0;
+
+  THIS->want_refresh = 1;
 }
 
 void overlay::swap ()
@@ -1611,8 +1613,8 @@ rxvt_term::cur_charset ()
        OUTPUT:
         RETVAL
 
-#void
-#rxvt_term::selection_clear ()
+void
+rxvt_term::selection_clear ()
 
 void
 rxvt_term::selection_make (Time eventtime, bool rect = false)