… | |
… | |
29 | #include "../config.h" |
29 | #include "../config.h" |
30 | |
30 | |
31 | #include <cstddef> |
31 | #include <cstddef> |
32 | #include <cstdarg> |
32 | #include <cstdarg> |
33 | |
33 | |
|
|
34 | #include "iom.h" |
34 | #include "rxvt.h" |
35 | #include "rxvt.h" |
35 | #include "iom.h" |
36 | #include "keyboard.h" |
36 | #include "rxvtutil.h" |
37 | #include "rxvtutil.h" |
37 | #include "rxvtperl.h" |
38 | #include "rxvtperl.h" |
38 | |
39 | |
39 | #include "perlxsi.c" |
40 | #include "perlxsi.c" |
|
|
41 | |
|
|
42 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
|
|
43 | # define GRAB_CURSOR THIS->leftptr_cursor |
|
|
44 | #else |
|
|
45 | # define GRAB_CURSOR None |
|
|
46 | #endif |
40 | |
47 | |
41 | #undef LINENO |
48 | #undef LINENO |
42 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
49 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
43 | #undef ROW |
50 | #undef ROW |
44 | #define ROW(n) THIS->row_buf [LINENO (n)] |
51 | #define ROW(n) THIS->row_buf [LINENO (n)] |
45 | |
52 | |
46 | ///////////////////////////////////////////////////////////////////////////// |
53 | ///////////////////////////////////////////////////////////////////////////// |
|
|
54 | |
|
|
55 | static SV * |
|
|
56 | taint (SV *sv) |
|
|
57 | { |
|
|
58 | SvTAINT (sv); |
|
|
59 | return sv; |
|
|
60 | } |
|
|
61 | |
|
|
62 | static SV * |
|
|
63 | taint_if (SV *sv, SV *src) |
|
|
64 | { |
|
|
65 | if (SvTAINTED (src)) |
|
|
66 | SvTAINT (sv); |
|
|
67 | |
|
|
68 | return sv; |
|
|
69 | } |
47 | |
70 | |
48 | static wchar_t * |
71 | static wchar_t * |
49 | sv2wcs (SV *sv) |
72 | sv2wcs (SV *sv) |
50 | { |
73 | { |
51 | STRLEN len; |
74 | STRLEN len; |
… | |
… | |
390 | { |
413 | { |
391 | if (!perl) |
414 | if (!perl) |
392 | { |
415 | { |
393 | char *argv[] = { |
416 | char *argv[] = { |
394 | "", |
417 | "", |
|
|
418 | "-T", |
395 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
419 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
396 | }; |
420 | }; |
397 | |
421 | |
398 | perl = perl_alloc (); |
422 | perl = perl_alloc (); |
399 | perl_construct (perl); |
423 | perl_construct (perl); |
400 | |
424 | |
401 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
425 | if (perl_parse (perl, xs_init, 3, argv, (char **)NULL) |
402 | || perl_run (perl)) |
426 | || perl_run (perl)) |
403 | { |
427 | { |
404 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
428 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
405 | |
429 | |
406 | perl_destruct (perl); |
430 | perl_destruct (perl); |
407 | perl_free (perl); |
431 | perl_free (perl); |
408 | perl = 0; |
432 | perl = 0; |
409 | } |
433 | } |
|
|
434 | } |
|
|
435 | } |
|
|
436 | |
|
|
437 | static void |
|
|
438 | ungrab (rxvt_term *THIS) |
|
|
439 | { |
|
|
440 | if (THIS->perl.grabtime) |
|
|
441 | { |
|
|
442 | XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); |
|
|
443 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
|
|
444 | THIS->perl.grabtime = 0; |
410 | } |
445 | } |
411 | } |
446 | } |
412 | |
447 | |
413 | bool |
448 | bool |
414 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
449 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
… | |
… | |
425 | return false; // perl not initialized for this instance |
460 | return false; // perl not initialized for this instance |
426 | else if (htype == HOOK_DESTROY) |
461 | else if (htype == HOOK_DESTROY) |
427 | { |
462 | { |
428 | // handled later |
463 | // handled later |
429 | } |
464 | } |
430 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
465 | else |
431 | { |
466 | { |
432 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
467 | if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
433 | |
|
|
434 | if (HvKEYS (hv)) |
|
|
435 | { |
468 | { |
|
|
469 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
|
|
470 | |
|
|
471 | if (HvKEYS (hv)) |
|
|
472 | { |
436 | hv_iterinit (hv); |
473 | hv_iterinit (hv); |
437 | |
474 | |
438 | while (HE *he = hv_iternext (hv)) |
475 | while (HE *he = hv_iternext (hv)) |
439 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
476 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
477 | } |
|
|
478 | |
440 | } |
479 | } |
|
|
480 | |
|
|
481 | if (!should_invoke [htype]) |
|
|
482 | return false; |
441 | } |
483 | } |
442 | else if (!should_invoke [htype]) |
|
|
443 | return false; |
|
|
444 | |
484 | |
445 | dSP; |
485 | dSP; |
446 | va_list ap; |
486 | va_list ap; |
447 | |
487 | |
448 | va_start (ap, htype); |
488 | va_start (ap, htype); |
… | |
… | |
467 | case DT_LONG: |
507 | case DT_LONG: |
468 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
508 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
469 | break; |
509 | break; |
470 | |
510 | |
471 | case DT_STR: |
511 | case DT_STR: |
472 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
512 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
473 | break; |
513 | break; |
474 | |
514 | |
475 | case DT_STR_LEN: |
515 | case DT_STR_LEN: |
476 | { |
516 | { |
477 | char *str = va_arg (ap, char *); |
517 | char *str = va_arg (ap, char *); |
478 | int len = va_arg (ap, int); |
518 | int len = va_arg (ap, int); |
479 | |
519 | |
480 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
520 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
481 | } |
521 | } |
482 | break; |
522 | break; |
483 | |
523 | |
484 | case DT_WCS_LEN: |
524 | case DT_WCS_LEN: |
485 | { |
525 | { |
486 | wchar_t *wstr = va_arg (ap, wchar_t *); |
526 | wchar_t *wstr = va_arg (ap, wchar_t *); |
487 | int wlen = va_arg (ap, int); |
527 | int wlen = va_arg (ap, int); |
488 | |
528 | |
489 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
529 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
490 | } |
530 | } |
491 | break; |
531 | break; |
492 | |
532 | |
493 | case DT_XEVENT: |
533 | case DT_XEVENT: |
494 | { |
534 | { |
… | |
… | |
559 | PUTBACK; |
599 | PUTBACK; |
560 | FREETMPS; |
600 | FREETMPS; |
561 | LEAVE; |
601 | LEAVE; |
562 | |
602 | |
563 | if (SvTRUE (ERRSV)) |
603 | if (SvTRUE (ERRSV)) |
|
|
604 | { |
564 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
605 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
606 | ungrab (term); // better lose the grab than the session |
|
|
607 | } |
565 | |
608 | |
566 | if (htype == HOOK_DESTROY) |
609 | if (htype == HOOK_DESTROY) |
567 | { |
610 | { |
568 | clearSVptr ((SV *)term->perl.self); |
611 | clearSVptr ((SV *)term->perl.self); |
569 | SvREFCNT_dec ((SV *)term->perl.self); |
612 | SvREFCNT_dec ((SV *)term->perl.self); |
… | |
… | |
584 | |
627 | |
585 | PROTOTYPES: ENABLE |
628 | PROTOTYPES: ENABLE |
586 | |
629 | |
587 | BOOT: |
630 | BOOT: |
588 | { |
631 | { |
589 | HV *stash = gv_stashpv ("urxvt", 1); |
632 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
590 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
633 | sv_setsv (get_sv ("urxvt::RESNAME", 1), newSVpvn (RESNAME, sizeof (RESNAME) - 1)); |
|
|
634 | sv_setsv (get_sv ("urxvt::RESCLASS", 1), newSVpvn (RESCLASS, sizeof (RESCLASS) - 1)); |
|
|
635 | sv_setsv (get_sv ("urxvt::RXVTNAME", 1), newSVpvn (RXVTNAME, sizeof (RXVTNAME) - 1)); |
591 | |
636 | |
592 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
637 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
593 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
638 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
594 | # include "hookinc.h" |
639 | # include "hookinc.h" |
595 | # undef def |
640 | # undef def |
596 | |
641 | |
597 | |
642 | HV *option = get_hv ("urxvt::OPTION", 1); |
|
|
643 | # define def(name,val) hv_store (option, # name, sizeof (# name) - 1, newSVuv (Opt_ ## name), 0); |
|
|
644 | # define nodef(name) |
|
|
645 | # include "optinc.h" |
|
|
646 | # undef nodef |
|
|
647 | # undef def |
|
|
648 | |
|
|
649 | HV *stash = gv_stashpv ("urxvt", 1); |
|
|
650 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
598 | export_const_iv (DEFAULT_RSTYLE); |
651 | export_const_iv (DEFAULT_RSTYLE); |
599 | export_const_iv (OVERLAY_RSTYLE); |
652 | export_const_iv (OVERLAY_RSTYLE); |
600 | export_const_iv (RS_Bold); |
653 | export_const_iv (RS_Bold); |
601 | export_const_iv (RS_Italic); |
654 | export_const_iv (RS_Italic); |
602 | export_const_iv (RS_Blink); |
655 | export_const_iv (RS_Blink); |
… | |
… | |
617 | export_const_iv (Button3Mask); |
670 | export_const_iv (Button3Mask); |
618 | export_const_iv (Button4Mask); |
671 | export_const_iv (Button4Mask); |
619 | export_const_iv (Button5Mask); |
672 | export_const_iv (Button5Mask); |
620 | export_const_iv (AnyModifier); |
673 | export_const_iv (AnyModifier); |
621 | |
674 | |
622 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
675 | export_const_iv (EVENT_NONE); |
|
|
676 | export_const_iv (EVENT_READ); |
|
|
677 | export_const_iv (EVENT_WRITE); |
623 | } |
678 | } |
624 | |
679 | |
625 | SV * |
680 | SV * |
626 | new (...) |
681 | new (...) |
627 | CODE: |
682 | CODE: |
… | |
… | |
665 | void |
720 | void |
666 | fatal (const char *msg) |
721 | fatal (const char *msg) |
667 | CODE: |
722 | CODE: |
668 | rxvt_fatal ("%s", msg); |
723 | rxvt_fatal ("%s", msg); |
669 | |
724 | |
|
|
725 | SV * |
|
|
726 | untaint (SV *sv) |
|
|
727 | CODE: |
|
|
728 | RETVAL = newSVsv (sv); |
|
|
729 | SvTAINTED_off (RETVAL); |
|
|
730 | OUTPUT: |
|
|
731 | RETVAL |
|
|
732 | |
|
|
733 | bool |
|
|
734 | safe () |
|
|
735 | CODE: |
|
|
736 | RETVAL = !rxvt_tainted (); |
|
|
737 | OUTPUT: |
|
|
738 | RETVAL |
|
|
739 | |
670 | NV |
740 | NV |
671 | NOW () |
741 | NOW () |
672 | CODE: |
742 | CODE: |
673 | RETVAL = NOW; |
743 | RETVAL = NOW; |
674 | OUTPUT: |
744 | OUTPUT: |
… | |
… | |
730 | void |
800 | void |
731 | rxvt_term::grab_button (int button, U32 modifiers) |
801 | rxvt_term::grab_button (int button, U32 modifiers) |
732 | CODE: |
802 | CODE: |
733 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
803 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
734 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
804 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
735 | GrabModeSync, GrabModeSync, None, None); |
805 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
736 | |
806 | |
737 | bool |
807 | bool |
738 | rxvt_term::grab (U32 eventtime, int sync = 0) |
808 | rxvt_term::grab (U32 eventtime, int sync = 0) |
739 | CODE: |
809 | CODE: |
740 | { |
810 | { |
… | |
… | |
742 | |
812 | |
743 | THIS->perl.grabtime = 0; |
813 | THIS->perl.grabtime = 0; |
744 | |
814 | |
745 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
815 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
746 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
816 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
747 | mode, mode, None, None, eventtime)) |
817 | mode, mode, None, GRAB_CURSOR, eventtime)) |
748 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
818 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
749 | THIS->perl.grabtime = eventtime; |
819 | THIS->perl.grabtime = eventtime; |
750 | else |
820 | else |
751 | XUngrabPointer (THIS->display->display, eventtime); |
821 | XUngrabPointer (THIS->display->display, eventtime); |
752 | |
822 | |
… | |
… | |
754 | } |
824 | } |
755 | OUTPUT: |
825 | OUTPUT: |
756 | RETVAL |
826 | RETVAL |
757 | |
827 | |
758 | void |
828 | void |
759 | rxvt_term::allow_events_async (U32 eventtime = THIS->perl.grabtime) |
829 | rxvt_term::allow_events_async () |
760 | CODE: |
830 | CODE: |
761 | XAllowEvents (THIS->display->display, AsyncBoth, eventtime); |
831 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
762 | |
832 | |
763 | void |
833 | void |
764 | rxvt_term::allow_events_sync (U32 eventtime = THIS->perl.grabtime) |
834 | rxvt_term::allow_events_sync () |
765 | CODE: |
835 | CODE: |
766 | XAllowEvents (THIS->display->display, SyncBoth, eventtime); |
836 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
767 | |
837 | |
768 | void |
838 | void |
769 | rxvt_term::allow_events_replay (U32 eventtime = THIS->perl.grabtime) |
839 | rxvt_term::allow_events_replay () |
770 | CODE: |
840 | CODE: |
771 | XAllowEvents (THIS->display->display, ReplayPointer, eventtime); |
841 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
772 | XAllowEvents (THIS->display->display, ReplayKeyboard, eventtime); |
842 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
773 | |
843 | |
774 | void |
844 | void |
775 | rxvt_term::ungrab (U32 eventtime = THIS->perl.grabtime) |
845 | rxvt_term::ungrab () |
776 | CODE: |
846 | CODE: |
777 | THIS->perl.grabtime = 0; |
847 | ungrab (THIS); |
778 | XUngrabKeyboard (THIS->display->display, eventtime); |
|
|
779 | XUngrabPointer (THIS->display->display, eventtime); |
|
|
780 | |
848 | |
781 | int |
849 | int |
782 | rxvt_term::strwidth (SV *str) |
850 | rxvt_term::strwidth (SV *str) |
783 | CODE: |
851 | CODE: |
784 | { |
852 | { |
… | |
… | |
803 | char *mbstr = rxvt_wcstombs (wstr); |
871 | char *mbstr = rxvt_wcstombs (wstr); |
804 | rxvt_pop_locale (); |
872 | rxvt_pop_locale (); |
805 | |
873 | |
806 | free (wstr); |
874 | free (wstr); |
807 | |
875 | |
808 | RETVAL = newSVpv (mbstr, 0); |
876 | RETVAL = taint_if (newSVpv (mbstr, 0), str); |
809 | free (mbstr); |
877 | free (mbstr); |
810 | } |
878 | } |
811 | OUTPUT: |
879 | OUTPUT: |
812 | RETVAL |
880 | RETVAL |
813 | |
881 | |
… | |
… | |
820 | |
888 | |
821 | rxvt_push_locale (THIS->locale); |
889 | rxvt_push_locale (THIS->locale); |
822 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
890 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
823 | rxvt_pop_locale (); |
891 | rxvt_pop_locale (); |
824 | |
892 | |
825 | RETVAL = wcs2sv (wstr); |
893 | RETVAL = taint_if (wcs2sv (wstr), octets); |
826 | free (wstr); |
894 | free (wstr); |
827 | } |
895 | } |
828 | OUTPUT: |
896 | OUTPUT: |
829 | RETVAL |
897 | RETVAL |
830 | |
898 | |
… | |
… | |
877 | case 2: RETVAL = THIS->ModNumLockMask; break; |
945 | case 2: RETVAL = THIS->ModNumLockMask; break; |
878 | } |
946 | } |
879 | OUTPUT: |
947 | OUTPUT: |
880 | RETVAL |
948 | RETVAL |
881 | |
949 | |
|
|
950 | char * |
|
|
951 | rxvt_term::display_id () |
|
|
952 | ALIAS: |
|
|
953 | display_id = 0 |
|
|
954 | locale = 1 |
|
|
955 | CODE: |
|
|
956 | switch (ix) |
|
|
957 | { |
|
|
958 | case 0: RETVAL = THIS->display->id; break; |
|
|
959 | case 1: RETVAL = THIS->locale; break; |
|
|
960 | } |
|
|
961 | OUTPUT: |
|
|
962 | RETVAL |
|
|
963 | |
|
|
964 | int |
|
|
965 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
|
|
966 | CODE: |
|
|
967 | RETVAL = THIS->pty_ev.events; |
|
|
968 | if (events != EVENT_UNDEF) |
|
|
969 | THIS->pty_ev.set (events); |
|
|
970 | OUTPUT: |
|
|
971 | RETVAL |
|
|
972 | |
882 | U32 |
973 | U32 |
883 | rxvt_term::parent () |
974 | rxvt_term::parent () |
884 | CODE: |
975 | CODE: |
885 | RETVAL = (U32)THIS->parent [0]; |
976 | RETVAL = (U32)THIS->parent [0]; |
886 | OUTPUT: |
977 | OUTPUT: |
… | |
… | |
937 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1028 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
938 | |
1029 | |
939 | for (int col = 0; col < THIS->ncol; col++) |
1030 | for (int col = 0; col < THIS->ncol; col++) |
940 | wstr [col] = l.t [col]; |
1031 | wstr [col] = l.t [col]; |
941 | |
1032 | |
942 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1033 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol)))); |
943 | |
1034 | |
944 | delete [] wstr; |
1035 | delete [] wstr; |
945 | } |
1036 | } |
946 | |
1037 | |
947 | if (new_text) |
1038 | if (new_text) |
… | |
… | |
1068 | else |
1159 | else |
1069 | *r++ = *s; |
1160 | *r++ = *s; |
1070 | |
1161 | |
1071 | rxvt_pop_locale (); |
1162 | rxvt_pop_locale (); |
1072 | |
1163 | |
1073 | RETVAL = wcs2sv (rstr, r - rstr); |
1164 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), string); |
1074 | |
1165 | |
1075 | delete [] rstr; |
1166 | delete [] rstr; |
1076 | } |
1167 | } |
1077 | OUTPUT: |
1168 | OUTPUT: |
1078 | RETVAL |
1169 | RETVAL |
… | |
… | |
1104 | else if (IS_COMPOSE (*s)) |
1195 | else if (IS_COMPOSE (*s)) |
1105 | r += rxvt_composite.expand (*s, r); |
1196 | r += rxvt_composite.expand (*s, r); |
1106 | else |
1197 | else |
1107 | *r++ = *s; |
1198 | *r++ = *s; |
1108 | |
1199 | |
1109 | RETVAL = wcs2sv (rstr, r - rstr); |
1200 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), text); |
1110 | |
1201 | |
1111 | delete [] rstr; |
1202 | delete [] rstr; |
1112 | } |
1203 | } |
1113 | OUTPUT: |
1204 | OUTPUT: |
1114 | RETVAL |
1205 | RETVAL |
… | |
… | |
1136 | |
1227 | |
1137 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1228 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1138 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1229 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1139 | |
1230 | |
1140 | if (GIMME_V != G_VOID) |
1231 | if (GIMME_V != G_VOID) |
1141 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
1232 | XPUSHs (THIS->rs [index] ? sv_2mortal (taint (newSVpv (THIS->rs [index], 0))) : &PL_sv_undef); |
1142 | |
1233 | |
1143 | if (newval) |
1234 | if (newval) |
1144 | { |
1235 | { |
1145 | if (SvOK (newval)) |
1236 | if (SvOK (newval)) |
1146 | { |
1237 | { |
… | |
… | |
1151 | else |
1242 | else |
1152 | THIS->rs [index] = 0; |
1243 | THIS->rs [index] = 0; |
1153 | } |
1244 | } |
1154 | } |
1245 | } |
1155 | |
1246 | |
|
|
1247 | bool |
|
|
1248 | rxvt_term::option (U32 optval, int set = -1) |
|
|
1249 | CODE: |
|
|
1250 | { |
|
|
1251 | RETVAL = THIS->options & optval; |
|
|
1252 | |
|
|
1253 | if (set >= 0) |
|
|
1254 | { |
|
|
1255 | if (set) |
|
|
1256 | THIS->options |= optval; |
|
|
1257 | else |
|
|
1258 | THIS->options &= ~optval; |
|
|
1259 | |
|
|
1260 | switch (optval) |
|
|
1261 | { |
|
|
1262 | case Opt_skipBuiltinGlyphs: |
|
|
1263 | THIS->set_fonts (); |
|
|
1264 | THIS->scr_remap_chars (); |
|
|
1265 | THIS->scr_touch (true); |
|
|
1266 | THIS->want_refresh = 1; |
|
|
1267 | break; |
|
|
1268 | |
|
|
1269 | case Opt_cursorUnderline: |
|
|
1270 | THIS->want_refresh = 1; |
|
|
1271 | break; |
|
|
1272 | |
|
|
1273 | # case Opt_scrollBar_floating: |
|
|
1274 | # case Opt_scrollBar_right: |
|
|
1275 | # THIS->resize_all_windows (THIS->width, THIS->height, 1); |
|
|
1276 | # break; |
|
|
1277 | } |
|
|
1278 | } |
|
|
1279 | } |
|
|
1280 | OUTPUT: |
|
|
1281 | RETVAL |
|
|
1282 | |
|
|
1283 | bool |
|
|
1284 | rxvt_term::parse_keysym (char *keysym, char *str) |
|
|
1285 | CODE: |
|
|
1286 | RETVAL = 0 < THIS->parse_keysym (keysym, str); |
|
|
1287 | THIS->keyboard->register_done (); |
|
|
1288 | OUTPUT: |
|
|
1289 | RETVAL |
|
|
1290 | |
1156 | void |
1291 | void |
1157 | rxvt_term::cur (...) |
1292 | rxvt_term::screen_cur (...) |
1158 | PROTOTYPE: $;$$ |
1293 | PROTOTYPE: $;$$ |
1159 | ALIAS: |
1294 | ALIAS: |
1160 | screen_cur = 0 |
1295 | screen_cur = 0 |
1161 | selection_beg = 1 |
1296 | selection_beg = 1 |
1162 | selection_end = 2 |
1297 | selection_end = 2 |
… | |
… | |
1191 | void |
1326 | void |
1192 | rxvt_term::selection (SV *newtext = 0) |
1327 | rxvt_term::selection (SV *newtext = 0) |
1193 | PPCODE: |
1328 | PPCODE: |
1194 | { |
1329 | { |
1195 | if (GIMME_V != G_VOID) |
1330 | if (GIMME_V != G_VOID) |
|
|
1331 | XPUSHs (THIS->selection.text |
1196 | XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); |
1332 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
|
|
1333 | : &PL_sv_undef); |
1197 | |
1334 | |
1198 | if (newtext) |
1335 | if (newtext) |
1199 | { |
1336 | { |
1200 | free (THIS->selection.text); |
1337 | free (THIS->selection.text); |
1201 | |
1338 | |
1202 | THIS->selection.text = sv2wcs (newtext); |
1339 | THIS->selection.text = sv2wcs (newtext); |
1203 | THIS->selection.len = wcslen (THIS->selection.text); |
1340 | THIS->selection.len = wcslen (THIS->selection.text); |
1204 | } |
1341 | } |
1205 | } |
1342 | } |
|
|
1343 | |
|
|
1344 | void |
|
|
1345 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline) |
|
|
1346 | |
|
|
1347 | void |
|
|
1348 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
|
|
1349 | |
|
|
1350 | void |
|
|
1351 | rxvt_term::scr_bell () |
1206 | |
1352 | |
1207 | void |
1353 | void |
1208 | rxvt_term::scr_add_lines (SV *string) |
1354 | rxvt_term::scr_add_lines (SV *string) |
1209 | CODE: |
1355 | CODE: |
1210 | { |
1356 | { |