--- rxvt-unicode/src/rxvtperl.xs 2011/02/21 07:41:03 1.137 +++ rxvt-unicode/src/rxvtperl.xs 2011/05/30 18:39:03 1.141 @@ -343,7 +343,7 @@ "" "use urxvt;" }; - int argc = ARRAY_LENGTH(args); + int argc = ecb_array_length (args); char **argv = args; PERL_SYS_INIT3 (&argc, &argv, &environ); @@ -415,8 +415,9 @@ PUSHMARK (SP); - XPUSHs (sv_2mortal (newSVterm (term))); - XPUSHs (sv_2mortal (newSViv (htype))); + EXTEND (SP, 2); + PUSHs (sv_2mortal (newSVterm (term))); + PUSHs (sv_2mortal (newSViv (htype))); for (;;) { data_type dt = (data_type)va_arg (ap, int); @@ -583,7 +584,7 @@ if (SvTRUE (ERRSV)) { - rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); + rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPVbyte_nolen (ERRSV)); ungrab (term); // better lose the grab than the session } @@ -612,6 +613,25 @@ return event_consumed; } +void +rxvt_perl_interp::selection_finish (rxvt_selection *sel, char *data, unsigned int len) +{ + localise_env set_environ (perl_environ); + + ENTER; + SAVETMPS; + + dSP; + XPUSHs (sv_2mortal (newSVpvn (data, len))); + call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL); + + if (SvTRUE (ERRSV)) + rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV)); + + FREETMPS; + LEAVE; +} + ///////////////////////////////////////////////////////////////////////////// MODULE = urxvt PACKAGE = urxvt @@ -770,7 +790,7 @@ # endif }; - for (civ = const_iv + ARRAY_LENGTH(const_iv); civ-- > const_iv; ) + for (civ = const_iv + ecb_array_length (const_iv); civ-- > const_iv; ) newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); } @@ -853,6 +873,21 @@ PUSHs (sv_2mortal (newSVterm (*t))); } +IV +_new_selection_request (rxvt_term *term, int selnum, Time tm, Window win, Atom prop, SV *cb) + CODE: + rxvt_selection *req = new rxvt_selection (term->display, selnum, tm, win, prop, term); + req->cb_sv = newSVsv (cb); + RETVAL = (IV)req; + OUTPUT: + RETVAL + +void +_delete_selection_request (IV req_) + CODE: + rxvt_selection *req = (rxvt_selection *)req_; + delete req; + MODULE = urxvt PACKAGE = urxvt::term SV * @@ -1169,7 +1204,7 @@ Window rxvt_term::parent () CODE: - RETVAL = THIS->parent [0]; + RETVAL = THIS->parent; OUTPUT: RETVAL @@ -1448,7 +1483,7 @@ # undef reserve }; - rs = rslist + ARRAY_LENGTH(rslist); + rs = rslist + ecb_array_length (rslist); if (*name) {