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) = @_;
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");
}
});
#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 ();
};
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)
{
}
show ();
- THIS->want_refresh = 1;
}
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 ()
OUTPUT:
RETVAL
-#void
-#rxvt_term::selection_clear ()
+void
+rxvt_term::selection_clear ()
void
rxvt_term::selection_make (Time eventtime, bool rect = false)