… | |
… | |
431 | perl = 0; |
431 | perl = 0; |
432 | } |
432 | } |
433 | } |
433 | } |
434 | } |
434 | } |
435 | |
435 | |
|
|
436 | static void |
|
|
437 | ungrab (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 | |
436 | bool |
447 | bool |
437 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
448 | rxvt_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); |
… | |
… | |
693 | void |
707 | void |
694 | fatal (const char *msg) |
708 | fatal (const char *msg) |
695 | CODE: |
709 | CODE: |
696 | rxvt_fatal ("%s", msg); |
710 | rxvt_fatal ("%s", msg); |
697 | |
711 | |
|
|
712 | SV * |
|
|
713 | untaint (SV *sv) |
|
|
714 | CODE: |
|
|
715 | RETVAL = newSVsv (sv); |
|
|
716 | SvTAINTED_off (RETVAL); |
|
|
717 | OUTPUT: |
|
|
718 | RETVAL |
|
|
719 | |
|
|
720 | bool |
|
|
721 | safe () |
|
|
722 | CODE: |
|
|
723 | RETVAL = !rxvt_tainted (); |
|
|
724 | OUTPUT: |
|
|
725 | RETVAL |
|
|
726 | |
698 | NV |
727 | NV |
699 | NOW () |
728 | NOW () |
700 | CODE: |
729 | CODE: |
701 | RETVAL = NOW; |
730 | RETVAL = NOW; |
702 | OUTPUT: |
731 | OUTPUT: |
… | |
… | |
800 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
829 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
801 | |
830 | |
802 | void |
831 | void |
803 | rxvt_term::ungrab () |
832 | rxvt_term::ungrab () |
804 | CODE: |
833 | CODE: |
805 | { |
834 | 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 | |
835 | |
814 | int |
836 | int |
815 | rxvt_term::strwidth (SV *str) |
837 | rxvt_term::strwidth (SV *str) |
816 | CODE: |
838 | CODE: |
817 | { |
839 | { |
… | |
… | |
910 | case 2: RETVAL = THIS->ModNumLockMask; break; |
932 | case 2: RETVAL = THIS->ModNumLockMask; break; |
911 | } |
933 | } |
912 | OUTPUT: |
934 | OUTPUT: |
913 | RETVAL |
935 | RETVAL |
914 | |
936 | |
|
|
937 | char * |
|
|
938 | rxvt_term::display_id () |
|
|
939 | CODE: |
|
|
940 | RETVAL = THIS->display->id; |
|
|
941 | OUTPUT: |
|
|
942 | RETVAL |
|
|
943 | |
915 | U32 |
944 | U32 |
916 | rxvt_term::parent () |
945 | rxvt_term::parent () |
917 | CODE: |
946 | CODE: |
918 | RETVAL = (U32)THIS->parent [0]; |
947 | RETVAL = (U32)THIS->parent [0]; |
919 | OUTPUT: |
948 | OUTPUT: |
… | |
… | |
1221 | } |
1250 | } |
1222 | OUTPUT: |
1251 | OUTPUT: |
1223 | RETVAL |
1252 | RETVAL |
1224 | |
1253 | |
1225 | void |
1254 | void |
1226 | rxvt_term::cur (...) |
1255 | rxvt_term::screen_cur (...) |
1227 | PROTOTYPE: $;$$ |
1256 | PROTOTYPE: $;$$ |
1228 | ALIAS: |
1257 | ALIAS: |
1229 | screen_cur = 0 |
1258 | screen_cur = 0 |
1230 | selection_beg = 1 |
1259 | selection_beg = 1 |
1231 | selection_end = 2 |
1260 | selection_end = 2 |
… | |
… | |
1260 | void |
1289 | void |
1261 | rxvt_term::selection (SV *newtext = 0) |
1290 | rxvt_term::selection (SV *newtext = 0) |
1262 | PPCODE: |
1291 | PPCODE: |
1263 | { |
1292 | { |
1264 | if (GIMME_V != G_VOID) |
1293 | if (GIMME_V != G_VOID) |
|
|
1294 | XPUSHs (THIS->selection.text |
1265 | XPUSHs (taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)))); |
1295 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
|
|
1296 | : &PL_sv_undef); |
1266 | |
1297 | |
1267 | if (newtext) |
1298 | if (newtext) |
1268 | { |
1299 | { |
1269 | free (THIS->selection.text); |
1300 | free (THIS->selection.text); |
1270 | |
1301 | |