… | |
… | |
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 "unistd.h" |
|
|
35 | |
34 | #include "iom.h" |
36 | #include "iom.h" |
35 | #include "rxvt.h" |
37 | #include "rxvt.h" |
36 | #include "keyboard.h" |
38 | #include "keyboard.h" |
37 | #include "rxvtutil.h" |
39 | #include "rxvtutil.h" |
38 | #include "rxvtperl.h" |
40 | #include "rxvtperl.h" |
… | |
… | |
47 | |
49 | |
48 | #undef LINENO |
50 | #undef LINENO |
49 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
51 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
50 | #undef ROW |
52 | #undef ROW |
51 | #define ROW(n) THIS->row_buf [LINENO (n)] |
53 | #define ROW(n) THIS->row_buf [LINENO (n)] |
|
|
54 | |
|
|
55 | #define ENABLE_PERL_FRILLS 0 |
52 | |
56 | |
53 | ///////////////////////////////////////////////////////////////////////////// |
57 | ///////////////////////////////////////////////////////////////////////////// |
54 | |
58 | |
55 | static SV * |
59 | static SV * |
56 | taint (SV *sv) |
60 | taint (SV *sv) |
… | |
… | |
393 | |
397 | |
394 | struct rxvt_perl_interp rxvt_perl; |
398 | struct rxvt_perl_interp rxvt_perl; |
395 | |
399 | |
396 | static PerlInterpreter *perl; |
400 | static PerlInterpreter *perl; |
397 | |
401 | |
398 | rxvt_perl_interp::rxvt_perl_interp () |
|
|
399 | { |
|
|
400 | } |
|
|
401 | |
|
|
402 | rxvt_perl_interp::~rxvt_perl_interp () |
402 | rxvt_perl_interp::~rxvt_perl_interp () |
403 | { |
403 | { |
404 | if (perl) |
404 | if (perl) |
405 | { |
405 | { |
406 | perl_destruct (perl); |
406 | perl_destruct (perl); |
… | |
… | |
411 | void |
411 | void |
412 | rxvt_perl_interp::init () |
412 | rxvt_perl_interp::init () |
413 | { |
413 | { |
414 | if (!perl) |
414 | if (!perl) |
415 | { |
415 | { |
416 | temp_environ temp_environ(rxvt_environ); |
416 | perl_environ = rxvt_environ; |
|
|
417 | swap (perl_environ, environ); |
417 | |
418 | |
418 | char *argv[] = { |
419 | char *argv[] = { |
419 | "", |
420 | "", |
420 | "-T", |
421 | "-T", |
421 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
422 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
… | |
… | |
431 | |
432 | |
432 | perl_destruct (perl); |
433 | perl_destruct (perl); |
433 | perl_free (perl); |
434 | perl_free (perl); |
434 | perl = 0; |
435 | perl = 0; |
435 | } |
436 | } |
|
|
437 | |
|
|
438 | swap (perl_environ, environ); |
436 | } |
439 | } |
437 | } |
440 | } |
438 | |
441 | |
439 | static void |
442 | static void |
440 | ungrab (rxvt_term *THIS) |
443 | ungrab (rxvt_term *THIS) |
… | |
… | |
478 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
481 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
479 | } |
482 | } |
480 | |
483 | |
481 | } |
484 | } |
482 | |
485 | |
483 | if (!should_invoke [htype]) |
486 | if (!term->perl.should_invoke [htype]) |
484 | return false; |
487 | return false; |
485 | } |
488 | } |
486 | |
489 | |
487 | temp_environ temp_environ(rxvt_environ); |
490 | swap (perl_environ, environ); |
488 | |
491 | |
|
|
492 | try |
|
|
493 | { |
489 | dSP; |
494 | dSP; |
490 | va_list ap; |
495 | va_list ap; |
491 | |
496 | |
492 | va_start (ap, htype); |
497 | va_start (ap, htype); |
493 | |
498 | |
494 | ENTER; |
499 | ENTER; |
495 | SAVETMPS; |
500 | SAVETMPS; |
496 | |
501 | |
497 | PUSHMARK (SP); |
502 | PUSHMARK (SP); |
498 | |
503 | |
499 | XPUSHs (sv_2mortal (newSVterm (term))); |
504 | XPUSHs (sv_2mortal (newSVterm (term))); |
500 | XPUSHs (sv_2mortal (newSViv (htype))); |
505 | XPUSHs (sv_2mortal (newSViv (htype))); |
501 | |
506 | |
502 | for (;;) { |
507 | for (;;) { |
503 | data_type dt = (data_type)va_arg (ap, int); |
508 | data_type dt = (data_type)va_arg (ap, int); |
504 | |
509 | |
505 | switch (dt) |
510 | switch (dt) |
506 | { |
511 | { |
507 | case DT_INT: |
512 | case DT_INT: |
508 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
513 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
509 | break; |
514 | break; |
510 | |
515 | |
511 | case DT_LONG: |
516 | case DT_LONG: |
512 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
517 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
513 | break; |
518 | break; |
514 | |
519 | |
515 | case DT_STR: |
520 | case DT_STR: |
516 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
521 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
517 | break; |
522 | break; |
518 | |
523 | |
519 | case DT_STR_LEN: |
524 | case DT_STR_LEN: |
520 | { |
525 | { |
521 | char *str = va_arg (ap, char *); |
526 | char *str = va_arg (ap, char *); |
522 | int len = va_arg (ap, int); |
527 | int len = va_arg (ap, int); |
523 | |
528 | |
524 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
529 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
525 | } |
530 | } |
526 | break; |
531 | break; |
527 | |
532 | |
528 | case DT_WCS_LEN: |
533 | case DT_WCS_LEN: |
529 | { |
534 | { |
530 | wchar_t *wstr = va_arg (ap, wchar_t *); |
535 | wchar_t *wstr = va_arg (ap, wchar_t *); |
531 | int wlen = va_arg (ap, int); |
536 | int wlen = va_arg (ap, int); |
532 | |
537 | |
533 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
538 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
534 | } |
539 | } |
535 | break; |
540 | break; |
536 | |
541 | |
537 | case DT_XEVENT: |
542 | case DT_XEVENT: |
538 | { |
543 | { |
539 | XEvent *xe = va_arg (ap, XEvent *); |
544 | XEvent *xe = va_arg (ap, XEvent *); |
540 | HV *hv = newHV (); |
545 | HV *hv = newHV (); |
541 | |
546 | |
542 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
547 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
543 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
548 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
544 | # undef set |
549 | # undef set |
545 | |
550 | |
546 | setiv (type, xe->type); |
551 | setiv (type, xe->type); |
547 | setiv (send_event, xe->xany.send_event); |
552 | setiv (send_event, xe->xany.send_event); |
548 | setiv (serial, xe->xany.serial); |
553 | setiv (serial, xe->xany.serial); |
549 | |
554 | |
550 | switch (xe->type) |
555 | switch (xe->type) |
|
|
556 | { |
|
|
557 | case KeyPress: |
|
|
558 | case KeyRelease: |
|
|
559 | case ButtonPress: |
|
|
560 | case ButtonRelease: |
|
|
561 | case MotionNotify: |
|
|
562 | setiv (time, xe->xmotion.time); |
|
|
563 | setiv (x, xe->xmotion.x); |
|
|
564 | setiv (y, xe->xmotion.y); |
|
|
565 | setiv (row, xe->xmotion.y / term->fheight); |
|
|
566 | setiv (col, xe->xmotion.x / term->fwidth); |
|
|
567 | setiv (x_root, xe->xmotion.x_root); |
|
|
568 | setiv (y_root, xe->xmotion.y_root); |
|
|
569 | setiv (state, xe->xmotion.state); |
|
|
570 | break; |
|
|
571 | } |
|
|
572 | |
|
|
573 | switch (xe->type) |
|
|
574 | { |
|
|
575 | case KeyPress: |
|
|
576 | case KeyRelease: |
|
|
577 | setiv (keycode, xe->xkey.keycode); |
|
|
578 | break; |
|
|
579 | |
|
|
580 | case ButtonPress: |
|
|
581 | case ButtonRelease: |
|
|
582 | setiv (button, xe->xbutton.button); |
|
|
583 | break; |
|
|
584 | |
|
|
585 | case MotionNotify: |
|
|
586 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
587 | break; |
|
|
588 | } |
|
|
589 | |
|
|
590 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
591 | } |
|
|
592 | break; |
|
|
593 | |
|
|
594 | case DT_END: |
551 | { |
595 | { |
552 | case KeyPress: |
596 | va_end (ap); |
553 | case KeyRelease: |
597 | |
554 | case ButtonPress: |
598 | PUTBACK; |
555 | case ButtonRelease: |
599 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
556 | case MotionNotify: |
600 | SPAGAIN; |
557 | setiv (time, xe->xmotion.time); |
601 | |
558 | setiv (x, xe->xmotion.x); |
602 | if (count) |
559 | setiv (y, xe->xmotion.y); |
|
|
560 | setiv (row, xe->xmotion.y / term->fheight); |
|
|
561 | setiv (col, xe->xmotion.x / term->fwidth); |
|
|
562 | setiv (x_root, xe->xmotion.x_root); |
|
|
563 | setiv (y_root, xe->xmotion.y_root); |
|
|
564 | setiv (state, xe->xmotion.state); |
|
|
565 | break; |
603 | { |
|
|
604 | SV *status = POPs; |
|
|
605 | count = SvTRUE (status); |
|
|
606 | } |
|
|
607 | |
|
|
608 | PUTBACK; |
|
|
609 | FREETMPS; |
|
|
610 | LEAVE; |
|
|
611 | |
|
|
612 | if (SvTRUE (ERRSV)) |
|
|
613 | { |
|
|
614 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
615 | ungrab (term); // better lose the grab than the session |
|
|
616 | } |
|
|
617 | |
|
|
618 | if (htype == HOOK_DESTROY) |
|
|
619 | { |
|
|
620 | clearSVptr ((SV *)term->perl.self); |
|
|
621 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
622 | } |
|
|
623 | |
|
|
624 | swap (perl_environ, environ); |
|
|
625 | return count; |
566 | } |
626 | } |
567 | |
627 | |
568 | switch (xe->type) |
|
|
569 | { |
|
|
570 | case KeyPress: |
|
|
571 | case KeyRelease: |
|
|
572 | setiv (keycode, xe->xkey.keycode); |
|
|
573 | break; |
|
|
574 | |
|
|
575 | case ButtonPress: |
|
|
576 | case ButtonRelease: |
|
|
577 | setiv (button, xe->xbutton.button); |
|
|
578 | break; |
|
|
579 | |
|
|
580 | case MotionNotify: |
|
|
581 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
582 | break; |
|
|
583 | } |
|
|
584 | |
|
|
585 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
586 | } |
|
|
587 | break; |
|
|
588 | |
|
|
589 | case DT_END: |
|
|
590 | { |
|
|
591 | va_end (ap); |
|
|
592 | |
|
|
593 | PUTBACK; |
|
|
594 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
|
|
595 | SPAGAIN; |
|
|
596 | |
|
|
597 | if (count) |
|
|
598 | { |
|
|
599 | SV *status = POPs; |
|
|
600 | count = SvTRUE (status); |
|
|
601 | } |
|
|
602 | |
|
|
603 | PUTBACK; |
|
|
604 | FREETMPS; |
|
|
605 | LEAVE; |
|
|
606 | |
|
|
607 | if (SvTRUE (ERRSV)) |
|
|
608 | { |
|
|
609 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
610 | ungrab (term); // better lose the grab than the session |
|
|
611 | } |
|
|
612 | |
|
|
613 | if (htype == HOOK_DESTROY) |
|
|
614 | { |
|
|
615 | clearSVptr ((SV *)term->perl.self); |
|
|
616 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
617 | } |
|
|
618 | |
|
|
619 | return count; |
|
|
620 | } |
|
|
621 | |
|
|
622 | default: |
628 | default: |
623 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
629 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
|
|
630 | } |
624 | } |
631 | } |
625 | } |
632 | } |
|
|
633 | catch (...) |
|
|
634 | { |
|
|
635 | swap (perl_environ, environ); |
|
|
636 | throw; |
|
|
637 | } |
626 | } |
638 | } |
627 | |
639 | |
628 | ///////////////////////////////////////////////////////////////////////////// |
640 | ///////////////////////////////////////////////////////////////////////////// |
629 | |
641 | |
630 | MODULE = urxvt PACKAGE = urxvt |
642 | MODULE = urxvt PACKAGE = urxvt |
… | |
… | |
649 | # include "optinc.h" |
661 | # include "optinc.h" |
650 | # undef nodef |
662 | # undef nodef |
651 | # undef def |
663 | # undef def |
652 | |
664 | |
653 | HV *stash = gv_stashpv ("urxvt", 1); |
665 | HV *stash = gv_stashpv ("urxvt", 1); |
654 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
666 | struct { |
|
|
667 | const char *name; |
|
|
668 | IV iv; |
|
|
669 | } *civ, const_iv[] = { |
|
|
670 | # define const_iv(name) { # name, (IV)name } |
655 | export_const_iv (DEFAULT_RSTYLE); |
671 | const_iv (DEFAULT_RSTYLE), |
656 | export_const_iv (OVERLAY_RSTYLE); |
672 | const_iv (OVERLAY_RSTYLE), |
657 | export_const_iv (RS_Bold); |
673 | const_iv (RS_Bold), |
658 | export_const_iv (RS_Italic); |
674 | const_iv (RS_Italic), |
659 | export_const_iv (RS_Blink); |
675 | const_iv (RS_Blink), |
660 | export_const_iv (RS_RVid); |
676 | const_iv (RS_RVid), |
661 | export_const_iv (RS_Uline); |
677 | const_iv (RS_Uline), |
662 | |
678 | |
663 | export_const_iv (CurrentTime); |
679 | const_iv (CurrentTime), |
664 | export_const_iv (ShiftMask); |
680 | const_iv (ShiftMask), |
665 | export_const_iv (LockMask); |
681 | const_iv (LockMask), |
666 | export_const_iv (ControlMask); |
682 | const_iv (ControlMask), |
667 | export_const_iv (Mod1Mask); |
683 | const_iv (Mod1Mask), |
668 | export_const_iv (Mod2Mask); |
684 | const_iv (Mod2Mask), |
669 | export_const_iv (Mod3Mask); |
685 | const_iv (Mod3Mask), |
670 | export_const_iv (Mod4Mask); |
686 | const_iv (Mod4Mask), |
671 | export_const_iv (Mod5Mask); |
687 | const_iv (Mod5Mask), |
672 | export_const_iv (Button1Mask); |
688 | const_iv (Button1Mask), |
673 | export_const_iv (Button2Mask); |
689 | const_iv (Button2Mask), |
674 | export_const_iv (Button3Mask); |
690 | const_iv (Button3Mask), |
675 | export_const_iv (Button4Mask); |
691 | const_iv (Button4Mask), |
676 | export_const_iv (Button5Mask); |
692 | const_iv (Button5Mask), |
677 | export_const_iv (AnyModifier); |
693 | const_iv (AnyModifier), |
678 | |
694 | |
679 | export_const_iv (EVENT_NONE); |
695 | const_iv (EVENT_NONE), |
680 | export_const_iv (EVENT_READ); |
696 | const_iv (EVENT_READ), |
681 | export_const_iv (EVENT_WRITE); |
697 | const_iv (EVENT_WRITE), |
682 | } |
|
|
683 | |
698 | |
684 | void |
699 | const_iv (NoEventMask), |
685 | set_should_invoke (int htype, int value) |
700 | const_iv (KeyPressMask), |
686 | CODE: |
701 | const_iv (KeyReleaseMask), |
687 | rxvt_perl.should_invoke [htype] = value; |
702 | const_iv (ButtonPressMask), |
|
|
703 | const_iv (ButtonReleaseMask), |
|
|
704 | const_iv (EnterWindowMask), |
|
|
705 | const_iv (LeaveWindowMask), |
|
|
706 | const_iv (PointerMotionMask), |
|
|
707 | const_iv (PointerMotionHintMask), |
|
|
708 | const_iv (Button1MotionMask), |
|
|
709 | const_iv (Button2MotionMask), |
|
|
710 | const_iv (Button3MotionMask), |
|
|
711 | const_iv (Button4MotionMask), |
|
|
712 | const_iv (Button5MotionMask), |
|
|
713 | const_iv (ButtonMotionMask), |
|
|
714 | const_iv (KeymapStateMask), |
|
|
715 | const_iv (ExposureMask), |
|
|
716 | const_iv (VisibilityChangeMask), |
|
|
717 | const_iv (StructureNotifyMask), |
|
|
718 | const_iv (ResizeRedirectMask), |
|
|
719 | const_iv (SubstructureNotifyMask), |
|
|
720 | const_iv (SubstructureRedirectMask), |
|
|
721 | const_iv (FocusChangeMask), |
|
|
722 | const_iv (PropertyChangeMask), |
|
|
723 | const_iv (ColormapChangeMask), |
|
|
724 | const_iv (OwnerGrabButtonMask), |
|
|
725 | |
|
|
726 | const_iv (KeyPress), |
|
|
727 | const_iv (KeyRelease), |
|
|
728 | const_iv (ButtonPress), |
|
|
729 | const_iv (ButtonRelease), |
|
|
730 | const_iv (MotionNotify), |
|
|
731 | const_iv (EnterNotify), |
|
|
732 | const_iv (LeaveNotify), |
|
|
733 | const_iv (FocusIn), |
|
|
734 | const_iv (FocusOut), |
|
|
735 | const_iv (KeymapNotify), |
|
|
736 | const_iv (Expose), |
|
|
737 | const_iv (GraphicsExpose), |
|
|
738 | const_iv (NoExpose), |
|
|
739 | const_iv (VisibilityNotify), |
|
|
740 | const_iv (CreateNotify), |
|
|
741 | const_iv (DestroyNotify), |
|
|
742 | const_iv (UnmapNotify), |
|
|
743 | const_iv (MapNotify), |
|
|
744 | const_iv (MapRequest), |
|
|
745 | const_iv (ReparentNotify), |
|
|
746 | const_iv (ConfigureNotify), |
|
|
747 | const_iv (ConfigureRequest), |
|
|
748 | const_iv (GravityNotify), |
|
|
749 | const_iv (ResizeRequest), |
|
|
750 | const_iv (CirculateNotify), |
|
|
751 | const_iv (CirculateRequest), |
|
|
752 | const_iv (PropertyNotify), |
|
|
753 | const_iv (SelectionClear), |
|
|
754 | const_iv (SelectionRequest), |
|
|
755 | const_iv (SelectionNotify), |
|
|
756 | const_iv (ColormapNotify), |
|
|
757 | const_iv (ClientMessage), |
|
|
758 | const_iv (MappingNotify), |
|
|
759 | }; |
|
|
760 | |
|
|
761 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
|
|
762 | civ-- > const_iv; ) |
|
|
763 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
764 | } |
688 | |
765 | |
689 | void |
766 | void |
690 | warn (const char *msg) |
767 | warn (const char *msg) |
691 | CODE: |
768 | CODE: |
692 | rxvt_warn ("%s", msg); |
769 | rxvt_warn ("%s", msg); |
… | |
… | |
701 | CODE: |
778 | CODE: |
702 | RETVAL = newSVsv (sv); |
779 | RETVAL = newSVsv (sv); |
703 | SvTAINTED_off (RETVAL); |
780 | SvTAINTED_off (RETVAL); |
704 | OUTPUT: |
781 | OUTPUT: |
705 | RETVAL |
782 | RETVAL |
|
|
783 | |
|
|
784 | void |
|
|
785 | _exit (int status) |
706 | |
786 | |
707 | bool |
787 | bool |
708 | safe () |
788 | safe () |
709 | CODE: |
789 | CODE: |
710 | RETVAL = !rxvt_tainted (); |
790 | RETVAL = !rxvt_tainted (); |
… | |
… | |
812 | OUTPUT: |
892 | OUTPUT: |
813 | RETVAL |
893 | RETVAL |
814 | |
894 | |
815 | void |
895 | void |
816 | rxvt_term::destroy () |
896 | rxvt_term::destroy () |
|
|
897 | |
|
|
898 | #if ENABLE_PERL_FRILLS |
|
|
899 | |
|
|
900 | void |
|
|
901 | rxvt_term::XListProperties (U32 window) |
|
|
902 | PPCODE: |
|
|
903 | { |
|
|
904 | int count; |
|
|
905 | Atom *props = XListProperties (THIS->display->display, (Window)window, &count); |
|
|
906 | |
|
|
907 | EXTEND (SP, count); |
|
|
908 | while (count--) |
|
|
909 | PUSHs (newSVuv ((U32)props [count])); |
|
|
910 | |
|
|
911 | XFree (props); |
|
|
912 | } |
|
|
913 | |
|
|
914 | void |
|
|
915 | rxvt_term::XGetWindowProperty (U32 window, U32 property) |
|
|
916 | PPCODE: |
|
|
917 | { |
|
|
918 | Atom type; |
|
|
919 | int format; |
|
|
920 | unsigned long nitems; |
|
|
921 | unsigned long bytes_after; |
|
|
922 | unsigned char *prop; |
|
|
923 | XGetWindowProperty (THIS->display->display, (Window)window, (Atom)property, |
|
|
924 | 0, 1<<30, 0, AnyPropertyType, |
|
|
925 | &type, &format, &nitems, &bytes_after, &prop); |
|
|
926 | if (type != None) |
|
|
927 | { |
|
|
928 | EXTEND (SP, 3); |
|
|
929 | PUSHs (newSVuv ((U32)type)); |
|
|
930 | PUSHs (newSViv (format)); |
|
|
931 | PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); |
|
|
932 | XFree (prop); |
|
|
933 | } |
|
|
934 | } |
|
|
935 | |
|
|
936 | void |
|
|
937 | rxvt_term::XChangeWindowProperty (U32 window, U32 property, U32 type, int format, SV *data) |
|
|
938 | CODE: |
|
|
939 | { |
|
|
940 | STRLEN len; |
|
|
941 | char *data_ = SvPVbyte (data, len); |
|
|
942 | |
|
|
943 | XChangeProperty (THIS->display->display, (Window)window, (Atom)property, |
|
|
944 | type, format, PropModeReplace, |
|
|
945 | (unsigned char *)data, len * 8 / format); |
|
|
946 | } |
|
|
947 | |
|
|
948 | void |
|
|
949 | rxvt_term::XDeleteProperty (U32 window, U32 property) |
|
|
950 | CODE: |
|
|
951 | XDeleteProperty (THIS->display->display, (Window)window, (Atom)property); |
|
|
952 | |
|
|
953 | U32 |
|
|
954 | rxvt_term::DefaultRootWindow () |
|
|
955 | CODE: |
|
|
956 | RETVAL = (U32)THIS->display->root; |
|
|
957 | OUTPUT: |
|
|
958 | RETVAL |
|
|
959 | |
|
|
960 | U32 |
|
|
961 | rxvt_term::XCreateSimpleWindow (U32 parent, int x, int y, unsigned int width, unsigned int height) |
|
|
962 | CODE: |
|
|
963 | RETVAL = XCreateSimpleWindow (THIS->display->display, (Window)parent, |
|
|
964 | x, y, width, height, 0, |
|
|
965 | THIS->pix_colors_focused[Color_border], |
|
|
966 | THIS->pix_colors_focused[Color_border]); |
|
|
967 | OUTPUT: |
|
|
968 | RETVAL |
|
|
969 | |
|
|
970 | void |
|
|
971 | rxvt_term::XReparentWindow (U32 window, U32 parent, int x = 0, int y = 0) |
|
|
972 | CODE: |
|
|
973 | XReparentWindow (THIS->display->display, window, parent, x, y); |
|
|
974 | |
|
|
975 | #endif |
|
|
976 | |
|
|
977 | void |
|
|
978 | rxvt_term::set_should_invoke (int htype, int inc) |
|
|
979 | CODE: |
|
|
980 | THIS->perl.should_invoke [htype] += inc; |
817 | |
981 | |
818 | void |
982 | void |
819 | rxvt_term::grab_button (int button, U32 modifiers) |
983 | rxvt_term::grab_button (int button, U32 modifiers) |
820 | CODE: |
984 | CODE: |
821 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
985 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
… | |
… | |
1020 | CODE: |
1184 | CODE: |
1021 | RETVAL = (U32)THIS->vt; |
1185 | RETVAL = (U32)THIS->vt; |
1022 | OUTPUT: |
1186 | OUTPUT: |
1023 | RETVAL |
1187 | RETVAL |
1024 | |
1188 | |
|
|
1189 | void |
|
|
1190 | rxvt_term::vt_emask_add (U32 emask) |
|
|
1191 | CODE: |
|
|
1192 | THIS->vt_emask_perl |= emask; |
|
|
1193 | THIS->vt_select_input (); |
|
|
1194 | |
1025 | U32 |
1195 | U32 |
1026 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1196 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1027 | CODE: |
1197 | CODE: |
1028 | { |
|
|
1029 | RETVAL = THIS->rstyle; |
1198 | RETVAL = THIS->rstyle; |
1030 | THIS->rstyle = new_rstyle; |
1199 | THIS->rstyle = new_rstyle; |
1031 | } |
|
|
1032 | OUTPUT: |
1200 | OUTPUT: |
1033 | RETVAL |
1201 | RETVAL |
1034 | |
1202 | |
1035 | int |
1203 | int |
1036 | rxvt_term::view_start (int newval = -1) |
1204 | rxvt_term::view_start (int newval = -1) |
|
|
1205 | PROTOTYPE: $;$ |
1037 | CODE: |
1206 | CODE: |
1038 | { |
1207 | { |
1039 | RETVAL = THIS->view_start; |
1208 | RETVAL = THIS->view_start; |
1040 | |
1209 | |
1041 | if (newval >= 0) |
1210 | if (newval >= 0) |
… | |
… | |
1368 | CODE: |
1537 | CODE: |
1369 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1538 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1370 | OUTPUT: |
1539 | OUTPUT: |
1371 | RETVAL |
1540 | RETVAL |
1372 | |
1541 | |
|
|
1542 | #void |
|
|
1543 | #rxvt_term::selection_clear () |
|
|
1544 | |
|
|
1545 | void |
|
|
1546 | rxvt_term::selection_make (U32 eventtime, bool rect = false) |
|
|
1547 | CODE: |
|
|
1548 | THIS->selection.op = SELECTION_CONT; |
|
|
1549 | THIS->selection.rect = rect; |
|
|
1550 | THIS->selection_make (eventtime); |
|
|
1551 | |
1373 | int |
1552 | int |
1374 | rxvt_term::selection_grab (U32 eventtime) |
1553 | rxvt_term::selection_grab (U32 eventtime) |
1375 | |
1554 | |
1376 | void |
1555 | void |
1377 | rxvt_term::selection (SV *newtext = 0) |
1556 | rxvt_term::selection (SV *newtext = 0) |