… | |
… | |
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: |
… | |
… | |
782 | } |
811 | } |
783 | OUTPUT: |
812 | OUTPUT: |
784 | RETVAL |
813 | RETVAL |
785 | |
814 | |
786 | void |
815 | void |
787 | rxvt_term::allow_events_async (U32 eventtime = THIS->perl.grabtime) |
816 | rxvt_term::allow_events_async () |
788 | CODE: |
817 | CODE: |
789 | XAllowEvents (THIS->display->display, AsyncBoth, eventtime); |
818 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
790 | |
819 | |
791 | void |
820 | void |
792 | rxvt_term::allow_events_sync (U32 eventtime = THIS->perl.grabtime) |
821 | rxvt_term::allow_events_sync () |
793 | CODE: |
822 | CODE: |
794 | XAllowEvents (THIS->display->display, SyncBoth, eventtime); |
823 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
795 | |
824 | |
796 | void |
825 | void |
797 | rxvt_term::allow_events_replay (U32 eventtime = THIS->perl.grabtime) |
826 | rxvt_term::allow_events_replay () |
798 | CODE: |
827 | CODE: |
799 | XAllowEvents (THIS->display->display, ReplayPointer, eventtime); |
828 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
800 | XAllowEvents (THIS->display->display, ReplayKeyboard, eventtime); |
829 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
801 | |
830 | |
802 | void |
831 | void |
803 | rxvt_term::ungrab (U32 eventtime = THIS->perl.grabtime) |
832 | rxvt_term::ungrab () |
804 | CODE: |
833 | CODE: |
805 | THIS->perl.grabtime = 0; |
834 | ungrab (THIS); |
806 | XUngrabKeyboard (THIS->display->display, eventtime); |
|
|
807 | XUngrabPointer (THIS->display->display, eventtime); |
|
|
808 | |
835 | |
809 | int |
836 | int |
810 | rxvt_term::strwidth (SV *str) |
837 | rxvt_term::strwidth (SV *str) |
811 | CODE: |
838 | CODE: |
812 | { |
839 | { |
… | |
… | |
1216 | } |
1243 | } |
1217 | OUTPUT: |
1244 | OUTPUT: |
1218 | RETVAL |
1245 | RETVAL |
1219 | |
1246 | |
1220 | void |
1247 | void |
1221 | rxvt_term::cur (...) |
1248 | rxvt_term::screen_cur (...) |
1222 | PROTOTYPE: $;$$ |
1249 | PROTOTYPE: $;$$ |
1223 | ALIAS: |
1250 | ALIAS: |
1224 | screen_cur = 0 |
1251 | screen_cur = 0 |
1225 | selection_beg = 1 |
1252 | selection_beg = 1 |
1226 | selection_end = 2 |
1253 | selection_end = 2 |
… | |
… | |
1255 | void |
1282 | void |
1256 | rxvt_term::selection (SV *newtext = 0) |
1283 | rxvt_term::selection (SV *newtext = 0) |
1257 | PPCODE: |
1284 | PPCODE: |
1258 | { |
1285 | { |
1259 | if (GIMME_V != G_VOID) |
1286 | if (GIMME_V != G_VOID) |
|
|
1287 | XPUSHs (THIS->selection.text |
1260 | XPUSHs (taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)))); |
1288 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
|
|
1289 | : &PL_sv_undef); |
1261 | |
1290 | |
1262 | if (newtext) |
1291 | if (newtext) |
1263 | { |
1292 | { |
1264 | free (THIS->selection.text); |
1293 | free (THIS->selection.text); |
1265 | |
1294 | |