ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtperl.xs
(Generate patch)

Comparing rxvt-unicode/src/rxvtperl.xs (file contents):
Revision 1.44 by root, Sun Jan 8 22:58:13 2006 UTC vs.
Revision 1.45 by root, Mon Jan 9 00:34:36 2006 UTC

431 perl = 0; 431 perl = 0;
432 } 432 }
433 } 433 }
434} 434}
435 435
436static void
437ungrab (rxvt_term *THIS)
438{
439 if (THIS->perl.grabtime)
440 {
441 XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime);
442 XUngrabPointer (THIS->display->display, THIS->perl.grabtime);
443 THIS->perl.grabtime = 0;
444 }
445}
446
436bool 447bool
437rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) 448rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
438{ 449{
439 if (!perl) 450 if (!perl)
440 return false; 451 return false;
582 PUTBACK; 593 PUTBACK;
583 FREETMPS; 594 FREETMPS;
584 LEAVE; 595 LEAVE;
585 596
586 if (SvTRUE (ERRSV)) 597 if (SvTRUE (ERRSV))
598 {
587 rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); 599 rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV));
600 ungrab (term); // better lose the grab than the session
601 }
588 602
589 if (htype == HOOK_DESTROY) 603 if (htype == HOOK_DESTROY)
590 { 604 {
591 clearSVptr ((SV *)term->perl.self); 605 clearSVptr ((SV *)term->perl.self);
592 SvREFCNT_dec ((SV *)term->perl.self); 606 SvREFCNT_dec ((SV *)term->perl.self);
693void 707void
694fatal (const char *msg) 708fatal (const char *msg)
695 CODE: 709 CODE:
696 rxvt_fatal ("%s", msg); 710 rxvt_fatal ("%s", msg);
697 711
712SV *
713untaint (SV *sv)
714 CODE:
715 RETVAL = newSVsv (sv);
716 SvTAINTED_off (RETVAL);
717 OUTPUT:
718 RETVAL
719
698NV 720NV
699NOW () 721NOW ()
700 CODE: 722 CODE:
701 RETVAL = NOW; 723 RETVAL = NOW;
702 OUTPUT: 724 OUTPUT:
800 XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); 822 XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime);
801 823
802void 824void
803rxvt_term::ungrab () 825rxvt_term::ungrab ()
804 CODE: 826 CODE:
805{ 827 ungrab (THIS);
806 if (THIS->perl.grabtime)
807 {
808 XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime);
809 XUngrabPointer (THIS->display->display, THIS->perl.grabtime);
810 THIS->perl.grabtime = 0;
811 }
812}
813 828
814int 829int
815rxvt_term::strwidth (SV *str) 830rxvt_term::strwidth (SV *str)
816 CODE: 831 CODE:
817{ 832{
1260void 1275void
1261rxvt_term::selection (SV *newtext = 0) 1276rxvt_term::selection (SV *newtext = 0)
1262 PPCODE: 1277 PPCODE:
1263{ 1278{
1264 if (GIMME_V != G_VOID) 1279 if (GIMME_V != G_VOID)
1280 XPUSHs (THIS->selection.text
1265 XPUSHs (taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)))); 1281 ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)))
1282 : &PL_sv_undef);
1266 1283
1267 if (newtext) 1284 if (newtext)
1268 { 1285 {
1269 free (THIS->selection.text); 1286 free (THIS->selection.text);
1270 1287

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines