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.33 by root, Fri Jan 6 20:50:58 2006 UTC vs.
Revision 1.53 by root, Tue Jan 10 04:49:54 2006 UTC

26#include <XSUB.h> 26#include <XSUB.h>
27#undef line_t 27#undef line_t
28 28
29#include "../config.h" 29#include "../config.h"
30 30
31#include <cstddef>
31#include <cstdarg> 32#include <cstdarg>
32 33
34#include "iom.h"
33#include "rxvt.h" 35#include "rxvt.h"
34#include "iom.h" 36#include "keyboard.h"
35#include "rxvtutil.h" 37#include "rxvtutil.h"
36#include "rxvtperl.h" 38#include "rxvtperl.h"
37 39
38#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
39 47
40#undef LINENO 48#undef LINENO
41#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)
42#undef ROW 50#undef ROW
43#define ROW(n) THIS->row_buf [LINENO (n)] 51#define ROW(n) THIS->row_buf [LINENO (n)]
44 52
45///////////////////////////////////////////////////////////////////////////// 53/////////////////////////////////////////////////////////////////////////////
46 54
55static SV *
56taint (SV *sv)
57{
58 SvTAINT (sv);
59 return sv;
60}
61
62static SV *
63taint_if (SV *sv, SV *src)
64{
65 if (SvTAINTED (src))
66 SvTAINT (sv);
67
68 return sv;
69}
70
47static wchar_t * 71static wchar_t *
48sv2wcs (SV *sv) 72sv2wcs (SV *sv)
49{ 73{
50 STRLEN len; 74 STRLEN len;
51 char *str = SvPVutf8 (sv, len); 75 char *str = SvPVutf8 (sv, len);
101 croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); 125 croak ("perl code used %s object, but C++ object is already destroyed, caught", klass);
102 126
103 return (long)mg->mg_ptr; 127 return (long)mg->mg_ptr;
104} 128}
105 129
106#define newSVterm(term) SvREFCNT_inc ((SV *)term->self) 130#define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self)
107#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") 131#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term")
108 132
109///////////////////////////////////////////////////////////////////////////// 133/////////////////////////////////////////////////////////////////////////////
110 134
111struct perl_watcher 135struct perl_watcher
290void 314void
291overlay::show () 315overlay::show ()
292{ 316{
293 char key[33]; sprintf (key, "%32lx", (long)this); 317 char key[33]; sprintf (key, "%32lx", (long)this);
294 318
295 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0)); 319 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
296 hv_store (hv, key, 32, newSViv ((long)this), 0); 320 hv_store (hv, key, 32, newSViv ((long)this), 0);
297} 321}
298 322
299void 323void
300overlay::hide () 324overlay::hide ()
301{ 325{
302 SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0); 326 SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0);
303 327
304 if (ovs) 328 if (ovs)
305 { 329 {
306 char key[33]; sprintf (key, "%32lx", (long)this); 330 char key[33]; sprintf (key, "%32lx", (long)this);
307 331
389{ 413{
390 if (!perl) 414 if (!perl)
391 { 415 {
392 char *argv[] = { 416 char *argv[] = {
393 "", 417 "",
418 "-T",
394 "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", 419 "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1",
395 }; 420 };
396 421
397 perl = perl_alloc (); 422 perl = perl_alloc ();
398 perl_construct (perl); 423 perl_construct (perl);
399 424
400 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) 425 if (perl_parse (perl, xs_init, 3, argv, (char **)NULL)
401 || perl_run (perl)) 426 || perl_run (perl))
402 { 427 {
403 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); 428 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");
404 429
405 perl_destruct (perl); 430 perl_destruct (perl);
407 perl = 0; 432 perl = 0;
408 } 433 }
409 } 434 }
410} 435}
411 436
437static void
438ungrab (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;
445 }
446}
447
412bool 448bool
413rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) 449rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
414{ 450{
415 if (!perl) 451 if (!perl)
416 return false; 452 return false;
417 453
418 if (htype == HOOK_INIT) // first hook ever called 454 if (htype == HOOK_INIT) // first hook ever called
419 { 455 {
420 term->self = (void *)newSVptr ((void *)term, "urxvt::term"); 456 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
421 hv_store ((HV *)SvRV ((SV *)term->self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); 457 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0);
422 } 458 }
423 else if (!term->self) 459 else if (!term->perl.self)
424 return false; // perl not initialized for this instance 460 return false; // perl not initialized for this instance
425 else if (htype == HOOK_DESTROY) 461 else if (htype == HOOK_DESTROY)
426 { 462 {
427 // handled later 463 // handled later
428 } 464 }
429 else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) 465 else
430 { 466 {
431 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->self), "_overlay", 8, 0)); 467 if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END)
432
433 if (HvKEYS (hv))
434 { 468 {
469 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
470
471 if (HvKEYS (hv))
472 {
435 hv_iterinit (hv); 473 hv_iterinit (hv);
436 474
437 while (HE *he = hv_iternext (hv)) 475 while (HE *he = hv_iternext (hv))
438 ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); 476 ((overlay *)SvIV (hv_iterval (hv, he)))->swap ();
477 }
478
439 } 479 }
480
481 if (!should_invoke [htype])
482 return false;
440 } 483 }
441 else if (!should_invoke [htype])
442 return false;
443 484
444 dSP; 485 dSP;
445 va_list ap; 486 va_list ap;
446 487
447 va_start (ap, htype); 488 va_start (ap, htype);
466 case DT_LONG: 507 case DT_LONG:
467 XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); 508 XPUSHs (sv_2mortal (newSViv (va_arg (ap, long))));
468 break; 509 break;
469 510
470 case DT_STR: 511 case DT_STR:
471 XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); 512 XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0))));
472 break; 513 break;
473 514
474 case DT_STR_LEN: 515 case DT_STR_LEN:
475 { 516 {
476 char *str = va_arg (ap, char *); 517 char *str = va_arg (ap, char *);
477 int len = va_arg (ap, int); 518 int len = va_arg (ap, int);
478 519
479 XPUSHs (sv_2mortal (newSVpvn (str, len))); 520 XPUSHs (taint (sv_2mortal (newSVpvn (str, len))));
480 } 521 }
481 break; 522 break;
482 523
483 case DT_WCS_LEN: 524 case DT_WCS_LEN:
484 { 525 {
485 wchar_t *wstr = va_arg (ap, wchar_t *); 526 wchar_t *wstr = va_arg (ap, wchar_t *);
486 int wlen = va_arg (ap, int); 527 int wlen = va_arg (ap, int);
487 528
488 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); 529 XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen))));
489 } 530 }
531 break;
490 532
491 case DT_XEVENT: 533 case DT_XEVENT:
492 { 534 {
493 XEvent *xe = va_arg (ap, XEvent *); 535 XEvent *xe = va_arg (ap, XEvent *);
494 HV *hv = newHV (); 536 HV *hv = newHV ();
557 PUTBACK; 599 PUTBACK;
558 FREETMPS; 600 FREETMPS;
559 LEAVE; 601 LEAVE;
560 602
561 if (SvTRUE (ERRSV)) 603 if (SvTRUE (ERRSV))
604 {
562 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 }
563 608
564 if (htype == HOOK_DESTROY) 609 if (htype == HOOK_DESTROY)
565 { 610 {
566 clearSVptr ((SV *)term->self); 611 clearSVptr ((SV *)term->perl.self);
567 SvREFCNT_dec ((SV *)term->self); 612 SvREFCNT_dec ((SV *)term->perl.self);
568 } 613 }
569 614
570 return count; 615 return count;
571 } 616 }
572 617
582 627
583PROTOTYPES: ENABLE 628PROTOTYPES: ENABLE
584 629
585BOOT: 630BOOT:
586{ 631{
587# define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); 632 sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1));
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));
636
588 AV *hookname = get_av ("urxvt::HOOKNAME", 1); 637 AV *hookname = get_av ("urxvt::HOOKNAME", 1);
589# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); 638# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0));
590# include "hookinc.h" 639# include "hookinc.h"
591# undef def 640# undef def
592 641
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));
593 export_const (DEFAULT_RSTYLE); 651 export_const_iv (DEFAULT_RSTYLE);
594 export_const (OVERLAY_RSTYLE); 652 export_const_iv (OVERLAY_RSTYLE);
595 export_const (RS_Bold); 653 export_const_iv (RS_Bold);
596 export_const (RS_Italic); 654 export_const_iv (RS_Italic);
597 export_const (RS_Blink); 655 export_const_iv (RS_Blink);
598 export_const (RS_RVid); 656 export_const_iv (RS_RVid);
599 export_const (RS_Uline); 657 export_const_iv (RS_Uline);
600 658
601 sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); 659 export_const_iv (CurrentTime);
660 export_const_iv (ShiftMask);
661 export_const_iv (LockMask);
662 export_const_iv (ControlMask);
663 export_const_iv (Mod1Mask);
664 export_const_iv (Mod2Mask);
665 export_const_iv (Mod3Mask);
666 export_const_iv (Mod4Mask);
667 export_const_iv (Mod5Mask);
668 export_const_iv (Button1Mask);
669 export_const_iv (Button2Mask);
670 export_const_iv (Button3Mask);
671 export_const_iv (Button4Mask);
672 export_const_iv (Button5Mask);
673 export_const_iv (AnyModifier);
674
675 export_const_iv (EVENT_NONE);
676 export_const_iv (EVENT_READ);
677 export_const_iv (EVENT_WRITE);
602} 678}
603 679
604SV * 680SV *
605new (...) 681new (...)
606 CODE: 682 CODE:
624 { 700 {
625 term->destroy (); 701 term->destroy ();
626 croak ("exception caught while initializing new terminal instance"); 702 croak ("exception caught while initializing new terminal instance");
627 } 703 }
628 704
629 RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef; 705 RETVAL = term && term->perl.self ? newSVterm (term) : &PL_sv_undef;
630} 706}
631 OUTPUT: 707 OUTPUT:
632 RETVAL 708 RETVAL
633 709
634void 710void
643 719
644void 720void
645fatal (const char *msg) 721fatal (const char *msg)
646 CODE: 722 CODE:
647 rxvt_fatal ("%s", msg); 723 rxvt_fatal ("%s", msg);
724
725SV *
726untaint (SV *sv)
727 CODE:
728 RETVAL = newSVsv (sv);
729 SvTAINTED_off (RETVAL);
730 OUTPUT:
731 RETVAL
732
733bool
734safe ()
735 CODE:
736 RETVAL = !rxvt_tainted ();
737 OUTPUT:
738 RETVAL
648 739
649NV 740NV
650NOW () 741NOW ()
651 CODE: 742 CODE:
652 RETVAL = NOW; 743 RETVAL = NOW;
703 794
704MODULE = urxvt PACKAGE = urxvt::term 795MODULE = urxvt PACKAGE = urxvt::term
705 796
706void 797void
707rxvt_term::destroy () 798rxvt_term::destroy ()
799
800void
801rxvt_term::grab_button (int button, U32 modifiers)
802 CODE:
803 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
804 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
805 GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
806
807bool
808rxvt_term::grab (U32 eventtime, int sync = 0)
809 CODE:
810{
811 int mode = sync ? GrabModeSync : GrabModeAsync;
812
813 THIS->perl.grabtime = 0;
814
815 if (!XGrabPointer (THIS->display->display, THIS->vt, 0,
816 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
817 mode, mode, None, GRAB_CURSOR, eventtime))
818 if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime))
819 THIS->perl.grabtime = eventtime;
820 else
821 XUngrabPointer (THIS->display->display, eventtime);
822
823 RETVAL = !!THIS->perl.grabtime;
824}
825 OUTPUT:
826 RETVAL
827
828void
829rxvt_term::allow_events_async ()
830 CODE:
831 XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime);
832
833void
834rxvt_term::allow_events_sync ()
835 CODE:
836 XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime);
837
838void
839rxvt_term::allow_events_replay ()
840 CODE:
841 XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime);
842 XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime);
843
844void
845rxvt_term::ungrab ()
846 CODE:
847 ungrab (THIS);
708 848
709int 849int
710rxvt_term::strwidth (SV *str) 850rxvt_term::strwidth (SV *str)
711 CODE: 851 CODE:
712{ 852{
731 char *mbstr = rxvt_wcstombs (wstr); 871 char *mbstr = rxvt_wcstombs (wstr);
732 rxvt_pop_locale (); 872 rxvt_pop_locale ();
733 873
734 free (wstr); 874 free (wstr);
735 875
736 RETVAL = newSVpv (mbstr, 0); 876 RETVAL = taint_if (newSVpv (mbstr, 0), str);
737 free (mbstr); 877 free (mbstr);
738} 878}
739 OUTPUT: 879 OUTPUT:
740 RETVAL 880 RETVAL
741 881
748 888
749 rxvt_push_locale (THIS->locale); 889 rxvt_push_locale (THIS->locale);
750 wchar_t *wstr = rxvt_mbstowcs (data, len); 890 wchar_t *wstr = rxvt_mbstowcs (data, len);
751 rxvt_pop_locale (); 891 rxvt_pop_locale ();
752 892
753 RETVAL = wcs2sv (wstr); 893 RETVAL = taint_if (wcs2sv (wstr), octets);
754 free (wstr); 894 free (wstr);
755} 895}
756 OUTPUT: 896 OUTPUT:
757 RETVAL 897 RETVAL
758 898
759# very portable, especially on objects as opposed to pods 899#define TERM_OFFSET(sym) offsetof (TermWin_t, sym)
760#define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0)
761 900
762#define TERM_OFFSET_width TERM_OFFSET(width) 901#define TERM_OFFSET_width TERM_OFFSET(width)
763#define TERM_OFFSET_height TERM_OFFSET(height) 902#define TERM_OFFSET_height TERM_OFFSET(height)
764#define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) 903#define TERM_OFFSET_fwidth TERM_OFFSET(fwidth)
765#define TERM_OFFSET_fheight TERM_OFFSET(fheight) 904#define TERM_OFFSET_fheight TERM_OFFSET(fheight)
790 CODE: 929 CODE:
791 RETVAL = *(int *)((char *)THIS + ix); 930 RETVAL = *(int *)((char *)THIS + ix);
792 OUTPUT: 931 OUTPUT:
793 RETVAL 932 RETVAL
794 933
934unsigned int
935rxvt_term::ModLevel3Mask ()
936 ALIAS:
937 ModLevel3Mask = 0
938 ModMetaMask = 1
939 ModNumLockMask = 2
940 CODE:
941 switch (ix)
942 {
943 case 0: RETVAL = THIS->ModLevel3Mask; break;
944 case 1: RETVAL = THIS->ModMetaMask; break;
945 case 2: RETVAL = THIS->ModNumLockMask; break;
946 }
947 OUTPUT:
948 RETVAL
949
950char *
951rxvt_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
964int
965rxvt_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
795U32 973U32
796rxvt_term::parent () 974rxvt_term::parent ()
797 CODE: 975 CODE:
798 RETVAL = (U32)THIS->parent [0]; 976 RETVAL = (U32)THIS->parent [0];
799 OUTPUT: 977 OUTPUT:
850 wchar_t *wstr = new wchar_t [THIS->ncol]; 1028 wchar_t *wstr = new wchar_t [THIS->ncol];
851 1029
852 for (int col = 0; col < THIS->ncol; col++) 1030 for (int col = 0; col < THIS->ncol; col++)
853 wstr [col] = l.t [col]; 1031 wstr [col] = l.t [col];
854 1032
855 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); 1033 XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol))));
856 1034
857 delete [] wstr; 1035 delete [] wstr;
858 } 1036 }
859 1037
860 if (new_text) 1038 if (new_text)
981 else 1159 else
982 *r++ = *s; 1160 *r++ = *s;
983 1161
984 rxvt_pop_locale (); 1162 rxvt_pop_locale ();
985 1163
986 RETVAL = wcs2sv (rstr, r - rstr); 1164 RETVAL = taint_if (wcs2sv (rstr, r - rstr), string);
987 1165
988 delete [] rstr; 1166 delete [] rstr;
989} 1167}
990 OUTPUT: 1168 OUTPUT:
991 RETVAL 1169 RETVAL
1017 else if (IS_COMPOSE (*s)) 1195 else if (IS_COMPOSE (*s))
1018 r += rxvt_composite.expand (*s, r); 1196 r += rxvt_composite.expand (*s, r);
1019 else 1197 else
1020 *r++ = *s; 1198 *r++ = *s;
1021 1199
1022 RETVAL = wcs2sv (rstr, r - rstr); 1200 RETVAL = taint_if (wcs2sv (rstr, r - rstr), text);
1023 1201
1024 delete [] rstr; 1202 delete [] rstr;
1025} 1203}
1026 OUTPUT: 1204 OUTPUT:
1027 RETVAL 1205 RETVAL
1049 1227
1050 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) 1228 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES))
1051 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);
1052 1230
1053 if (GIMME_V != G_VOID) 1231 if (GIMME_V != G_VOID)
1054 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);
1055 1233
1056 if (newval) 1234 if (newval)
1057 { 1235 {
1058 if (SvOK (newval)) 1236 if (SvOK (newval))
1059 { 1237 {
1064 else 1242 else
1065 THIS->rs [index] = 0; 1243 THIS->rs [index] = 0;
1066 } 1244 }
1067} 1245}
1068 1246
1247bool
1248rxvt_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
1283bool
1284rxvt_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
1069void 1291void
1070rxvt_term::cur (...) 1292rxvt_term::screen_cur (...)
1071 PROTOTYPE: $;$$ 1293 PROTOTYPE: $;$$
1072 ALIAS: 1294 ALIAS:
1073 screen_cur = 0 1295 screen_cur = 0
1074 selection_beg = 1 1296 selection_beg = 1
1075 selection_end = 2 1297 selection_end = 2
1096 if (ix) 1318 if (ix)
1097 THIS->want_refresh = 1; 1319 THIS->want_refresh = 1;
1098 } 1320 }
1099} 1321}
1100 1322
1323char
1324rxvt_term::cur_charset ()
1325 CODE:
1326 RETVAL = THIS->charsets [THIS->screen.charset];
1327 OUTPUT:
1328 RETVAL
1329
1101int 1330int
1102rxvt_term::selection_grab (int eventtime = CurrentTime) 1331rxvt_term::selection_grab (U32 eventtime)
1103 1332
1104void 1333void
1105rxvt_term::selection (SV *newtext = 0) 1334rxvt_term::selection (SV *newtext = 0)
1106 PPCODE: 1335 PPCODE:
1107{ 1336{
1108 if (GIMME_V != G_VOID) 1337 if (GIMME_V != G_VOID)
1338 XPUSHs (THIS->selection.text
1109 XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); 1339 ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)))
1340 : &PL_sv_undef);
1110 1341
1111 if (newtext) 1342 if (newtext)
1112 { 1343 {
1113 free (THIS->selection.text); 1344 free (THIS->selection.text);
1114 1345
1115 THIS->selection.text = sv2wcs (newtext); 1346 THIS->selection.text = sv2wcs (newtext);
1116 THIS->selection.len = wcslen (THIS->selection.text); 1347 THIS->selection.len = wcslen (THIS->selection.text);
1117 } 1348 }
1118} 1349}
1350
1351void
1352rxvt_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)
1353
1354void
1355rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid)
1356
1357void
1358rxvt_term::scr_bell ()
1119 1359
1120void 1360void
1121rxvt_term::scr_add_lines (SV *string) 1361rxvt_term::scr_add_lines (SV *string)
1122 CODE: 1362 CODE:
1123{ 1363{
1145 char *old_cmdbuf_endp = THIS->cmdbuf_endp; 1385 char *old_cmdbuf_endp = THIS->cmdbuf_endp;
1146 1386
1147 THIS->cmdbuf_ptr = str; 1387 THIS->cmdbuf_ptr = str;
1148 THIS->cmdbuf_endp = str + len; 1388 THIS->cmdbuf_endp = str + len;
1149 1389
1390 rxvt_push_locale (THIS->locale);
1150 THIS->cmd_parse (); 1391 THIS->cmd_parse ();
1392 rxvt_pop_locale ();
1151 1393
1152 THIS->cmdbuf_ptr = old_cmdbuf_ptr; 1394 THIS->cmdbuf_ptr = old_cmdbuf_ptr;
1153 THIS->cmdbuf_endp = old_cmdbuf_endp; 1395 THIS->cmdbuf_endp = old_cmdbuf_endp;
1154} 1396}
1155 1397

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines