From 2a41e4e40b36b4dec38fe57665910a1b9bbb8e87 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Jan 2006 11:56:00 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 1 + src/iom.C | 2 +- src/iom.h | 2 +- src/iom_conf.h | 2 +- src/rxvtperl.xs | 73 ++++++++++++++++++++++++++++--------------------- 5 files changed, 46 insertions(+), 34 deletions(-) diff --git a/Changes b/Changes index 2596d87a..989d065c 100644 --- 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 diff --git a/src/iom.C b/src/iom.C index e42dee86..fd35d2e7 100644 --- a/src/iom.C +++ b/src/iom.C @@ -1,6 +1,6 @@ /* iom.C -- generic I/O multiplexer - Copyright (C) 2003, 2004 Marc Lehmann + Copyright (C) 2003-2006 Marc Lehmann This file is part of GVPE. diff --git a/src/iom.h b/src/iom.h index 42c76318..4108145e 100644 --- a/src/iom.h +++ b/src/iom.h @@ -1,6 +1,6 @@ /* iom.h -- generic I/O multiplexer - Copyright (C) 2003, 2004 Marc Lehmann + Copyright (C) 2003-2006 Marc Lehmann This file is part of GVPE. diff --git a/src/iom_conf.h b/src/iom_conf.h index be08fc62..3729950c 100644 --- a/src/iom_conf.h +++ b/src/iom_conf.h @@ -1,6 +1,6 @@ /* iom_conf.h -- generic I/O multiplexer config - Copyright (C) 2003, 2004 Marc Lehmann + Copyright (C) 2003-2006 Marc Lehmann 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 diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 9266a9d3..1cb860dc 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -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"); -- 2.34.1